All Free Computer Science and IT MCQs with Answers
Every Computer Science and IT question in the bank, across all chapters, each with the correct answer and a written explanation. Free and unlimited, with no account needed.
2,221 questions · page 69 of 112
- A. x = 4, y = 8
- B. x = 3, y = 6
- C. x = 4, y = 6
- D. Compiler error
Explanation: This is a classic example of the post-increment behavior.2 * x++ uses the current value of x (which is 3) in the multiplication and then…
Correct answer: x = 4, y = 6- A. i = 1
- B. i = 2
- C. The output is undefined
- D. Compiler error
Explanation: The code attempts to modify i multiple times between sequence points, leading to undefined behavior.
Correct answer: The output is undefined- A. a = 4, b = 1, result = 8
- B. a = 4, b = 1, result = 10
- C. a = 5, b = 2, result = 10
- D. The output is undefined
Explanation: --a decrements a to 4 first.b-- uses the current value of b (2) in the multiplication and then decrements b to 1
Correct answer: a = 4, b = 1, result = 10- A. x = 13, y = 33
- B. x = 13, y = 36
- C. x = 10, y = 30
- D. Undefined behavior
Explanation: The order of evaluating the post-increment operators and their side effects is not strictly defined.
Correct answer: Undefined behavior- A. 5 5 6
- B. 6 5 6
- C. 5 6 6
- D. Undefined behavior
Explanation: While there's a post-increment, the order of evaluation within the printf statement is well-defined from left to right:1.
Correct answer: 5 5 6- A. a = 11, b = 4, result = 3
- B. a = 10, b = 4, result = 2
- C. a = 11, b = 4, result = 2
- D. Undefined behavior
Explanation: • --b: Pre-decrement, so b becomes 4.• a++: Post-increment, so 10 is used in the division, and then a becomes 11.• 10 / 4 = 2
Correct answer: a = 11, b = 4, result = 2- A. x = 3, y = 13
- B. x = 5, y = 17
- C. x = 4, y = 14
- D. x = 4, y = 17
Explanation: 2 * x++: Uses the current value of x (2), then increments x to 3 -> Result: 43 * ++x: Increments x to 4, then uses the new value (4) ->…
Correct answer: x = 4, y = 17- A. USHRT_MAX + 1
- B. USHRT_MAX + 2
- C. 0
- D. 1
Explanation: • USHRT_MAX represents the maximum value an unsigned short int can hold.• Adding to an unsigned integer at its maximum value causes a…
Correct answer: 0- A. 128
- B. -128
- C. 0
- D. A compiler warning or error
Explanation: The char type is usually signed, with a range of -128 to 127.Assigning 128 to a signed char causes an overflow, wrapping around to the…
Correct answer: -128- A. x = 1, y = 3, z = 0
- B. x = 1, y = 3, z = 1
- C. x = 2, y = 3, z = 1
- D. x = 2, y = 4, z = 0
Explanation: • x-- decrements x to 1, but returns the original value (2), which is non-zero (true).• --y decrements y to 3.
Correct answer: x = 1, y = 3, z = 1- A. a = 9, b = -6, x = 15
- B. a = 10, b = -5, x = 15
- C. a = 9, b = -6, x = 14
- D. a = 9, b = -5, x = 14
Explanation: • --a: Decrements a to 9.• b--: Uses the current value of b (-5) in the subtraction and then decrements b to -6.• 9 - (-5) = 14
Correct answer: a = 9, b = -6, x = 14- A. 10 9 8 7 6 5 4 3 2 1 0
- B. 10 9 8 7 6 3 2 1 0
- C. 10 9 8 7 6 4 3 2 1 0
- D. 10 9 8 7 6 5 3 2 1 0
Explanation: 1. The loop runs while x is non-zero.2. When x becomes 5, x-= 2 changes it to 3.
Correct answer: 10 9 8 7 6 3 2 1 0- A. x = 10, y = -50
- B. x = 9, y = -50
- C. x = 10, y = -45
- D. x = 9, y = -45
Explanation: The post-decrement in x-- means the original value of x (10) is used in the multiplication, and then x is decremented to 9
Correct answer: x = 9, y = -50- A. Procedure
- B. Identifier
- C. Operator
- D. Macros
Explanation: Macro is a piece of code that is replaced with another piece of code before the program is compiled or run.
Correct answer: Identifier- A. 3
- B. 2
- C. 4
- D. 5
Explanation: The correct option is (c), 4.There are two main types of identifiers in programming languages:Internal identifiers: These are identifiers…
Correct answer: 4- A. User defined identifier
- B. Function identifier
- C. Standard identifier
- D. Polymorphism
Explanation: These are special words that have predefined meanings in the C language. They cannot be used as user-defined identifiers.
Correct answer: Standard identifier- A. User defined identifier
- B. Standard identifier
- C. Programmer identifier
- D. Both (a) and (b)
Explanation: User defined identifier refers to a name created by the programmer to identify specific elements within their program.
Correct answer: Standard identifier- A. Programmer identifier
- B. Standard identifiers
- C. User defined identifier
- D. All of these
Explanation: In programming, programmers define identifiers (names) to store data. These identifiers are not pre-defined by the programming language…
Correct answer: User defined identifier- A. Comments
- B. Identifier
- C. Variable
- D. Data type
Explanation: A data type defines a set of values and the operations that can be performed on those values.
Correct answer: Data type- A. long
- B. Preengeering.pk
- C. do
- D. 9.2
Explanation: The correct option is (d), 9.2. A floating-point number is a number that can represent a wide range of values, including numbers with…
Correct answer: 9.2