Skip to content
VUBuddy

CS201P Quiz 2 Set 2

Introduction to Programming (Practical) PDF 857 KBUpdated 23 Oct 2026
Quiz CS201P Quiz 2 Set 2 PDF 857 KB
vubuddy.com
Type
Quiz
Course
CS201P Introduction to Programming (Practical)
Size
PDF 857 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 857 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2 of 2. Download the file for all 2 pages.

Q1. What will be the output of the following code? int i = 0; while(i!=15){ cout << i << " "; i = i + 5; }

  1. 0 5
  2. 1 5 10
  3. 0 5 10
  4. 5 10

Correct answer: 0 5 10

Q2. Which of the following C++ statements is used to show output on the screen?

  1. cout
  2. cget
  3. cerr
  4. cin

Correct answer: cout

Q3. In C++, which of the following option has the correct meaning of the expression “a <= b” ?

  1. a is less than or equal to b
  2. a is less than b
  3. a is greater than or equal to b
  4. a is greater than b

Correct answer: a is less than or equal to b

Q4. What will be the output of following program? #include <iostream> using namespace std; int main() { int x = 5; while (x > 0) { x--; } cout << "Final value of x: " << x << endl; return 0; }

  1. Final value of x: 5
  2. Final value of x: 0
  3. Final value of x: 2
  4. Final value of x: 6

Correct answer: Final value of x: 0

Q5. In C/C++, the algebraic expression (b2-4ac) / 2a can be written as:

  1. (b*b – 4*a*c) / (2*a)
  2. b*b – 4*a* c/ 2*a
  3. b*b – (4*a*c) / 2*a
  4. b*b – 4* a*c / (2*a)

Correct answer: (b*b – 4*a*c) / (2*a)

Q6. What will be the output of the following code? int i = 1; while(i<10){ if (i % 2 == 0) cout << i << “ ”; i++; }

  1. 2 4 8 10
  2. 2 4 6 10
  3. 2 4 6 8
  4. 1 3 5 7

Correct answer: 2 4 6 8

Q7. Which of the following is an example of logical operator?

  1. &&,||
  2. <,>
  3. /,%
  4. +,*

Correct answer: &&,||

Q8. Which of the following option is used when working with complicated expressions in C++ ?

  1. []
  2. /
  3. ()
  4. {}

Correct answer: ()

Q9. Which of the following is an example of repetition structure?

  1. cond
  2. while
  3. if-else
  4. if

Correct answer: while

Q10. Which of the following C++ statements is used take input from the user?

  1. cget
  2. cerr
  3. cin
  4. cout

Correct answer: cin

All CS201P files →
CS201P Introduction to Programming (Practical) All CS201P handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.