Samsung Previous Years Solved Sample Placement Papers
-
Choose the correct alternative for the following arrangement of colors under the cups numbered from 1 through 6:
The cups conform to the given conditions.
(a) Green, yellow, magenta, red, purple, orange
(b) Magenta, green, purple, red, orange, yellow
(c) Magenta, red, purple, yellow, green, orange
(d) Orange, yellow, red, magenta, green, purple
(e) Red, purple, magenta, yellow, green, orange Answer: Option C
- Solution: Considering the conditions provided, the purple ball must be under a lower-numbered cup than the orange ball, and the green ball is under cup 5. This arrangement satisfies all conditions.
-
A ball of which of the following colors could be under cup 6?
(a) Green
(b) Magenta
(c) Purple
(d) Red
(e) Yellow Answer: Option E
- Solution: Since the green ball is under cup 5 and the conditions determine other placements, yellow is a valid color for cup 6.
-
If the purple ball is under cup 4, the orange ball must be under:
(a) 1
(b) 2
(c) 3
(d) 5
(e) 6 Answer: Option E
- Solution: If the purple ball is under cup 4, the orange ball must be under a higher-numbered cup according to the given conditions. Hence, cup 6 is the correct answer.
-
Which of the following must be true?
(a) The green ball is under a lower-numbered cup than the yellow ball.
(b) The orange ball is under a lower-numbered cup than the green ball.
(c) The purple ball is under a lower-numbered cup than the red ball.
Answer: Option C
- Solution: From the conditions, the purple ball is always under a lower-numbered cup than the red ball, making Option C correct.
-
If an integer needs two bytes of storage, the maximum value of an unsigned integer is:
(a) 216-1
(b) 215-1
(c) 216
(d) 215 Answer: Option A
- Solution: For an unsigned integer with two bytes, the maximum value is 216-1 because all bits are used for the magnitude.
-
If an integer needs two bytes of storage, the maximum value of a signed integer is:
(a) 216-1
(b) 215-1
(c) 216
(d) 215 Answer: Option B
- Solution: For a signed integer, the highest value is 215-1, as one bit is used for the sign.
-
What is the output of the code `printf("%d", printf("tim"));`?
(a) Results in a syntax error
(b) Outputs "tim3"
(c) Outputs garbage
(d) Prints "tim" and terminates abruptly Answer: Option B
- Solution: The inner `printf("tim")` prints "tim" and returns 3 (the number of characters printed), which is then printed by the outer `printf`.
-
The length of the string "correct" is:
(a) 7
(b) 8
(c) 6
(d) Implementation-dependent Answer: Option A
- Solution: The string "correct" has 7 characters, including the terminating null character.
-
Consider the program fragment:
`char c = 'a'; while (c++ <= 'z') putchar(xxx);`
If the required output is "abcd...wxyz," then `xxx` should be:
(a) c
(b) c++
(c) c-1
(d) --c Answer: Option C
- Solution: The decrement by 1 (`c-1`) ensures the correct character is printed as `c` is incremented in the loop condition.
-
Consider the function:
`find(int x, int y) { return (x < y ? x : y); }`
The call `find(a, find(a, b))` can be used to find:
(a) Maximum of a, b
(b) Positive difference of a, b
(c) Sum of a, b
(d) Minimum of a, b Answer: Option D
- Solution: The function returns the smaller of two values, and the nested call ensures the smallest of all inputs.