0% found this document useful (0 votes)
24 views13 pages

CS201 Midterm MCQs 50

Uploaded by

daniyal112235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

CS201 Midterm MCQs 50

Uploaded by

daniyal112235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

CS201 Midterm Preparation - 50 Important MCQs

Q1: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q2: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q3: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q4: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these
Answer: A

Q5: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q6: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q7: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q8: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C
Q9: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q10: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q11: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q12: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q13: Which of the following loops is guaranteed to execute at least once?


A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q14: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q15: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q16: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q17: What is the size of an int data type in most modern compilers?

A) 2 bytes
B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q18: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q19: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q20: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q21: Which of the following is not a valid data type in C++?

A) int

B) float
C) string

D) integer

Answer: D

Q22: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q23: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q24: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q25: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>
D) <fstream>

Answer: A

Q26: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q27: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q28: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q29: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these
Answer: A

Q30: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q31: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q32: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q33: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C
Q34: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q35: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q36: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q37: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q38: Which of the following loops is guaranteed to execute at least once?


A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q39: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q40: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q41: Which of the following is not a valid data type in C++?

A) int

B) float

C) string

D) integer

Answer: D

Q42: What is the size of an int data type in most modern compilers?

A) 2 bytes
B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q43: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q44: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q45: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>

D) <fstream>

Answer: A

Q46: Which of the following is not a valid data type in C++?

A) int

B) float
C) string

D) integer

Answer: D

Q47: What is the size of an int data type in most modern compilers?

A) 2 bytes

B) 4 bytes

C) 8 bytes

D) Compiler dependent

Answer: B

Q48: Which of the following loops is guaranteed to execute at least once?

A) for loop

B) while loop

C) do-while loop

D) None of these

Answer: C

Q49: What is the correct syntax to declare a function in C++?

A) return_type function_name();

B) return_type (function_name);

C) function_name return_type();

D) None of these

Answer: A

Q50: Which of the following header files is required to use input/output streams?

A) <iostream>

B) <inputoutput>

C) <stream>
D) <fstream>

Answer: A

You might also like