✦ Scientech Easy
Online Basic Python Test
📄
30
Questions
⏱
20 min
Time Limit
⭐
4
Marks / Q
−
1
Negative
✅
70%
Pass Mark
‣ Read each question carefully before answering.
‣ Use the palette to navigate and bookmark questions.
‣ Wrong answers carry negative marks. Skipped = zero.
‣ The quiz auto-submits when the timer reaches zero.
‣ Stay in fullscreen mode throughout the quiz. Exiting fullscreen is detected and will result in auto-submission.
✦ Scientech Easy
Online Basic Python Test
30 Qs
The len() function returns the total number of elements in the list. The list has 7 elements: [10, 20, 30, 10, 40, 20, 10], so len(x) = 7.
Q 1
1 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
print(len(x))
7
10
5
20
Square brackets [ ] with comma-separated values define a list in Python. A list is an ordered, mutable (changeable) sequence that can store multiple values.
Q 2
2 / 30
0s
What is the data type of variable x after the following statement?
x = [7, 8, 9, 10]
List
Tuple
Dictionary
String
With x = 28: (1) x=75 -> False; (2) x=55 -> False; (3) x=35 -> False (28 is not =35). All conditions fail, so the else block runs printing ‘not false’.
Q 3
3 / 30
0s
What will be the output of the following code?
x = 28
if x = 75:
print('true')
elif x = 55:
print('not true')
elif x = 35:
print('false')
else:
print('not false')
false
not true
true
not false
del x[2:4] deletes elements at indices 2 and 3 (values 4 and 2). Slice [2:4] means from index 2 up to but not including index 4. Result: [8, 6, 0, 3, 1].
Q 4
4 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2, 0, 3, 1]
del x[2:4]
print(x)
[8, 4, 2, 0, 3, 1]
[8, 6, 0, 3, 1]
[8, 6, 4, 0, 3, 1]
[8, 6, 2, 0]
The %= operator computes x modulo y and stores the result in x. 25 % 6 = 1 because 25 = 4×6 + 1, so the remainder is 1.
Q 5
5 / 30
0s
What will be the output of the following code?
x = 25
y = 6
x %= y
print(x)
6
1
24
31
The sep parameter of print() controls what is inserted between multiple values. Using sep=’|’ inside the print() call replaces the default space separator with a pipe character.
Q 6
6 / 30
0s
Which of the following correctly sets the pipe ‘|’ as an alternative separator in print()?
separate = |
sep is |
sep = ‘|’
sep >> ‘|’
Python supports chained assignment. x = y = z = 50 assigns the value 50 to all three variables in a single statement, evaluated right-to-left.
Q 7
7 / 30
0s
Which statement correctly initializes three variables x, y, and z all with the value 50?
x & y & z = 50
x = z; y = z; x = 50
x = y: y = 50
x = y = z = 50
x[1] is ‘Wednesday’ and x[2] is ‘Friday’. The + operator on strings performs concatenation without any spaces, producing ‘WednesdayFriday’.
Q 8
8 / 30
0s
What will be the output of the following code?
x = ['Monday', 'Wednesday', 'Friday']
y = x[1] + x[2]
print(y)
MondayWednesday
Wednesday Friday
WednesdayFriday
Monday Friday
Python source files are always saved with the .py extension. This is the standard recognized by the Python interpreter when running scripts.
Q 9
9 / 30
0s
Which file extension is used to save Python source files?
.pyt
.pi
.pe
.py
The type() function returns the type of an object. For example, type(42) returns , and type(‘hello’) returns .
Q 10
10 / 30
0s
Which built-in function can be used to determine the data type of any variable in Python?
true()
data()
type()
str()
The in operator checks for membership in dictionary keys, not values. Since 2 is a key in x (keys are 0, 1, 2, 3), the expression evaluates to True.
Q 11
11 / 30
0s
What will be the output of the following code?
x = {0: 4, 1: 8, 2: 16, 3: 32}
y = 2 in x
print(y)
x[2]
[16]
True
False
Python evaluates conditions top to bottom and executes the first True branch. Since x = 55 satisfies x > 10 (the first condition), it prints 20 and skips all remaining branches.
Q 12
12 / 30
0s
What will be the output of the following code?
x = 55
if x > 10:
print(20)
elif x == 55:
print(10)
else:
print(30)
10
20
30
55
The items() method returns a view object containing all key-value pairs as tuples. Output is displayed as dict_items([…]) where each pair is a tuple (key, value).
Q 13
13 / 30
0s
What will be the output of the following code?
x = {1: 5, 2: 10, 3: 15, 4: 20}
print(x.items())
dict_items[1, 2, 3, 4]
dict_items([(1, 5), (2, 10), (3, 15), (4, 20)])
dict_items([5, 10, 15, 20])
dict_items(5, 10, 15, 20)
The += operator adds y to x and stores the result back in x. So x = 5 + 4 = 9. This is a compound assignment operator.
Q 14
14 / 30
0s
What will be the output of the following code?
x = 5
y = 4
x += y
print(x)
9
5
1
4
The count() method returns the number of times the specified value appears in the list. The value 10 appears at indices 0, 3, and 6, so the count is 3.
Q 15
15 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
print(x.count(10))
10
30
3
20
The input() function always returns the entered value as a string (str), regardless of what the user types. To use it as a number, you must explicitly convert it using int() or float().
Q 16
16 / 30
0s
What will be the data type of variable x after this statement, if the user enters the number 25?
x = input('Enter a number: ')
Integer
Float
String
List
del x[3] deletes the element at index 3, which is the second 10 (0->10, 1->20, 2->30, 3->10). The remaining list is [10, 20, 30, 40, 20, 10].
Q 17
17 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
del x[3]
print(x)
[20, 30, 40, 20]
[10, 10, 10]
[10, 20, 30, 40, 20, 10]
[10, 20, 30, 10, 40, 20, 10]
The str() function converts its argument to a string. Even though x holds an integer (48), str(x) converts it to the string ’48’, so y is of type str.
Q 18
18 / 30
0s
What will be the data type of variable y after the following statements?
x = 48
y = str(x)
Float
Integer
String
List
Any value enclosed in single quotes, double quotes, or triple quotes is a string (str) in Python. Strings are ordered, immutable sequences of characters.
Q 19
19 / 30
0s
What will be the data type of variable x after the following statement?
x = 'Python 3 Programming'
List
Dictionary
Tuple
String
IDLE (Integrated Development and Learning Environment) is the default IDE bundled with Python. It includes a shell window for interactive use and a code editor.
Q 20
20 / 30
0s
What is the name of the built-in interactive development environment that comes pre-installed with Python?
PGUI
PyShell
IDLE
PythonSh
The and operator returns True only if both operands are True. Since x = True and y = True, x and y evaluates to True.
Q 21
21 / 30
0s
What will be the output of the following code?
x = True
y = True
print(x and y)
xy
Not defined
True
False
A syntax error is detected during the parsing phase, before execution begins. The interpreter finds a violation of Python grammar rules and halts immediately, reporting the error with the line number.
Q 22
22 / 30
0s
For which error type does the interpreter halt and report the error without executing any part of the program?
Syntax Error
Semantic Error
Runtime Error
All types of errors
A set is an unordered collection that only stores unique elements. Duplicate values are automatically discarded. For example, {1, 2, 2, 3} becomes {1, 2, 3}.
Q 23
23 / 30
0s
Which Python data structure automatically stores only unique values, eliminating duplicates?
Set
Dictionary
Tuple
List
When Python sees x = 10 inside abc(), it treats x as a local variable throughout the entire function. So when print(x) runs before the assignment, x has not yet been assigned — causing an UnboundLocalError.
Q 24
24 / 30
0s
What will be the output of the following code?
def abc():
print(x)
x = 10
abc()
x = 20
20
NameError
10
UnboundLocalError
The insert(index, value) method inserts the value at the given index, shifting existing elements right. x.insert(2, 5) places 5 at index 2, giving [8, 6, 5, 4, 2].
Q 25
25 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2]
x.insert(2, 5)
print(x)
[2, 8, 6, 4, 5]
[5, 8, 6, 4, 2]
[8, 6, 5, 4, 2]
[8, 2, 4, 6, 5]
The single equals sign (=) is the assignment operator. == is used for comparison (equality check), and === does not exist in Python.
Q 26
26 / 30
0s
Which symbol is the assignment operator in Python used to assign a value to a variable?
===
==
>>>
=
The // operator is floor (integer) division. 12 // 4 = 3. Unlike regular division (/), it returns an integer result when both operands are integers.
Q 27
27 / 30
0s
What will be the output of the following code?
x = 12
y = 4
print(x // y)
3
48
48.0
3.0
x[0][1] accesses the first inner list at index 1 giving 2.0. x[1][0] accesses the second inner list at index 0 giving 5.0. So y = 2.0 + 5.0 = 7.0.
Q 28
28 / 30
0s
What will be the output of the following code?
x = [[1.0, 2.0, 3.0], [5.0, 6.0, 7.0]]
y = x[0][1] + x[1][0]
print(y)
7.0
8.0
2.0
5.0
Parentheses have the highest precedence. First 3 + 4 = 7, then 6 x 7 = 42. Python follows standard mathematical order of operations (BODMAS/PEMDAS).
Q 29
29 / 30
0s
What will be the output of the following code?
x = 6 * (3 + 4)
print(x)
21
22
42
18
When the + operator is used on two strings, it performs string concatenation, not arithmetic addition. ’35’ + ’27’ joins them to produce the string ‘3527’.
Q 30
30 / 30
0s
What will be the output of the following code?
x = '35' + '27'
print(x)
3527
57
62
35
Time Left
00 : 20 : 00
Question Palette
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Answered
Bookmarked
Not Visited
Finish Test?
You cannot change responses after submission.
⏱ Time's Up!
Your time is up. The quiz will be submitted.
⚠ Fullscreen Mode Exited
Quiz Complete!
Online Basic Python Test
Your Score
Correct
Wrong
Skipped
Total Q
Time Taken




