- Home
- MCQs by exam
- PPSC IT
PPSC IT MCQs · Page 16
577 multiple choice questions typical of the PPSC IT exam, with answers and explanations. Switch on practice mode to test yourself first.
-
A
6, because the values are summed
-
B
A compile-time error, since commas are invalid
-
C
3, because the comma yields the last value
Correct answer
-
D
1, because the first value is assigned
-
A
Sets the lowest clear bit of x
-
B
Doubles the value of x
-
C
Reverses the bits of x
-
D
Clears the lowest set bit of x
Correct answer
-
A
3abc, because the inner call's value is buffered first
-
B
abc, with the outer %d printing garbage
-
C
abc3, because printf returns the characters written
Correct answer
-
D
abc0, because the inner call returns nothing
-
A
Restarts the loop from its initial value
-
B
Skips the update expression for that pass only
-
C
Skips the rest of the body and runs the update step
Correct answer
-
D
Exits the loop immediately and continues with the next statement
-
A
It is a compile-time error in every C compiler
-
B
4, because character constants have type int
Correct answer
-
C
1, because a character occupies one byte
-
D
2, because the value fits in a short
-
A
int *(fp(int, int));
-
B
int fp(*)(int, int);
-
C
int (*fp)(int, int);
Correct answer
-
D
int *fp(int, int);
-
A
Opens it read-only until data is written
-
B
Truncates the file to zero length before writing
Correct answer
-
C
Appends new text after the existing content of the file
-
D
Fails and returns NULL to protect the file
-
A
1004, only if p points to an array
-
B
1004, one int further along in memory
Correct answer
-
C
1001, one byte further along in memory
-
D
1000, since the address is unchanged
-
A
8, because padding aligns the int to 4 bytes
Correct answer
-
B
5, the sum of the two member sizes
-
C
4, because the char is packed inside the int
-
D
16, because every struct is 16-byte aligned
-
A
Undefined behaviour, because the literal is read-only
Correct answer
-
B
The literal is modified and prints "Hello"
-
C
A copy on the heap is modified instead
-
D
The compiler automatically allocates writable memory for the literal
-
A
The number of differing characters in the strings
-
B
A negative value, because "apple" sorts first
Correct answer
-
C
Zero, because the strings are different
-
D
A positive value, because "apple" is longer
-
A
Both the pointer and the characters are fixed
-
B
Nothing, since const is ignored on pointers
-
C
The pointed-to characters cannot be modified
Correct answer
-
D
The pointer p cannot be reassigned
-
A
It raises a runtime fault on the expression
-
B
It skips evaluating the right operand
Correct answer
-
C
It evaluates both operands and compares them
-
D
It falls back to a bitwise AND on the bits
-
A
20, the array's second element
-
B
10, the element at the base address
-
C
The address of the third element itself
-
D
30, the third element of the array
Correct answer
-
A
Allocates 100 bytes of static storage
-
B
Creates a function named MAX returning 100
-
C
Performs textual substitution before compilation
Correct answer
-
D
Declares a constant integer variable at run time
-
A
continue, which jumps ahead to the next iteration of the loop
-
B
return, which leaves the whole function
-
C
goto, which jumps to a labelled statement
-
D
break, which transfers control after the construct
Correct answer
-
A
Garbage values from the previous stack contents
-
B
2, because the last value is repeated
-
C
1, because the initialiser wraps around
-
D
0, because the remaining elements are zeroed
Correct answer
-
A
%c
-
B
%s
-
C
%f
Correct answer
-
D
%d
-
A
p.age, which selects from the pointer itself
-
B
*p.age, which binds the dot first
-
C
&p.age, which takes the member address
-
D
p->age, which dereferences and selects
Correct answer
-
A
'D', because the second letter position is skipped
-
B
'C', because letters have consecutive codes
Correct answer
-
C
65, because the value stays numeric
-
D
'B', because incrementing adds one
-
A
5, the characters before the terminating null byte
Correct answer
-
B
6, counting the terminating null byte as well
-
C
4, because the first character is not counted at all
-
D
It is undefined for a string literal argument
-
A
The switch statement, which selects a case label
-
B
The do-while loop, which tests after the body
Correct answer
-
C
The while loop, which tests before the body
-
D
The for loop, which tests before the body
-
A
<math.h>
-
B
<stdlib.h>
Correct answer
-
C
<stdio.h>
-
D
<string.h>
-
A
3.5, because floating division keeps the fraction
-
B
4, because the result is rounded to nearest
-
C
2, because the result is rounded downward
-
D
3, because integer division truncates toward zero
Correct answer
-
A
1, because the two operands cancel out
-
B
5, the number of elements in the array
Correct answer
-
C
20, the total size of the array in bytes
-
D
4, the size of one integer element