Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q41: Which data type would you use to store a small whole number?
- A: long
- B: float
- C: short
- D: double
View Answer
C
Q42: Which of the following data types is used to store characters in C?
- A: int
- B: char
- C: float
- D: double
View Answer
B
Q43: The arithmetic operator '%' in C is used to ___________.
- A: add two numbers
- B: subtract one number from another
- C: divide two numbers
- D: find the remainder after division
View Answer
D
Q44: Which operator has the highest precedence in C?
- A: +
- B: -
- C: *
- D: /
View Answer
C
Q45: In C, the statement 'x = x + 1;' means ________.
- A: Add 1 to the value of x and store the result in x
- B: Add 1 to the value of x and store the result in a new variable
- C: Add x and 1 and store the result in 1
- D: None of the above
View Answer
A
Q46: In C, the expression '5 / 2' gives the result ________.
- A: 2.5
- B: 2
- C: 5
- D: None of the above
View Answer
B
Q47: Which of the following statements is correct about short data type?
- A: It occupies 4 bytes in memory
- B: It is used to store large numbers
- C: It occupies 2 bytes in memory
- D: It is used to store characters
View Answer
C
Q48: To store a large real number, which data type is used?
- A: int
- B: char
- C: double
- D: short
View Answer
C
Q49: The statement 'cout << x;' in C will ___________.
- A: display the value of x
- B: display the character 'x'
- C: display 'cout << x;' on the screen
- D: give an error
View Answer
A
Q50: The statement 'int x, y, z;' is an example of ________ in C.
- A: declaration
- B: assignment
- C: input
- D: output
View Answer
A