Home
MCQs by exam
NTS
NTS MCQs · Page 90
5,604 multiple choice questions typical of the NTS exam, with answers and explanations. Switch on practice mode to test yourself first.
A
Register, because the literal is a constant expression folded at compile time
B
Automatic, matching the enclosing block, so the array dies when that block exits
Correct answer
C
Static, so the array outlives the enclosing block and can safely be returned to its caller
D
Dynamic, because the compiler reserves the array with an implicit malloc call at run time
A
Undefined behaviour, because the shift count is not less than the operand's width
Correct answer
B
Defined to yield zero, because every set bit is shifted out of the 32-bit range entirely
C
Implementation-defined, so the compiler documents whether it wraps the count
D
A constraint violation, so a strictly conforming compiler must reject the code
A
The extra parentheses force a temporary object, so the postfix increment is discarded
B
The preprocessor evaluates i++ once and then passes the resulting value twice
C
The argument is substituted twice, so i is incremented twice in one expression
Correct answer
D
The macro expands into a full statement, so it cannot legally appear inside an expression
A
Exactly one byte, chosen so the type is large enough for the largest enumerator value
B
Exactly sizeof(int), because every enumerator is guaranteed to have type int in C
C
Exactly sizeof(long), because enums are stored in the widest integer type
D
An implementation-defined choice among char, signed int and unsigned int types
Correct answer
A
Assignment performs a shallow copy, so the two structs end up sharing member storage
B
Padding bytes may hold indeterminate values, so a byte comparison can report differences
Correct answer
C
The member-wise copy converts floating values, so bit patterns can differ in the last unit
D
memcmp inspects only the first member of the struct, ignoring all the trailing members
A
Accesses become atomic between threads, so no torn reads or partial writes can ever occur
B
A hardware memory barrier is inserted around each access to order it against other threads
C
The object is placed in a memory section that hardware cannot write behind the program's back
D
Every access written in the abstract machine is performed, so the compiler cannot cache it
Correct answer
A
int (*fp)(int); which means exactly the same thing as int *fp(int) under the C declarator precedence rules
B
int fp(*)(int); which places the pointer inside the parameter list rather than on the name
C
int (*fp)(int); which declares a function pointer, unlike int *fp(int) which declares a function
Correct answer
D
int *fp(int); which declares a function pointer, while int (*fp)(int) declares a function
A
4 and 3, because sizeof counts the terminating NUL while strlen does not
Correct answer
B
3 and 3, because both operators measure only the visible characters
C
3 and 4, because sizeof excludes the NUL that strlen includes in its count
D
4 and 4, because strlen also counts the implicit terminating NUL byte
A
memmove handles overlap by choosing a safe copy direction, while memcpy does not
Correct answer
B
memcpy refuses overlapping ranges at run time and returns a null pointer instead
C
memmove is needed only when the two ranges are exactly equal, not when they overlap
D
memcpy copies through a hidden temporary buffer, so it needs twice the stack space
A
fgets rewinds the file when it reaches the last record, so the final line is read again
B
feof returns true at the start of the last line, so the guard terminates far too early
C
puts flushes the buffer twice when the final newline is missing from the file
D
feof only becomes true after a read hits end of file, so one extra iteration runs
Correct answer
A
Only the characters before the newline, since the newline stays in the input stream
B
The line including its trailing newline character, if one was present in the input
Correct answer
C
The line with the newline stripped away, because fgets always truncates at the line terminator
D
The line with the newline replaced by a NUL plus the previous buffer contents kept
A
The copy is truncated to three bytes and a NUL fills the last position of dst
B
The call is rejected at run time and dst keeps its previous uninitialised bytes
C
The four bytes are copied with no terminating NUL, so dst is not a valid string
Correct answer
D
Three bytes are copied and a NUL is appended, since space is always reserved
A
They keep their latest modified values because the stack frame is never touched
B
They are reset to zero, since longjmp reinitialises the function's automatic objects
C
Their values are indeterminate if they were modified between setjmp and longjmp
Correct answer
D
Their values are reliably restored to the values they held at the setjmp call
A
uint8_t with value 44, because the sum wraps at 256 and is truncated back down
B
unsigned int with value 300, because uint8_t promotes to unsigned int on all targets
C
int with value 44, because the sum is computed in 8 bits and then sign-extended up
D
int with value 300, because both operands are promoted to int before the addition
Correct answer
A
2, because the remainder operator always normalises the result to a non-negative value
B
-2, because the quotient is floored downward, which shifts the remainder in the negative direction
C
1, because the sign of a remainder is taken from the divisor rather than from the dividend
D
-1, because division truncates toward zero, so the remainder keeps the dividend's sign
Correct answer
A
K, by changing the soil's texture with sand or clay
B
A, by measuring the plot area and converting it into hectares
C
C and P, through cover cropping and conservation structures
Correct answer
D
R, through rainfall control and cloud seeding over the catchment
A
Organic matter (humus)
Correct answer
B
Silt loam and fine sand
C
Coarse sand and silt loam
D
Fine kaolinite clays
A
Saline-sodic, needing only gypsum and no drainage, since the salts will leach out in the monsoon
B
Sodic, and it should be reclaimed with gypsum and a rice crop in the rotation
C
Normal, needing no treatment beyond the usual fertiliser and a light irrigation
D
Saline, and it should be reclaimed by leaching with good-quality water and drainage
Correct answer
A
720 hectares per cumec
B
2,160 hectares per cumec
C
1,728 hectares per cumec
Correct answer
D
1,080 hectares per cumec
A
43 per cent
Correct answer
B
57 per cent
C
15 per cent
D
75 per cent
A
About 14 mm
B
About 57 mm
Correct answer
C
About 28 mm
D
About 114 mm
A
Powdery mildew develops on the upper leaf surface in dry, humid air, while downy mildew needs free water and appears mainly on the underside
Correct answer
B
Powdery mildew affects only roots and downy mildew only fruits, so the two diseases never appear on the same plant at the same time
C
Both are controlled only by insecticides, since neither pathogen responds to sulphur or copper fungicides at any stage of the crop cycle
D
Powdery mildew is caused by a bacterium and downy mildew by a virus, so only the first responds to antibiotics and to the copper sprays used in the orchard
A
The toxin blocks the insect nervous system like a pyrethroid and paralyses the larva quickly
B
The plant produces a fungicide that prevents spore germination on the leaf surface and in the whorl of the plant
C
The toxin prevents moulting by inhibiting chitin synthesis in the cuticle of the developing larva
D
Cry protein is activated in the alkaline gut and binds midgut receptors, forming pores that cause septicaemia
Correct answer
A
ragged holes and moist frass in the whorl, with larvae showing an inverted Y on the head
Correct answer
B
root galls caused by soil insects that feed below the crown of the plant and roots
C
circular holes in stored grain only, with no damage to the standing crop or the cobs
D
yellowing along leaf veins without feeding damage and with healthy larvae absent from the whorl
A
Pyrilla perpusilla, spread by winged adults that feed on the leaf sap
B
Puccinia melanocephala, spread by wind-borne spores in the monsoon
C
Colletotrichum falcatum, spread mainly through infected setts and soil
Correct answer
D
Xanthomonas oryzae, spread by irrigation water between the fields of the valley
Practise on paper
Preparing for NTS?
Make it your exam plan: see your progress in every subject and topic, set a daily goal and practise what you have not done yet.
Start my NTS plan
Test yourself
Take a timed online test and get a certificate, or play today's quick quiz.
Online tests
Daily quiz