CompuScholar Unity Programming
Certification Exam — Complete Practice
Question Bank (2026/2027) .
Q1: Which of the following is a valid declaration of a floating-point variable in C#?
A. float speed = 5;
B. float speed = 5.5;
C. float speed = 5.5f; [CORRECT]
D. int speed = 5.5f;
Correct Answer: C
Rationale: C# requires the 'f' suffix for float literals; without it, 5.5 is treated as a double and
will not compile when assigned to a float. Option B fails to compile, option A stores a whole
number in a float (valid but not floating-point literal usage), and option D mismatches types.
Q2: What is the output of this code?
csharp
int score = 17;
int result = score % 5;
Debug.Log(result);
A. 3
B. 2 [CORRECT]
C. 4
D. 0
Correct Answer: B
, 2
Rationale: The modulus operator (%) returns the remainder of integer division. 17 divided by
5 is 3 with a remainder of 2, so the output is 2. A common mistake is reporting the quotient
instead of the remainder.
Q3: Which C# data type is used to store a true/false value, such as whether a player is
grounded?
A. string
B. int
C. bool [CORRECT]
D. float
Correct Answer: C
Rationale: The bool type stores true or false and is commonly used for game flags like
isGrounded or isAlive. Strings store text, ints store whole numbers, and floats store decimals.
Q4: A game stores a player's name as "Ranger" in a variable. Which data type is the name
stored as?
A. char
B. string [CORRECT]
C. bool
D. int
Correct Answer: B
Rationale: Text enclosed in double quotes, including names, is stored as a string. A char holds
a single character in single quotes, while bool and int store logical and numeric values
respectively.
Q5: What is the output of this code?
csharp
int health = 10;
health = health + 5;
, 3
health *= 2;
Debug.Log(health);
A. 15
B. 20
C. 30 [CORRECT]
D. 25
Correct Answer: C
Rationale: health becomes 15 after the addition, then health *= 2 doubles it to 30. Option A
stops after the first operation, and B incorrectly doubles before adding.
Q6: Which operator correctly tests whether two values are equal in a C# condition?
A. =
B. == [CORRECT]
C. != [CORRECT]
D. ===
Correct Answer: B
Rationale: The comparison operator == tests equality, while a single = is the assignment
operator. != tests inequality, and === does not exist in C#. Mixing up = and == is one of the
most common C# errors.
Q7: A player's score starts at 0 and increases by 10 each time an enemy is destroyed. Which
loop structure is best suited to run exactly 5 times to award 5 defeated enemies?
A. while
B. do-while
C. for [CORRECT]
D. if-else
Correct Answer: C
, 4
Rationale: A for loop is designed to repeat a specific number of times, making it ideal for
exactly 5 iterations. While and do-while loops are better for unknown or condition-based
repetition.
Q8: What is the output of this code?
csharp
int x = 7;
if (x > 5 && x < 10)
{
Debug.Log("Valid");
}
else
{
Debug.Log("Invalid");
}
A. Invalid
B. Valid [CORRECT]
C. Nothing prints; this code has an error
D. True
Correct Answer: B
Rationale: The logical AND (&&) requires both conditions to be true. Since 7 is greater than 5
and less than 10, "Valid" is printed. The conditions are properly formed and compile fine.
Q9: Which of the following loop types guarantees its code block executes at least once, even if
the condition is false initially?
A. for
B. while