IT 140 Introduction to Scripting Midterm Exam Practice
Questions and Detailed Solutions Latest Update 2026/2027 |
Variables, Loops, Data Types, Verified Answers - 179 Questions
This midterm exam assesses foundational scripting concepts including variables, data types, control flow, loops,
functions, and debugging. It emphasizes practical problem-solving and code comprehension, requiring students to
apply concepts to novel scenarios and reason about output and behavior. It contains 179 multiple-choice
questions, each with four distractors and a fully worked rationale that explains why the keyed answer is correct.
Questions are organized into clearly labelled sections that mirror the major content areas of the course. Targeted
learning outcomes include: Demonstrate understanding of Python data types, type conversion, and operator
precedence.; Analyze and predict the behavior of loops, conditionals, and functions in Python.; Apply scripting
concepts to solve problems and identify errors in given code snippets.. Every item has been reviewed for clinical
accuracy, current guidelines, and clarity so that students can study with confidence and self-correct as they work
through the bank. Use it as a high-yield review immediately before the exam, or as a structured practice tool
during the unit - the rationales double as concise teaching notes. The recommended writing time is 2 hours, with a
passing score of 70%. Aligned with Aligned with ACM/IEEE CS2013 curriculum guidelines for introductory
programming courses. standards and reflects the question style commonly seen on accredited program
examinations. Students consistently achieving above the cut score on this bank have historically gone on to earn
A+ on the corresponding course exam. Read every stem carefully - distractors are written to look plausible, and
Section 1: General (Questions 1-179)
1 Consider the following Python code snippet: x = 7; y = 2; print(x //
y, x % y, x / y). What is the exact output?
A) 3 1 3.5
B) 3 1 3
C) 3.5 1 3.5
D) 3 0 3.5
Answer: A
Rationale: In Python, // is floor division (7 // 2 = 3), % is modulus (7
% 2 = 1), and / is true division ( = 3.5). Option B incorrectly uses
integer division for /, Option C uses float for //, and Option D has an
incorrect modulus.
2 Given the code: for i in range(3, 0, -1): print(i, end=' '), what is the
output?
A) 3 2 1
B) 1 2 3
C) 3 2 1 0
,
,
,
Questions and Detailed Solutions Latest Update 2026/2027 |
Variables, Loops, Data Types, Verified Answers - 179 Questions
This midterm exam assesses foundational scripting concepts including variables, data types, control flow, loops,
functions, and debugging. It emphasizes practical problem-solving and code comprehension, requiring students to
apply concepts to novel scenarios and reason about output and behavior. It contains 179 multiple-choice
questions, each with four distractors and a fully worked rationale that explains why the keyed answer is correct.
Questions are organized into clearly labelled sections that mirror the major content areas of the course. Targeted
learning outcomes include: Demonstrate understanding of Python data types, type conversion, and operator
precedence.; Analyze and predict the behavior of loops, conditionals, and functions in Python.; Apply scripting
concepts to solve problems and identify errors in given code snippets.. Every item has been reviewed for clinical
accuracy, current guidelines, and clarity so that students can study with confidence and self-correct as they work
through the bank. Use it as a high-yield review immediately before the exam, or as a structured practice tool
during the unit - the rationales double as concise teaching notes. The recommended writing time is 2 hours, with a
passing score of 70%. Aligned with Aligned with ACM/IEEE CS2013 curriculum guidelines for introductory
programming courses. standards and reflects the question style commonly seen on accredited program
examinations. Students consistently achieving above the cut score on this bank have historically gone on to earn
A+ on the corresponding course exam. Read every stem carefully - distractors are written to look plausible, and
Section 1: General (Questions 1-179)
1 Consider the following Python code snippet: x = 7; y = 2; print(x //
y, x % y, x / y). What is the exact output?
A) 3 1 3.5
B) 3 1 3
C) 3.5 1 3.5
D) 3 0 3.5
Answer: A
Rationale: In Python, // is floor division (7 // 2 = 3), % is modulus (7
% 2 = 1), and / is true division ( = 3.5). Option B incorrectly uses
integer division for /, Option C uses float for //, and Option D has an
incorrect modulus.
2 Given the code: for i in range(3, 0, -1): print(i, end=' '), what is the
output?
A) 3 2 1
B) 1 2 3
C) 3 2 1 0
,
,
,