Pages

Thursday, January 13, 2011

(MCQs) - Multiple Choice Questions - MCQs from C++ set - 4

Question 1

In an assignment statement
a=b;
Which of the following statement is true?
a.    The variable a and the variable b are equal.
b.    The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a
c.    The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a
d.    The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.

Question 2

All of the following are valid expressions in C++
a  =  2 + (b = 5);
a  = b = c = 5;
a  = 11 % 3
a.    True
b.    False


Question 3:

To increase the value of c by one which of the following statement is wrong?
a.    c++;
b.    c = c + 1;
c.    c + 1 => c;
d.    c += 1


Question 4:

When following piece of code is executed, what happens?
b = 3;
a = b++;
a.    a contains 3 and b contains 4
b.    a contains 4 and b contains 4
c.    a contains 4 and b contains 3
d.    a contains 3 and b contains 3


Question 5:

The result of a Relational operation is always
a.    either True or False
b.    is less than or is more than
c.    is equal or less or more
d.    All of these


Question 6:

Which of the following is not a valid relational operator?
a.    ==
b.    =>
c.    >=
d.    >=

Question 7:

What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
A. 10
B. 9
C. 0
D. 1


Question 8:

When does the code block following while(x<100) execute?
A. When x is less than one hundred
B. When x is greater than one hundred
C. When x is equal to one hundred
D. While it wishes


Question 9:

Which is not a loop structure?
A. for
B. do while
C. while
D. repeat until


Question 10:

How many times is a do while loop guaranteed to loop?
A. 0
B. Infinitely
C. 1
D. Variable




Answers



1.    b. The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a
2.    a. True
3.    c. c + 1 => c;
4.    a. a contains 3 and b contains 4
5.    a. either True or False
6.    b. =>
7.    A. 10
8.    A. When x is less than one hundred
9.    D. Repeat Until
10.    C. 1

6 comments:

  1. I thought I would just point out that for question 7 you have put the answer as 10 but

    What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?

    because in the for loop it says x<10 then x will only count up to 9 not 10

    ReplyDelete
  2. Thank you for the Use full post and the solved MCQs.
    MCQs about NAM which is known as Non Alignment Movement.

    ReplyDelete
  3. It’s very important to work on practice questions like these as it builds confidence for the exam. I’m also practicing sample questions for the LSAT exams that I’ll be taking this year. For better preparation, I have been taking classes at one of the Best LSAT Courses in the city.

    ReplyDelete
  4. Hi, I like your post really I have read first-time Thanks for sharing keep up the good work.

    Farmers can insure Kharif crops

    ReplyDelete
  5. wow... what a great blog, this writter who wrote this article it's realy a great blogger, this article so inspiring me to be a better person pedagogy mcqs online test

    ReplyDelete
  6. Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily Current affairs world MCQs

    ReplyDelete