# Placement Papers: Amazon Written Test Sample

Doorsteptutor material for competitive exams is prepared by world's top subject experts: get questions, notes, tests, video lectures and more- for all subjects of your exam.

Written Test has 2 Sections A, B In Section A there were 20 Questions: Time: 30 min

- Two tables emp (empid, name, deptid, sal) and dept (deptid, deptname) are there. Write a query which displays empname, corresponding deptname also display those employee names who donot belong to any dept.
- Display the employees whose salary is less than average salary.
- what is the output of the program main () {int c = 5; printf ( “% d⧵n % d⧵n % d” c, c ≪ 2, c ≫ 2) ;}
- main () {int a [8] [10] c = 0, i, j; for (i = 0; i < 10; i ++) for (j = 0; j < 8; j ++) a [j] [i] = c ++ ; printf ( “% d” a [3] [6] ) ;}
- What is the wrong in this program main () {char ⚹ p, ⚹ q; p = (char ⚹) malloc (25) ; q = (char ⚹) malloc (25) ; strcpy (p, “amazon” ) ; strcpy (q, “hyd” ) ; strcat (p, q) ; printf ( “% s” p) ;}
- write prefix and post fix notation for (a + b) ⚹ c- (d + e) ^ (f-g)
- what is the output of the program main () {int i = 5; printf ( “% d” fun (fun (fun (fun (fun (i) ) ) ) ) ) ;} void fun (int i) {if (i % 2) return (i + (7 ⚹ 4) - () + (2 ⚹ 2) ) ; else return (i + () - () + () ) ;}
- When it is always true boolean fun (node ⚹ p) {return ( (p == null) | (p ⇾ next == null) | (p ⇾ info ⇐ p ⇾ next ⇾ info) && (fun (p ⇾ next) ) ) ;}
- when list is empty or has one node
- when the ele are sorted in non decreasing order
- when the ele are sorted in non increasing order

- what is x here (x&& (x& (x − 1) !) == 1)
- x is always a prime
- x is a power of 2
- x is even
- x is odd

- What is the difference between deep copy and shallow copy
- In java what is the difference between sleep () and wait () .
- What happens when the parent process of a child process exits before the child?
- There are three persons A, B, C. A shots the target 6 times out of 7 shots. B shots 4 out of 5 shots. Then what is the probability of hitting the target twice when 2 persons are selected at random.
- what is valid in cpp char ⚹ cp; const char ⚹ cpp
- cpp = cp
- cp = cpp

- write program to swap 2 variables without using extra memory.
- write a shell command to find all java files present in nested directories.
- There are 6 pairs of black socks and 6 pairs of white socks. What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness.
- A string of alphanumeric is there. Find a string that starts with b and ends with 3 characters. Section B (we have to write programs) time: 30 min
- There is a sorted array which is of very large size. In that all except one no. Are repeated once. How to find that non repeated no.
- There are 2 linked lists. Those 2 lists are meeting at a point. How to find that meeting point.