Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q371: How is the NOT operation expressed in C/C++?
- A: !a
- B: ~a
- C: ^a
- D: &~a
View Answer
B
Q372: Which of the following is not a valid compound assignment operator in C/C++?
- A: +=
- B: -=
- C: *=
- D: /=
View Answer
D
Q373: In C/C++, which operator is unary?
- A: &
- B: ^
- C: `
- D: ~
View Answer
B
Q374: What is the default parameter passing mechanism in C?
- A: Call by reference
- B: Call by value
- C: Call by address
- D: Call by pointer
View Answer
B
Q375: Which of the following is a valid syntax for a while loop in C/C++?
- A: while (condition) { // do something }
- B: do { // do something } while (condition)
- C: for (initialization; condition; increment) { // do something }
- D: if (condition) { // do something }
View Answer
A
Q376: What is the role of the break statement in a switch-case structure?
- A: It terminates the switch statement execution
- B: It continues with the next case
- C: It jumps to the start of the switch statement
- D: It skips the current case only
View Answer
A
Q377: How does a do-while loop differ from a while loop?
- A: It executes the loop body before checking the condition
- B: It checks the condition before executing the loop body
- C: It only supports single line code blocks
- D: It does not support braces
View Answer
A
Q378: Which operator is used to find the remainder of a division in C/C++?
- A: +
- B: -
- C: %
- D: /
View Answer
C
Q379: What is the purpose of the continue statement inside a loop?
- A: To terminate the loop execution
- B: To skip the rest of the loop iteration
- C: To exit the current function
- D: To exit the loop and move to the next case
View Answer
B
Q380: How are array elements accessed in C/C++?
- A: Using 1-based indexing
- B: Using 0-based indexing
- C: Using negative indexing
- D: Using decimal indexing
View Answer
B