- Home
- MCQs by exam
- NTS
- Computer Science MCQs
NTS MCQs – Computer Science MCQs · Page 12
455 multiple choice questions typical of the NTS exam, with answers and explanations. Switch on practice mode to test yourself first.
-
A
To stop derived classes from redefining it
-
B
To force the function to be inlined everywhere
-
C
To hide the function from other translation units
-
D
To allow dispatch at runtime through a base pointer
Correct answer
-
A
a + i
-
B
*(a + i)
Correct answer
-
C
*(a + i * 4)
-
D
&a[i]
-
A
It allocates memory for the type
-
B
It makes every member static
-
C
It blocks copying of the struct
-
D
It creates an alias for the type
Correct answer
-
A
1
-
B
2
-
C
3
-
D
0
Correct answer
-
A
To allow it to read wide characters
-
B
To make it faster than putchar
-
C
So that EOF can be told apart from data
Correct answer
-
D
Because characters are stored as int
-
A
The block is simply released again
-
B
A compile-time error in every compiler
-
C
The pointer is set to NULL for you
-
D
Undefined behaviour and possible heap damage
Correct answer
-
A
Only the source characters, no null
-
B
At most n characters from the source
-
C
The address of the source string
-
D
The source characters and its null byte
Correct answer
-
A
They must be listed in ascending order
-
B
They must be integer constant expressions
Correct answer
-
C
They must be distinct string literals
-
D
They must be variables of type int
-
A
A pointer to a function taking an int
Correct answer
-
B
A function that returns an int pointer
-
C
An array of pointers to functions
-
D
A pointer to an array of int values
-
A
4
-
B
8
-
C
1
Correct answer
-
D
2
-
A
calloc leaves the block uninitialised
-
B
calloc zero-fills the allocated block
Correct answer
-
C
calloc places the block on the stack
-
D
calloc resizes an existing block
-
A
It stays valid until the enclosing block ends
-
B
It is aligned for any type with a fundamental alignment
Correct answer
-
C
It points into the current function's stack frame
-
D
It is zero-filled before it is handed back
-
A
13
-
B
10
-
C
11
Correct answer
-
D
25
-
A
-3
Correct answer
-
B
-4
-
C
-3.5
-
D
3
-
A
A compile-time error is reported
-
B
The literal is copied before writing
-
C
The write is silently discarded
-
D
The behaviour is undefined
Correct answer
-
A
4
-
B
7
-
C
5
Correct answer
-
D
6
-
A
It leaves the innermost enclosing loop
Correct answer
-
B
It skips only the current iteration
-
C
It terminates the whole program at once
-
D
It restarts the loop from the beginning
-
A
%lf
Correct answer
-
B
%f
-
C
%d
-
D
%.2f
-
A
Null
-
B
True
-
C
Zero
Correct answer
-
D
False
-
A
10
Correct answer
-
B
5
-
C
15
-
D
20
-
A
The compiler promotes the variable to global
-
B
The program stops with a runtime error
-
C
Using that pointer is undefined behaviour
Correct answer
-
D
The value is moved to the heap automatically
-
A
It is stored in the caller's frame
-
B
It becomes visible in other files
-
C
It is reset on every function entry
-
D
It retains its value between calls
Correct answer
-
A
A pointer to its first element
Correct answer
-
B
A pointer to its last element
-
C
A copy of the entire array
-
D
The count of its elements
-
A
7
-
B
4
-
C
6
Correct answer
-
D
5
-
A
3
-
B
6
Correct answer
-
C
7
-
D
8