1. How many SQL database tables are required to track the following info?

Customer

Purchase order number

Purchase order date

Purchased items

Purchase price for each item

Assuming that:

Same customer can make multiple purchases on different or same dates

One purchase order can contain multiple items

All items have specific item numbers

Solution: three tables;

Customer table – that will contain customer’s information like address, …

Items table – that will contain product type, manufacturing company, expiration date, …

Order table – that will contain item number, customer id, quantity ordered, date of purchase …

2. Generate all possible test scenarios and test cases to test a pencil sharper

Solution:

I use new pencils and check whether the machine sharpens well or not.

I use a used pencil with core too short that needs re-sharpening and check whether the machine sharpens well or not.

I use pencils with cores of different core size but same material and see how fast the machine will sharpen.

I use the machine continuously for a long period of time and check whether the blade gets blunt quickly or not.

I will check how long will it take for the chipping container filled to capacity and see the impact on its usage.

I will check how economical is the sharpener. Does it chop muck core? …

I push the pencil and see how resistant is the machine. I will check whether it shatter or break the exposed core entirely and check whether the impact be mitigated or not.

I will try sharpening with a clean piece of paper spread before me and check whether litter the place with chopped pieces of black core and other chippings or not.

I will check whether the machine is easy to use or not. I will check whether its sharpening blade is well covered or not.

I will check the protection /security mechanisms –

Protection from theft,

Whether I can protect unauthorized users from using or harm it.

3. What's the difference between a Queue and a Stack? What data structure would be used implement a Stack and a Queue.

Solution:

Difference between a Queue and a Stack:

A stack is a list in which deletion and insertion of elements can occur only in one designated position called the top of the stack. It applies LIFO (Last in first out manipulation of insertion and deletion of elements). The right most element is the top of the stack.

Queue is a list in which elements are added to the rear (enque) and removed from the front (dequeue). It applies FIFO (First in first out manipulation of insertion and deletion of elements).

We use a linked list data structure to implement any of the two efficiently.

4. What's the big O order of binary search?

Solution:

Order of ( log N) – where the logarithm is in base two.

No comments: