✦ 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
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 1
1 / 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)
8.0
2.0
7.0
5.0
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 2
2 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
print(x.count(10))
20
10
30
3
sorted(x.items()) sorts the key-value tuple pairs by their first element (the key) in ascending order. Keys 7, 2, 5, 4 are sorted to 2, 4, 5, 7 with their corresponding values.
Q 3
3 / 30
0s
What will be the output of the following code?
x = {7: 3, 2: 9, 5: 6, 4: 1}
print(sorted(x.items()))
[(2, 9), (4, 1), (5, 6), (7, 3)]
[2, 4, 5, 7]
[(3, 7), (9, 2), (6, 5), (1, 4)]
[3, 9, 6, 1]
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 4
4 / 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, 2, 4, 6, 5]
[8, 6, 5, 4, 2]
The and operator returns True only if both operands are True. Since x = True and y = True, x and y evaluates to True.
Q 5
5 / 30
0s
What will be the output of the following code?
x = True
y = True
print(x and y)
Not defined
False
True
xy
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 6
6 / 30
0s
What will be the output of the following code?
x = 25
y = 6
x %= y
print(x)
1
31
6
24
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 7
7 / 30
0s
What will be the output of the following code?
x = '35' + '27'
print(x)
62
3527
57
35
The single equals sign (=) is the assignment operator. == is used for comparison (equality check), and === does not exist in Python.
Q 8
8 / 30
0s
Which symbol is the assignment operator in Python used to assign a value to a variable?
=
===
>>>
==
The extend() method appends all elements of the given iterable to the end of the list. Unlike append(), it does not add list y as a single nested element.
Q 9
9 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2]
y = [1, 3, 5]
x.extend(y)
print(x)
[8, 6, 4, 2]
[8, 6, 4, 2, 1, 3, 5]
[]
[1, 3, 5, 8, 6, 4, 2]
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 10
10 / 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, 6, 0, 3, 1]
[8, 6, 4, 0, 3, 1]
[8, 4, 2, 0, 3, 1]
[8, 6, 2, 0]
x[0] is 6 and x[1] is 0. str(6) = ‘6’ and str(0) = ‘0’. Concatenating these strings gives ’60’. Note: the result is a string, not the integer 60.
Q 11
11 / 30
0s
What will be the output of the following code?
x = [6, 0, 5]
y = str(x[0]) + str(x[1])
print(y)
60
0
6
5
Printing a list displays its full representation, including the square brackets and commas. Parentheses would indicate a tuple, not a list.
Q 12
12 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2]
print(x)
[8, 6, 4, 2]
8, 6, 4, 2
8642
(8, 6, 4, 2)
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 13
13 / 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)
30
55
20
10
A tuple is an ordered, immutable sequence. Once created, its elements cannot be added, removed, or changed. Lists, dictionaries, and sets are all mutable.
Q 14
14 / 30
0s
Which Python data type is immutable — its elements cannot be changed after creation?
Dictionary
Set
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 15
15 / 30
0s
What will be the output of the following code?
def abc():
print(x)
x = 10
abc()
x = 20
NameError
20
UnboundLocalError
10
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 16
16 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
del x[3]
print(x)
[10, 10, 10]
[20, 30, 40, 20]
[10, 20, 30, 10, 40, 20, 10]
[10, 20, 30, 40, 20, 10]
The in operator only checks dictionary keys, not values. The keys are 0, 1, 2, 3 — not 16. Even though 16 is a value in the dictionary, 16 in x returns False.
Q 17
17 / 30
0s
What will be the output of the following code?
x = {0: 4, 1: 8, 2: 16, 3: 32}
y = 16 in x
print(y)
[16]
False
True
x[2]
x[1] is ‘Wednesday’ and x[2] is ‘Friday’. The + operator on strings performs concatenation without any spaces, producing ‘WednesdayFriday’.
Q 18
18 / 30
0s
What will be the output of the following code?
x = ['Monday', 'Wednesday', 'Friday']
y = x[1] + x[2]
print(y)
Monday Friday
WednesdayFriday
MondayWednesday
Wednesday Friday
del x[:] deletes all elements using slice notation with no start or end indices. The variable x still exists but is now an empty list [].
Q 19
19 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2, 0, 3, 1]
del x[:]
print(x)
[0, 3, 1]
[]
[8, 6, 4, 2, 0]
[8, 6, 4, 2, 1]
The print() function has a default parameter end=’\n’, which means it appends a newline character at the end of each output, moving the cursor to the next line.
Q 20
20 / 30
0s
By default, what invisible character does print() automatically add at the end of every output line?
\s (space)
\r (carriage return)
\t (tab)
\n (newline)
The pop(index) method removes and returns the element at the given index. x.pop(2) removes the element at index 2, which is 4 (index 0->8, 1->6, 2->4, 3->2, 4->0).
Q 21
21 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2, 0]
print(x.pop(2))
6
0
2
4
Evaluation follows Python precedence: (1) 2**3 = 8; (2) 36/4 = 9.0 (true division); (3) 9.0 % 3 = 0.0 (exactly divisible by 3); (4) 0.0 * 8 = 0.0. Final answer: 0.0.
Q 22
22 / 30
0s
What will be the output of the following code?
a = 36 / 4 % 3 * 2 ** 3
print(a)
24
0.0
18.0
8.0
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 23
23 / 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: ')
String
List
Integer
Float
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 24
24 / 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)
False
x[2]
True
[16]
List indexing starts at 0. x[1] is 25 and x[2] is 35. Since both are integers, the + operator performs arithmetic addition: 25 + 35 = 60.
Q 25
25 / 30
0s
What will be the output of the following code?
x = [15, 25, 35]
y = x[1] + x[2]
print(y)
25
50
35
60
Curly braces { } with key:value pairs define a dictionary (dict) in Python. Dictionaries store data as key-value pairs and are insertion-ordered (Python 3.7+).
Q 26
26 / 30
0s
What will be the data type of variable x after the following statement?
x = {'subject': 'Python', 'level': 'Beginner'}
Dictionary
List
Tuple
Set
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 27
27 / 30
0s
What will be the output of the following code?
x = [10, 20, 30, 10, 40, 20, 10]
print(len(x))
5
10
20
7
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 28
28 / 30
0s
What will be the data type of variable y after the following statements?
x = 48
y = str(x)
Integer
Float
List
String
The append() method adds its argument to the end of the list. After x.append(0), the element 0 is added at the end, making the list [8, 6, 4, 2, 0].
Q 29
29 / 30
0s
What will be the output of the following code?
x = [8, 6, 4, 2]
x.append(0)
print(x)
[8, 6, 4, 2]
8, 6, 4, 2, 0
[8, 6, 4, 2, 0]
8642
Parentheses have the highest precedence. First 3 + 4 = 7, then 6 x 7 = 42. Python follows standard mathematical order of operations (BODMAS/PEMDAS).
Q 30
30 / 30
0s
What will be the output of the following code?
x = 6 * (3 + 4)
print(x)
18
42
21
22
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






