cs3005_2023T3_Q1_NA.pdf
Programming in C · Quiz 1 · Sep 2023
← Course papers · Start practice / exam
This page contains the reliably extracted subset, not the complete original paper.
Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
Question 128 MSQ · 2.0 marks
Which of the following is/are **false** statement(s) regarding C programming language?
It is an imperative programming language.
It is not a structured programming language.
It is a dynamically typed programming language.
The language uses curly braces ({ }) to define the scope of a for loop.
A published solution is not available for this question yet.
Question 129 MSQ · 2.0 marks
Which of the following statement(s) is/are **true** regarding ASCII and Unicode?
Unicode is a character set.
ASCII uses 6 bits to encode a given character.
UTF-16 and UTF-32 are both variable length encoding techniques.
UTF-8 is a fixed length encoding technique.
A published solution is not available for this question yet.
Question 130 MSQ · 2.0 marks
Which of the following is/are **valid** identifiers in C language?
123var
_myVar
my-var
Var_123
myVar!
A published solution is not available for this question yet.
Question 131 MCQ · 2.0 marks
In split memory architecture, what is the purpose of cache memory?
To store the operating system
To provide the permanent storage
To temporarily store frequently used data for fast access
To control the input/output devices
A published solution is not available for this question yet.
Question 132 MCQ · 2.0 marks
What is the primary function of the Program Counter in a CPU?
Execute arithmetic operations
Keep track of the currently executing instruction
To control the input/output devices
Manage memory access
A published solution is not available for this question yet.
Question 133 MCQ · 2.0 marks
Suppose you have a document which contains 58 unique characters. What is the minimum
number of bits required to encode a single character in this document?
2\(^{6}\)
6
2\(^{7}\)
7
A published solution is not available for this question yet.
Question 134 MCQ · 2.0 marks
Consider the following equation:
[[IMAGE:f4a68391db3da5df_5_1]]
If all the variables are float, which of the following is a correct way to write the given equation in C
language?

[[IMAGE:f4a68391db3da5df_5_2]]

[[IMAGE:f4a68391db3da5df_5_3]]

[[IMAGE:f4a68391db3da5df_6_4]]

[[IMAGE:f4a68391db3da5df_6_5]]

A published solution is not available for this question yet.
Question 135 MCQ · 4.0 marks
Consider the following steps to compute the **minimum** among three numbers. Load the three
numbers from memory locations M[0], M[1] and M[2] and store the maximum number in M[3].
[[IMAGE:f4a68391db3da5df_6_6]]
Identify the appropriate instructions to fill the blank at step 4 and step 6.

Step 4: If R[0] < R[1] then go to step 5, otherwise go to step 6
Step 6: If R[1] < R[2] then go to step 7, otherwise go to step 8
Step 4: If R[0] > R[1] then go to step 5, otherwise go to step 6
Step 6: If R[1] < R[2] then go to step 7, otherwise go to step 8
Step 4: If R[0] < R[1] then go to step 5, otherwise go to step 6
Step 6: If R[1] > R[2] then go to step 7, otherwise go to step 8
Step 4: If R[0] > R[1] then go to step 5, otherwise go to step 6
Step 6: If R[1] > R[2] then go to step 7, otherwise go to step 8
A published solution is not available for this question yet.
Question 136 MCQ · 4.0 marks
Consider the below C program.
[[IMAGE:f4a68391db3da5df_7_7]]
The above C program is used to calculate the sum of individual digits of a number. For ex: If the
value given to the variable “n” is 25, the sum of individual digits will be 7.
Fill in the placeholders “Expression1” and “Expression2” to ensure that the program functions
correctly.

Expression1: r = n % 10;
Expression2: n = r;
Expression1: r = n / 10;
Expression2: n = n % 10;
Expression1: r = n % 10;
Expression2: n = n / 10;
Expression1: n = n % 10;
Expression2: r = n;
A published solution is not available for this question yet.
Question 137 MCQ · 3.0 marks
Compute the 9-bit binary representation of the decimal number 468.
011101010
111010100
011101001
111010010
A published solution is not available for this question yet.
Question 138 MCQ · 3.0 marks
Find the 8-bit binary representation of (− 50)10 using 2’s complement notation.
(11001111)2
(11000111)2
(11000110)2
(11001110)2
A published solution is not available for this question yet.
Question 139 MCQ · 3.0 marks
(764)10 = (________)8
Identify the appropriate option to fill in the above blank.
1271
1364
1374
1274
A published solution is not available for this question yet.
Question 140 MCQ · 3.0 marks
Given two integer variables, x and y, which of the following expressions ensures that both x and y
are distinct positive integers if the expression returns 1?
[[IMAGE:f4a68391db3da5df_10_8]]

[[IMAGE:f4a68391db3da5df_10_9]]

[[IMAGE:f4a68391db3da5df_10_10]]

[[IMAGE:f4a68391db3da5df_10_11]]

A published solution is not available for this question yet.
Question 141 MCQ · 3.0 marks
Consider the following code snippet.
[[IMAGE:f4a68391db3da5df_10_12]]
What will be the value of x, y and z after executing the given code snippet?

x = 2, y = 4, z = 1
x = 2, y = 4, z = 0
x = 2, y = 3, z = 1
x = 2, y = 3, z = 0
A published solution is not available for this question yet.
Question 142 MCQ · 3.0 marks
Consider the below C program.
[[IMAGE:f4a68391db3da5df_11_13]]
What will be the output of above given code?

Equal
Not Equal
Compilation error
Runtime error
A published solution is not available for this question yet.
Question 143 MCQ · 3.0 marks
Consider the below C program.
[[IMAGE:f4a68391db3da5df_12_14]]
What would be the output of the given code?

8
3
0
4
A published solution is not available for this question yet.
Question 144 NAT · 3.0 marks
Consider the following assembly program (assume anything after “;” is a comment).
[[IMAGE:f4a68391db3da5df_13_15]]
What will be the final value stored in register R2?
Note: The answer input must be an integer. For Ex: If the answer is 32, you must enter 32 only.

A published solution is not available for this question yet.
Question 145 NAT · 4.0 marks
Consider the below C program.
[[IMAGE:f4a68391db3da5df_14_16]]
What would be the output of the given code?
Note: The answer input must be an integer. For Ex: If the answer is 32, you must enter 32 only.

A published solution is not available for this question yet.