- Home
- MCQs by exam
- NTS
NTS MCQs · Page 210
5,604 multiple choice questions typical of the NTS exam, with answers and explanations. Switch on practice mode to test yourself first.
-
A
[1, 2, 3]
-
B
[2, 3]
Correct answer
-
C
2
-
D
(2, 3)
-
A
None
-
B
TypeError
-
C
False
-
D
True
Correct answer
-
A
nonlocal
Correct answer
-
B
outer
-
C
static
-
D
global
-
A
'-a-b-c-'
-
B
['a-b-c']
-
C
'abc-'
-
D
'a-b-c'
Correct answer
-
A
False
-
B
5
-
C
True
Correct answer
-
D
None
-
A
{2: 'hi', 3: 'cat'}
-
B
{2, 3}
-
C
{'hi': 2, 'cat': 3}
Correct answer
-
D
[2, 3]
-
A
IBM
Correct answer
-
B
Microsoft
-
C
Google
-
D
Intel
-
A
2ⁿ
Correct answer
-
B
n
-
C
2n
-
D
n²
-
A
The total number of elements
-
B
The number of dimensions
Correct answer
-
C
The data type of the array
-
D
The size of each element in bytes
-
A
array([3, 1])
-
B
array([8, 9])
Correct answer
-
C
array([1, 3])
-
D
array([False, True, False, True])
-
A
10
-
B
An IndexError
-
C
40
Correct answer
-
D
30
-
A
8
-
B
2
-
C
1
-
D
4
Correct answer
-
A
Assigns a value inside an expression
Correct answer
-
B
Compares two values for identity
-
C
Swaps the values of two variables
-
D
Declares a constant that cannot change
-
A
To copy the list faster using less memory
-
B
To remove duplicate items while copying
-
C
To convert the list into an immutable tuple
-
D
To copy the inner lists as well
Correct answer
-
A
[1, 'a', 2, 'b', 3]
-
B
An error because the lengths differ
-
C
[(1, 'a'), (2, 'b')]
Correct answer
-
D
[(1, 'a'), (2, 'b'), (3, None)]
-
A
(0, 'a') and (1, 'b')
-
B
(1, 'a') and (2, 'b')
Correct answer
-
C
(1, 'b') and (2, 'a')
-
D
('a', 1) and ('b', 2)
-
A
['banana', 'kiwi', 'fig']
-
B
['fig', 'kiwi', 'banana']
Correct answer
-
C
['banana', 'fig', 'kiwi']
-
D
['fig', 'banana', 'kiwi']
-
A
'ytho'
-
B
'yth'
Correct answer
-
C
'pyt'
-
D
'pyth'
-
A
Global variables cannot be read by any function
-
B
Each thread receives its own private memory heap
-
C
Only one thread executes Python bytecode at a time
Correct answer
-
D
Python code always runs on all CPU cores at once
-
A
It returns a generator that yields lazily
Correct answer
-
B
It returns all of its values at once in a list
-
C
It can only be called once in the whole program
-
D
It pauses the entire program until input arrives
-
A
A tool that formats code according to PEP 8
-
B
A comment that documents what a function does
-
C
A function that wraps another function
Correct answer
-
D
A special variable that stores class constants
-
A
A tuple and a dictionary
Correct answer
-
B
A dictionary and a tuple
-
C
Two separate lists
-
D
A list and a set
-
A
An error
-
B
[1, 2]
Correct answer
-
C
[2]
-
D
[1]
-
A
[0, 1, 4, 9]
Correct answer
-
B
[0, 2, 4, 6]
-
C
[0, 1, 2, 3]
-
D
[1, 4, 9, 16]
-
A
{{ }} outputs variables; {% %} runs tags like for/if
Correct answer
-
B
Both are comments that the browser never shows
-
C
Both output variables, with different formatting
-
D
{{ }} runs tags like for/if; {% %} outputs variables