Question 1
What does variable scope determine?
-
Where the variable can be accessed
-
Which data type the variable stores
-
Which value the variable currently holds
-
How much memory the variable reserves
Question 2
What is defensive design mainly used for?
-
Handling invalid input and unexpected use
-
Reducing execution time for valid input
-
Choosing meaningful names for identifiers
-
Translating source code into machine code
Question 3
In Python, what does int(4.9) return?
-
4
-
5
-
4.9
-
Error
Question 4
Which data structure follows First In, First Out (FIFO)?
-
Queue
-
Stack
-
Array
-
Dictionary
Question 5
Which data structure follows Last In, First Out (LIFO)?
-
Stack
-
Queue
-
Tuple
-
Hash table
Question 6
In Python file handling, what does mode 'a' do?
-
Opens a file for appending
-
Opens a file for reading
-
Opens a file for writing and overwrites existing content
-
Creates a read-only temporary copy
Question 7
Which three control structures are fundamental in structured programming?
-
Sequence, selection and iteration
-
Input, output and storage
-
Sort, search and merge
-
Syntax, semantics and style
Question 8
How does a function differ from a procedure?
-
A function returns a value to its caller
-
A procedure returns a value to its caller
-
A function runs without being called
-
A procedure receives parameters from its caller
Question 9
In Python, what does list_name.pop() do with no index given?
-
Removes and returns the last item in the list
-
Returns the first item without removing it
-
Sorts the list in descending order
-
Clears all items from the list
Question 10
Why should identifier names be meaningful?
-
To make each variable's purpose clear
-
To show the indentation level
-
To validate input values
-
To convert runtime errors into syntax errors
Question 11
Which data type stores whole numbers?
-
Integer
-
Real
-
Boolean
-
Character
Question 12
Which data type stores true/false?
-
Boolean
-
Integer
-
String
-
Character
Question 13
Which operator gives the remainder?
-
MOD
-
DIV
-
/
-
*
Question 14
Which Boolean operator is true only when both conditions are true?
-
AND
-
OR
-
NOT
-
XOR
Question 15
Which Boolean operator is true when at least one condition is true?
-
OR
-
AND
-
NOT
-
DIV
Question 16
What is the result of applying NOT to TRUE?
-
FALSE
-
TRUE
-
1
-
NULL
Question 17
What is a one-dimensional array used for?
-
Store multiple values under one identifier
-
Store one value under one identifier
-
Store multiple values under two indices
-
Store multiple values in a permanent file
Question 18
What is a record used for?
-
Store related fields about one item
-
Store same-type items under indices
-
Process items in first-in-first-out order
-
Process items in last-in-first-out order
Question 19
What does a range check do in validation?
-
It checks that data is within set limits
-
It checks that data has the correct type
-
It checks that required data is not blank
-
It checks that data has the correct length
Question 20
What is a syntax error?
-
Code that breaks language rules
-
Code that runs but gives a wrong result
-
Code that stops because an operation fails
-
Input that falls outside validation rules
Question 21
What does type casting do?
-
Converts a value to another data type
-
Encrypts a value for storage
-
Sorts values into order
-
Deletes invalid values automatically
Question 22
What does string concatenation do?
-
Joins strings together
-
Splits a string into characters
-
Converts text to binary
-
Counts the length of a string
Question 23
What is validation?
-
Checking that input data is sensible
-
Checking entered data against the original source
-
Correcting invalid data automatically
-
Testing whether an algorithm is efficient
Question 24
What is verification?
-
Checking entered data against its source
-
Checking input against permitted limits
-
Checking code against language rules
-
Checking output against an expected result
Question 25
What is a logic error?
-
Code runs but produces an incorrect result
-
Code that cannot be parsed
-
An error that stops a program while it runs
-
Data outside a permitted input range
Question 26
Why use a local variable?
-
It is available only within its subroutine
-
It can be used throughout the whole program
-
It keeps its value after the program closes
-
It cannot be assigned a new value
Question 27
What is a two-dimensional array used for?
-
Store values under row and column indices
-
Store values under one index
-
Store one value under one identifier
-
Store related fields about one item
Question 28
What is boundary test data chosen to check?
-
Values at the edges of allowed ranges
-
Typical values well inside allowed ranges
-
Values copied from the original source
-
Values stored in a different data type
Question 29
What is iteration?
-
Repeating a set of instructions
-
Selecting a path using a condition
-
Executing instructions in a fixed order
-
Calling a named subroutine
Question 30
What is normal test data?
-
Data that should be accepted by a program
-
Data just outside an allowed boundary
-
A missing required value
-
Data chosen to test a boundary