Class XI C++ MCQ Questions
Class XI C++ MCQ Questions
Class XI C++ MCQ Questions
C++
MCQ Questions
1. What is the correct value to return to the operating system upon the successful
completion of a program?
A. -1
B. 1
C. 0
D. Programs do not return a value.
2. What is the only function all C++ programs must contain?
A. start()
B. system()
C. main()
D. program()
3. What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <C. BEGIN and END
D. ( and )
4. What punctuation ends most lines of C++ code?
A. .
B. ;
C. :
D. '
5. Which of the following is a correct comment?
A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }
6. Which of the following is not a correct variable type?
A. float
B. real
C. int
D. double
7. Which of the following is the correct operator to compare two variables?
A. :=
B. =
C. equal
D. ==
b) 22%5
11. Evaluate (i). (a+5>c-2) &&(a-5<c+5) (ii). b=++a + c++if a=10 and c=20
12. what will be the output of following statements:(i) cout<<a = =20;
#include <iostream.h>
#include <conio.h>
void main()
{ clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS *************** \n\n";
int a=10,b=20,c=30;
cout<<"a="<<a<<" b="<<b<<" c="<<c;
int z=(a++)*c/a+b;
cout <<"\nz=(a++ )*c/a+b = ";
getch();
cout<<z;
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
a=10,b=20,c=30;
cout<<"a="<<a<<" b="<<b<<" c="<<c;
z=++a*c/a+b;
cout <<"\nz=++a*c/a+b = "<<z;
getch();
cout<<z;
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
a=1,b=2,c=3;
cout<<"a="<<a<<" b="<<b<<" c="<<c;
z= b+ c^a * ++b ;
cout <<"\nz=b+c^a * ++b; = ";
cout <<"\nAnswer is :(3+3)^(1*3) \n";
cout <<"\n
:(6)^(3) \n";
cout <<"\nIn Binary :(110) XOR (011) \n";
cout <<"\n
:(101) \n";
cout <<"\nIn Decimal Answer is : \n";
getch();
cout<<z;
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
z=45;
int q=45;
cout<<"\nq="<<q;
cout<<"\n-q--="<<-q--;
cout<<"q= " <<q;
getch();
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
cout <<"\n\nz="<<z;
cout <<"\nz--:"<<z--;
cout <<"\n--z:"<<--z;
cout <<"\nz="<<z;
int qq=-- z - z++;
cout <<"\n--z-z++ = "<<qq;
cout <<"\nz="<<z;
cout <<"\n";
getch();
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
z=45;
cout <<"\nz="<<z;
cout <<"\nz++:"<<z++;
cout <<"\n++z:"<<++z;
cout <<"\n++z+z++ = "<<++z+z++;
getch();
clrscr();
cout <<"\n************* EVALUATION OF EXPRESSIONS ****************\n\n";
z=45;
cout <<"\nz="<<z;
cout <<"\n(++z)--:"<<(++z)--;
cout <<"\n++z:"<<++z;
getch();
}