- Home
- MCQs by exam
- NTS
NTS MCQs · Page 138
5,604 multiple choice questions typical of the NTS exam, with answers and explanations. Switch on practice mode to test yourself first.
-
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
-
A
quarter radius from the axis
-
B
neutral axis of the shaft
-
C
outer surface of the shaft
Correct answer
-
D
centre of the cross-section
-
A
one third of the driver's speed
Correct answer
-
B
three times the driver's speed
-
C
one half of the driver's speed
-
D
the same speed as the driver
-
A
80 percent
-
B
40 percent
Correct answer
-
C
60 percent
-
D
20 percent
-
A
force multiplied by distance
-
B
force per unit area
Correct answer
-
C
deformation per unit length
-
D
work done per unit volume
-
A
hardness of the workpiece
-
B
weight of the workpiece
-
C
diameter of the workpiece
Correct answer
-
D
length of the workpiece
-
A
Gibbs free energy
-
B
enthalpy
Correct answer
-
C
internal energy
-
D
entropy
-
A
intake and compression strokes
-
B
compression and power strokes
Correct answer
-
C
intake and power strokes
-
D
exhaust and intake strokes