Viva Questions

INT108 60 Questions
Unit 1 Python Versions
1
What is the primary difference between Python 2 and Python 3 mentioned in the syllabus regarding backward compatibility?
Unit 1 Environment Setup
2
Why is it critical to check 'Add Python to PATH' during installation on Windows?
Unit 1 Variables
3
Explain the concept of Dynamic Typing in Python.
Unit 1 Variable Naming
4
List three rules for naming variables in Python.
Unit 1 Operators
5
What is the difference between the / operator and the // operator?
Unit 1 String Operations
6
How does the * operator function when applied to a string?
Unit 1 Errors
7
What causes a NameError in Python?
Unit 1 Order of Operations
8
Explain the PEMDAS rule in Python expression evaluation.
Unit 1 Composition
9
What is 'Composition' in the context of Python statements?
Unit 1 Comments
10
How do you denote a single-line comment versus a multi-line comment in Python?
Unit 2 The Modulus Operator
11
What are two common use cases for the Modulus operator (%)?
Unit 2 Random Numbers
12
What does random.random() return compared to random.randint(a, b)?
Unit 2 Logic Operators
13
Explain 'Short-circuit evaluation' in Python logical operators.
Unit 2 Boolean Expressions
14
What is the difference between = and ==?
Unit 2 Conditional Statements
15
When would you use elif instead of a nested else: if structure?
Unit 2 While Loops
16
Why is a while loop called 'indefinite iteration'?
Unit 2 Loop Control
17
Differentiate between break and continue.
Unit 2 For Loops
18
What sequence does range(2, 10, 2) generate?
Unit 2 Encapsulation
19
How does Encapsulation improve code quality in the context of loops?
Unit 2 Generalization
20
What is Generalization in programming functions?
Unit 3 Function Types
21
What is the difference between a Fruitful function and a Void function?
Unit 3 Type Conversion
22
Explain the difference between Type Coercion and Type Casting.
Unit 3 Math Functions
23
What does math.ceil(4.2) return and why?
Unit 3 Variable Scope
24
What is the scope of a 'Local Variable'?
Unit 3 Parameters vs Arguments
25
Technically, how do Parameters differ from Arguments?
Unit 3 Argument Types
26
How do Keyword Arguments differ from Positional Arguments?
Unit 3 Arbitrary Arguments
27
When would you use *args in a function definition?
Unit 3 Recursion
28
What are the two mandatory parts of a recursive function to avoid infinite loops?
Unit 3 Recursion Memory
29
What is a limitation of using recursion regarding memory?
Unit 3 Flow of Execution
30
Describe the flow of execution when a function is called.
Unit 4 String Immutability
31
What does it mean that strings are 'immutable' in Python?
Unit 4 Slicing
32
In the slice s[start:stop], is the stop index inclusive or exclusive?
Unit 4 Lists vs Tuples
33
What is the primary difference between a List and a Tuple?
Unit 4 List Deletion
34
How does pop() differ from remove() in lists?
Unit 4 Tuple Assignment
35
How can you swap values of two variables a and b using tuple assignment?
Unit 4 Dictionary Basics
36
What are the requirements for keys in a Python dictionary?
Unit 4 Dictionary Methods
37
Why would you use the get() method instead of bracket notation dict[key]?
Unit 4 Sparse Matrices
38
How can dictionaries be used to represent sparse matrices efficiently?
Unit 4 Aliasing
39
What is Aliasing in the context of lists?
Unit 4 Copying
40
What is the difference between a Shallow Copy and a Deep Copy?
Unit 5 OOP Concepts
41
Define 'Class' and 'Object'.
Unit 5 Constructors
42
What is the purpose of the __init__ method?
Unit 5 The self Parameter
43
What does self represent in a Python class method?
Unit 5 Inheritance
44
What is Class Inheritance?
Unit 5 Method Overriding
45
What is Method Overriding?
Unit 5 Super Function
46
What is the use of the super() function in inheritance?
Unit 5 Encapsulation
47
How do you denote a 'Private' attribute in Python, and what does it do?
Unit 5 Name Mangling
48
Can private attributes be accessed at all? If so, how?
Unit 5 Function Overloading
49
Does Python support traditional function overloading? How is it handled?
Unit 5 Attributes
50
What is the difference between Class Attributes and Instance Attributes?
Unit 6 File Modes
51
What is the difference between 'w' and 'a' modes in file handling?
Unit 6 Context Managers
52
Why is it best practice to use the with statement when opening files?
Unit 6 Reading Files
53
What is the difference between read() and readlines()?
Unit 6 Writing Files
54
Can you pass an integer directly to the file.write() method?
Unit 6 Serialization
55
What is 'Pickling' in Python?
Unit 6 Exception Handling
56
What is the purpose of the try...except block?
Unit 6 The Else Block
57
When does the else block execute in a try...except...else structure?
Unit 6 Regular Expressions
58
What do the metacharacters . and ^ represent in Regex?
Unit 6 Regex Functions
59
How does re.match() differ from re.findall()?
Unit 6 Regex Special Sequences
60
What do \d and \w match in a Regular Expression?