Important Questions & Viva
Multiple choice questions
Which part of the CPU performs comparisons?
(a) Control Unit (b) ALU (c) Register (d) Cache
Show answer
(b) ALU – Arithmetic Logic Unit
1 KB is equal to
(a) 1000 bytes (b) 1024 bits (c) 1024 bytes (d) 8 bits
Show answer
(c) 1024 bytes
Which memory is volatile?
(a) ROM (b) SSD (c) RAM (d) Hard disk
Show answer
(c) RAM
(1011)₂ in decimal is
(a) 9 (b) 10 (c) 11 (d) 13
Show answer
(c) 11
Which gate is called a universal gate?
(a) AND (b) OR (c) XOR (d) NAND
Show answer
(d) NAND
ASCII code of "A" is
(a) 65 (b) 97 (c) 48 (d) 32
Show answer
(a) 65
Which of these is a valid identifier?
(a) 2total (b) total-marks (c) _total (d) for
Show answer
(c) _total
Output of print(17 // 5, 17 % 5)
(a) 3 2 (b) 3.4 2 (c) 2 3 (d) 3 3
Show answer
(a) 3 2
input() always returns a value of type
(a) int (b) float (c) str (d) bool
Show answer
(c) str
Which data type is immutable?
(a) list (b) dict (c) set (d) tuple
Show answer
(d) tuple
Output of "PYTHON"[1:4]
(a) PYT (b) YTH (c) YTHO (d) PYTH
Show answer
(b) YTH
Which method adds an item at the end of a list?
(a) add() (b) insert() (c) append() (d) extend()
Show answer
(c) append()
range(2, 10, 3) gives
(a) 2 5 8 (b) 2 5 8 11 (c) 3 6 9 (d) 2 4 6 8
Show answer
(a) 2 5 8
Which keyword exits a loop immediately?
(a) continue (b) pass (c) break (d) exit
Show answer
(c) break
Which licence is used for free software with copyleft?
(a) GPL (b) Proprietary (c) Freeware (d) Shareware
Show answer
(a) GPL
Fake SMS asking to "update KYC" is an example of
(a) Hacking (b) Phishing (c) Worm (d) Adware
Show answer
(b) Phishing
Find the output
Write the output yourself first, then open the answer.
Q1
x = 10 y = x * 2 + 3 ** 2 // 4 print(x, y)
Show answer
10 22
Q2
s = 'Examination'
print(s[2:7], s[-4:], s[::4], s.count('a'))Show answer
amina tion Eii 2
Q3
L = [4, 8, 15, 16, 23] L.insert(2, 10) L.pop() L.remove(8) print(L, len(L))
Show answer
[4, 10, 15, 16] 4
Q4
for i in range(1, 10, 3):
if i == 7:
break
print(i, end='#')
else:
print('done')
print('end')Show answer
1#4#end
Q5
d = {'a': 1, 'b': 2}
d['c'] = d['a'] + d['b']
d['a'] = 10
print(d, sum(d.values()))Show answer
{'a': 10, 'b': 2, 'c': 3} 15Q6
def f(n, m=2):
return n ** m
print(f(3), f(2, 3), f(m=1, n=9))Show answer
9 8 9
Q7
t = (1, 2, 3) a, b, c = t t2 = t + (a * 4,) print(t2, t2.index(4))
Show answer
(1, 2, 3, 4) 3
Q8
n = 0
while n < 10:
n += 3
if n == 6:
continue
print(n, end=' ')
print()Show answer
3 9 12
Short answer questions
Differentiate between compiler and interpreter.
Show answer
A compiler translates the whole program into machine code at once and reports all errors together; the program runs faster later (C, C++). An interpreter translates and executes line by line, stopping at the first error (Python).
What are the functions of an operating system?
Show answer
Process management, memory management, file management, device management, security (login, permissions) and providing a user interface.
Convert (235)₁₀ into binary, octal and hexadecimal.
Show answer
Binary 11101011, octal 353, hexadecimal EB.
Prove De Morgan’s first law using a truth table.
Show answer
Make columns A, B, A·B, (A·B)', A', B', A'+B'. For all four rows (00, 01, 10, 11) the columns (A·B)' = 1,1,1,0 and A'+B' = 1,1,1,0 are identical, so (A·B)' = A' + B'.
What is the difference between mutable and immutable types? Give examples.
Show answer
Mutable objects can be changed in place (list, dict, set). Immutable objects cannot be changed; any change creates a new object (int, float, str, tuple).
Differentiate between append() and extend().
Show answer
append(x) adds x as a single element at the end (even if x is a list). extend(seq) adds each element of seq separately.
What is the difference between local and global variables?
Show answer
A local variable is defined inside a function and exists only there. A global variable is defined outside all functions and is accessible throughout the program; to modify it inside a function use the global keyword.
What is a digital footprint? How can it be managed?
Show answer
It is the trail of data left online — active (posts, comments) and passive (cookies, location). Manage it by thinking before posting, using privacy settings, limiting app permissions and deleting unused accounts.
Viva questions
| Question | Answer |
|---|---|
| Who developed Python? | Guido van Rossum (1991). |
| What is the extension of a Python file? | .py |
| What does IDLE stand for? | Integrated Development and Learning Environment. |
| What is the difference between = and ==? | = assigns a value; == compares two values. |
| What does len() do? | Returns the number of items in a sequence or collection. |
| What is a docstring? | A string in triple quotes written as the first line of a function to describe it. |
| Can a dictionary key be a list? | No, keys must be immutable. |
| What is an infinite loop? | A loop whose condition never becomes False. |
| What is indentation in Python? | Spaces at the start of lines that define a block of code. |
| What is the use of pass? | A do-nothing placeholder for an empty block. |
| What does the % operator give? | The remainder of a division. |
| Name two mutable and two immutable data types. | Mutable: list, dict. Immutable: tuple, str. |
Exam tips
- 1For output questions, make a small trace table of variables and update it line by line.
- 2In conversions, show every division/multiplication step — steps carry marks.
- 3Draw neat truth tables with 2ⁿ rows in binary order 00, 01, 10, 11.
- 4Write programs with meaningful variable names and comments; indentation must be consistent.
- 5For theory, give a definition + one example from daily life.
