cs3005_2026T2_Q1_NA.pdf
Programming in C · Quiz 1 · May 2026
← Course papers · Start practice / exam
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
Question 2 MCQ · 2.0 marks
Which of the following best characterizes the C programming language?
High-level, object-oriented, interpreted
High-level, unstructured, compiled
Mid-level, structured, compiled
Low-level, procedural, interpreted
A published solution is not available for this question yet.
Question 3 MCQ · 2.0 marks
What is the decimal equivalent of the hexadecimal number **3D**?
51
63
61
77
A published solution is not available for this question yet.
Question 4 MCQ · 2.0 marks
What is the range of integer values that can be represented by an **8-bit signed integer** using
**two's complement convention**?
-127 to +127
-128 to +127
-255 to +255
0 to 255
A published solution is not available for this question yet.
Question 5 MCQ · 2.0 marks
What is the purpose of the Program Counter (PC) in a CPU?
It performs arithmetic and logic operations.
It holds the address of the next instruction to be executed.
It stores temporary data for quick access.
It coordinates the flow of data between the CPU and memory.
A published solution is not available for this question yet.
Question 6 MCQ · 4.0 marks
Consider the computations given below using the generalized memory model.
1. M[0] ← x
2. M[1] ← y
3. M[2] ← M[0] – M[1]
4. M[1] ← M[2] * M[1]
5. M[0] ← M[2] * M[0]
6. M[2] ← M[0] – M[1]
7. M[3] ← M[2]
What is the value of M[3] at the end of the execution?
(x - y) * (x - y - 1)
(x - y) * (2x - y)
(x - y) * (x - 2y)
(x - y) * (x - y)
A published solution is not available for this question yet.
Question 7 MCQ · 4.0 marks
What will be the output of the following code?
[[IMAGE:69c15897ca78adf5_4_2]]

011334
0134
012123234
0112334
A published solution is not available for this question yet.
Question 8 MCQ · 4.0 marks
What will be the output of the following code?
[[IMAGE:69c15897ca78adf5_5_3]]

1 2 3 4 5 6 7 8 9
1 2 7 8
1 2 3 7 8
1 2 3 7 8 9
A published solution is not available for this question yet.
Question 9 MCQ · 3.0 marks
Trace the computation of the following C program fragment:
[[IMAGE:69c15897ca78adf5_5_4]]
What are the final values of a, b, and c?

a = 1, b = 18, c = 24
a = 7, b = 15, c = 21
a = 10, b = 18, c = 24
a = 8, b = 15, c = 22
A published solution is not available for this question yet.
Question 10 MCQ · 3.0 marks
Consider the following C code.
[[IMAGE:69c15897ca78adf5_6_5]]
What will be the output?

5
12
9
10
A published solution is not available for this question yet.
Question 11 NAT · 3.0 marks
Consider the nested ternary expression:
[[IMAGE:69c15897ca78adf5_6_6]]
What is the value of b after execution?

A published solution is not available for this question yet.
Question 12 NAT · 3.0 marks
What will be the output of the following code?
[[IMAGE:69c15897ca78adf5_7_7]]

A published solution is not available for this question yet.
Question 13 NAT · 2.0 marks
What is the value of the integer variable **result** after executing the following C statement?
[[IMAGE:69c15897ca78adf5_8_8]]

A published solution is not available for this question yet.
Question 14 MSQ · 3.0 marks
Which of the following **CANNOT** be used as **valid** variable names in C?
total_marks
1st_score
_final_value
if
price$
A published solution is not available for this question yet.
Question 15 MSQ · 3.0 marks
Which of the following statements about C's logical operators '&&' (AND) and '||' (OR) are correct,
specifically regarding their short-circuit behavior?
The expression (A && B) always evaluates B if A is true.
The expression (A || B) always evaluates B if A is true.
If the first operand of '&&' is false, the second operand is not evaluated.
If the first operand of '||' is true, the second operand is not evaluated.
A published solution is not available for this question yet.
Question 16 MSQ · 2.0 marks
Consider the following C program:
[[IMAGE:69c15897ca78adf5_9_9]]
Which of the following statements about the output are true?

If the input is x = 5, y = 6, the output is R
If the input is x = -1, y = 15, the output is V
If the input is x = 0, y = 12, the output is U
If the input is x = 1, y = 7, the output is R
If the input is x = 0, y = 5, the output is U
A published solution is not available for this question yet.
Question 17 NAT · 4.0 marks
Consider the following generalized computation:
Step 1: R0 ← M[0]
Step 2: R1 ← M[1]
Step 3: R3 ← R0 MOD 2
Step 4: IF R3 = 0 THEN GOTO Step 7, Otherwise GOTO Step 5
Step 5: R2 = R0 + R1
Step 6: GOTO Step 8
Step 7: R2 = R0 * R1
Step 8: M[2] ← R2
If M[0] = 5 and M[1] = 3, what is the value of M[2] at the end of the computation?
A published solution is not available for this question yet.
Question 18 NAT · 4.0 marks
Consider the following assembly program (anything after ; is a comment).
[[IMAGE:69c15897ca78adf5_11_10]]
If initially n=6, what will be the final value stored in R2 at the end of the program?

A published solution is not available for this question yet.