A STUDY GUIDE FOR D335 - INTRODUCTION TO
PYTHON - (100) QUESTIONS WITH RADICLE
RATIONALES
IT & Cybersecurity
Exam coverage:
I. Section 1 (Q1-25): Python Basics — syntax, print(), input(),
comments, variables, data types (int, float, str, bool),
operators (+, -, *, /, //, %, **) .
II. Section 2 (Q26-50): Control Flow & Functions — if/elif/else,
for/while loops, range(), def functions, comparison operators,
logical operators (and, or, not) .
III. Section 3 (Q51-75): Data Structures — lists (append, pop,
indexing), tuples, dictionaries (keys, values), sets,
list/tuple/dict operations .
IV. Section 4 (Q76-100): Advanced Topics — string methods
(split, join, upper, lower, find, strip), file I/O (open, read,
write), exceptions (try-except), type conversion, Boolean
evaluation.
1. In Python, which function is used to display output to the
console?
A) console.log()
B) printf()
C) System.out.println()
D) print() ✓ (CORRECT)
, Page 2 of 41
E) echo()
**RATIONALE:** The built-in print() function is the standard way
to display output in Python. The other options are syntax from
JavaScript (console.log), C (printf), Java (System.out.println),
and PHP (echo), respectively .
2. What is the correct syntax for a single-line comment in
Python?
A) // This is a comment
B) /* This is a comment /
C) # This is a comment ✓ (CORRECT)
D) <!-- This is a comment -->
E) ' This is a comment
**RATIONALE:** In Python, the hash symbol (#) denotes a
single-line comment. Everything after # on that line is ignored by
the interpreter. // is used in C++, Java, and JavaScript, while / */
is used for multi-line comments in those languages .
3. Which of the following is NOT a valid variable name in
Python?
A) my_variable
B) _private
C) 2nd_place
D) myVariable ✓ (CORRECT)
E) variable2
**RATIONALE:** Variable names in Python cannot start with a
, Page 3 of 41
digit. "2nd_place" starts with a number, making it invalid.
Variable names can start with a letter or underscore, followed
by letters, numbers, or underscores .
4. What is the data type of the value returned by the input()
function?
A) Integer
B) Float
C) String ✓ (CORRECT)
D) Boolean
E) List
**RATIONALE:** The input() function always returns a string. If
numeric operations are needed, explicit conversion using int()
or float() is required .
5. What is the output of print(type(3.14))?
A) <class 'int'>
B) <class 'float'> ✓ (CORRECT)
C) <class 'str'>
D) <class 'bool'>
E) <class 'complex'>
**RATIONALE:** The type() function returns the data type of the
argument. 3.14 contains a decimal point, making it a float
(floating-point number) in Python .
, Page 4 of 41
6. What is the output of print() in Python 3?
A) 3
B) 3.0
C) 3.3333333333333335 ✓ (CORRECT)
D) 3.33
E) 4
**RATIONALE:** In Python 3, the / operator always returns a
float, performing true division. The result of 10 divided by 3 is
approximately 3.3333333333333335 due to floating-point
representation .
7. What is the output of print(10 // 3)?
A) 3 ✓ (CORRECT)
B) 3.0
C) 3.3333333333333335
D) 4
E) 1
**RATIONALE:** The // operator performs floor division,
returning the integer quotient rounded down. 10 divided by 3
equals 3 with a remainder of 1, so floor division returns 3 .
8. What is the output of print(10 % 3)?
A) 1 ✓ (CORRECT)
B) 2
C) 3
D) 0