SCIENCE / PROGRAMMING 2026/2027 | 105
Questions with Correct Answers Graded A+ |
100% Verified | Evidence-Based Rationales
Instructions
This examination consists of 105 multiple-choice questions covering foundational
computer science and programming competencies across six domains:
Programming Basics, Syntax, and Data Types (25 questions); Control Structures –
Conditionals and Loops (20 questions); Functions, Scope, and Data Structures (20
questions); Object-Oriented Programming and .NET/CLR Concepts (15
questions); Algorithm Design, Debugging, and Software Development Lifecycle
(15 questions); and Advanced Topics & Code Tracing (10 questions). The
recommended time limit is 120–150 minutes. This is an introductory CS course
assessment with emphasis on code tracing, output prediction, and conceptual
understanding. Correct answers are displayed in bold with evidence-based
rationales aligned to standard CS curricula.
Select the single best answer for each question. Each question is worth one point.
A score of 70% (74/105) or higher indicates satisfactory understanding of
introductory computer science and programming concepts.
Section I: Programming Basics, Syntax, and Data Types (Questions 1–25)
Question 1
Which of the following is a valid variable name in most programming languages
(C#, Java, Python)?
A. 2ndPlace
B. my-variable
C. studentName
D. class
,Rationale: Variable names must begin with a letter or underscore, not a digit.
Hyphens are not allowed in identifiers (they are interpreted as the minus
operator). 'class' is a reserved keyword in Java and C#. 'studentName' follows
camelCase convention and is valid.
Question 2
What is the result of the expression in C# when both operands are integers
(int)?
A. 3.4
B. 3
C. 4
D. 2
*Rationale: In C# (and Java, C, C++), integer division truncates toward zero.
= 3 (the fractional part 0.4 is discarded). To get 3.4, at least one operand must be a
floating-point type.*
Question 3
Which data type is most appropriate for storing a person's age (a whole number, 0-
120)?
A. double
B. string
C. float
D. int
Rationale: Age is typically a whole number without decimal places. int stores
integers efficiently and is the standard choice for age. double and float are for
fractional numbers; string is for text.
Question 4
What does the assignment operator = do in most programming languages?
A. Compares two values for equality
B. Stores the value on the right into the variable on the left
,C. Checks if the left operand is greater than the right
D. Performs logical AND
Rationale: The single equals sign is the assignment operator. It copies the value
from the right-hand side into the memory location represented by the left-hand
variable.
Question 5
Which of the following is NOT a primitive data type in Java?
A. int
B. boolean
C. char
D. String
Rationale: String is a reference type (class) in Java, not a primitive. Primitives
include byte, short, int, long, float, double, char, boolean.
Question 6
What is the value of result after executing int result = 10 % 3; in C#?
A. 3
B. 1
C. 0
D. 3.333
Rationale: The modulus operator % returns the remainder of integer division. 10
divided by 3 is 3 with remainder 1.
Question 7
Which of the following correctly declares a constant in C#?
A. const int MAX = 100;
B. constant int MAX = 100;
C. readonly int MAX = 100;
D. int const MAX = 100;
Correct Answer: A. const int MAX = 100;
, Rationale: In C#, the const keyword is used to declare compile-time constants,
with the type followed by the constant name and initializer.
Question 8
What is the output of the following Python code snippet?
python
x=5
y=2
print(x // y)
A. 2.5
B. 2.0
C. 2
D. 3
*Rationale: In Python, // is floor division, which returns the integer part of the
quotient (floor toward negative infinity). 5 // 2 = 2.*
Question 9
Which of the following is a valid comment in Java?
A. <!-- comment -->
B. // comment
C. comment
D. # comment
Rationale: Java supports single-line comments with // and multi-line comments
with /* ... */. <!-- --> is HTML, # is Python/R, backticks are not comment syntax.
Question 10
What is the size of a double data type in C# (in bytes)?
A. 4
B. 8