Subex Previous Years Solved Sample Placement Papers
-
What is the state of the marked line (i)?
A. dangling pointer p
B. defined
C. memory leakage during malloc
D. Answer: Option A
- Solution: The `realloc(p, 0)` makes `p` a dangling pointer because it frees the memory pointed to by `p` without assigning it a new address.
-
What will the program return?
A. Always 0
B. Always 1 Answer: Option A
- Solution: The condition `if (i++, i)` evaluates `i` after the increment, but since the incremented value is 0 (false), it always returns 0.
-
What will be the value of `is_keyword`?
A. Compile error
B. 1
C. Error, before the `:` Answer: Option A
- Solution: Bitfields cannot be accessed or printed without proper initialization, leading to a compile error.
-
What is the size of `ARRAY_SIZE`?
A. 20
B. 200
C. 16
D. 160 Answer: Option B
- Solution: The array size is 10, and the struct size is padded to a multiple of 20. Hence, 10 x 20 = 200.
-
What will be the output of the following program?
A. Hello,world0000000000
B. Hello,worl
C. 0000000000Hello,world
D. Hello,world Answer: Option D
- Solution: The program prints the string directly without adding spaces or truncating.
-
What will be the output of this program?
A. The string is : First
B. The string is : FirstSecond
C. The string is
D. Unknown, since the scope of the pointer is local Answer: Option C
- Solution: The `static` variable `xxx` is overwritten with the second value "Second," so the program outputs "The string is".
-
What is the output of the following recursive program?
A. 0,0,1,2,3,
B. 4,8,12,16,0
C. Error cannot pass element pointer
D. 0,16,12,8,4 Answer: Option D
- Solution: The recursive function processes the array from the last element backward, printing the elements in reverse order.
-
What is the output of the following line in a 32-bit OS?
A. 4,2
B. 1,1
C. 1,2
D. 2,2 Answer: Option C
- Solution: The size of a character literal is 1 byte, while the size of a string literal includes a null terminator, making it 2 bytes.
-
What is the output of the following program?
A. 150
B. 64
C. 125
D. 225 Answer: Option B
- Solution: The function computes the cube of the number 4, which is 64.