Objective Assessment Questions and Answers| Latest
Update| Guaranteed Pass
QUESTION 1
A program consists of which three basic instruction types?
A) Read, Write, Execute
B) Input, Process, Output
C) Compile, Link, Run
D) Define, Call, Return
ANSWER: B) Input, Process, Output
EXPLANATION: Every program follows the IPO model: it takes input (from
keyboard, file, etc.), processes that data (computations, logic), and
produces output (to screen, file, etc.).
QUESTION 2
What is a variable in Python?
A) A fixed value that cannot change
B) A named reference to a value stored in memory
C) A type of loop structure
D) A function that prints output
ANSWER: B) A named reference to a value stored in memory
,EXPLANATION: A variable is a named item used to hold a value. It acts as a
reference or label that points to an object in memory. Variables can be
reassigned to different values.
QUESTION 3
What is an algorithm?
A) A type of Python data structure
B) A sequence of instructions that solves a problem
C) A built-in Python function
D) An error in program execution
ANSWER: B) A sequence of instructions that solves a problem
EXPLANATION: An algorithm is a step-by-step sequence of instructions
designed to solve a specific problem or accomplish a task.
QUESTION 4
What does the print() function do in Python?
A) Reads input from the user
B) Displays output to the screen and starts a new line
C) Opens a file for reading
D) Converts a value to a string
ANSWER: B) Displays output to the screen and starts a new line
EXPLANATION: The print() function outputs text or variable values to the
console. By default, it adds a newline character at the end.
,QUESTION 5
How do you denote a comment in Python?
A) // comment
B) /* comment */
C) # comment or """multi-line comment"""
D) <!-- comment -->
ANSWER: C) # comment or """multi-line comment"""
EXPLANATION: Single-line comments begin with #. Multi-line comments can
be enclosed in triple quotes (""" or '''). Comments are ignored by the
interpreter.
QUESTION 6
What is the purpose of the input() function?
A) To display output to the screen
B) To get text input from the user
C) To convert data types
D) To open a file
ANSWER: B) To get text input from the user
EXPLANATION: The input() function reads a line of text from the user and
returns it as a string. It can optionally display a prompt string.
QUESTION 7
, What does the type() function return?
A) The size of a variable in memory
B) The data type of a variable or value
C) The value of a variable
D) The memory address of a variable
ANSWER: B) The data type of a variable or value
EXPLANATION: The built-in type() function returns the type of an object,
such as <class 'int'>, <class 'str'>, etc.
QUESTION 8
What is a syntax error?
A) A violation of the programming language's rules for symbols and structure
B) An error that occurs during program execution
C) A logical flaw that produces wrong output
D) An error caused by incorrect indentation
ANSWER: A) A violation of the programming language's rules for symbols
and structure
EXPLANATION: Syntax errors occur when code violates the grammatical
rules of the programming language.
QUESTION 9
What data type is produced by the expression: 3 + 4.0?