Q#1: What is the purpose of the semicolon (;) in C programming?
(A) Signify the beginning of a statement
(B) Indicate the end of a statement
(C) Separate variables in a declaration
(D) Represent a mathematical operation
Answer: (B) Indicate the end of a statement
Q#2: How can the declarations “int x, y, z;” be written on separate statements in C?
(A) int x, y, z;
(B) int x; int y; int z;
(C) int x y z;
(D) int x, int y, int z;
Answer: (B) int x; int y; int z;
Q#3: What does the statement “z = x + y;” do in C programming?
(A) Assigns the value of x to z
(B) Adds the values of x and y and assigns the result to z
(C) Multiplies the values of x and y and assigns the result to z
(D) Compares the values of x and y and assigns the result to z
Answer: (B) Adds the values of x and y and assigns the result to z
Q#4: In C++, how is the value of a variable displayed using cout?
(A) cout << value;
(B) cout << variable_name;
(C) cout << “value”;
(D) cout << variable_name;
Answer: (B) cout << variable_name;
Q#5: What is the purpose of the “short” data type in C?
(A) To store large whole numbers
(B) To store real numbers
(C) To store small whole numbers
(D) To store characters
Answer: (C) To store small whole numbers
Q#6: How many bytes does the “short” data type occupy in memory?
(A) 1 byte
(B) 2 bytes
(C) 4 bytes
(D) 8 bytes
Answer: (B) 2 bytes
Q#7: When dealing with very large whole numbers in C, which data type is recommended?
(A) int
(B) short
(C) long
(D) double
Answer: (C) long
Q#8: Which data type is used to store real numbers with decimal points in C?
(A) float
(B) double
(C) real
(D) decimal
Answer: (A) float
Q#9: What does the modulus operator (%) do in C arithmetic operations?
(A) Adds two numbers
(B) Multiplies two numbers
(C) Returns the remainder after division
(D) Divides two numbers and returns the quotient
Answer: (C) Returns the remainder after division
Q#10: In C, which arithmetic operators have the highest precedence?
(A) + and –
(B) * and /
(C) %
(D) ()
Answer: (D) ()
Q#11: How is the result of 10 + 10 * 5 evaluated in C?
(A) 60
(B) 100
(C) 50
(D) 25
Answer: (A) 60
Q#12: What is the purpose of using parentheses in C arithmetic expressions?
(A) They are used for multiplication
(B) They force the evaluation order
(C) They indicate the end of a statement
(D) They are used for addition
Answer: (B) They force the evaluation order
Q#13: Why is float data type recommended for correct results in division?
(A) It uses less memory
(B) It can store larger values
(C) It avoids truncating the result in integer division
(D) It is faster in computation
Answer: (C) It avoids truncating the result in integer division