Operators C++ MCQ

Errorlogger
0
1. Which operator is having right to left associativity in the following?
a) Array subscripting
b) Function call
c) Addition and subtraction
d) Type cast




2. Which operator is having the highest precedence?
a) postfix
b) unary
c) shift
d) equality




3. What is this operator called ?: ?
a) conditional
b) relational
c) casting operator
d) none of the mentioned




4. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         int a;
  6.         a = 5 + 3 * 5;
  7.         cout << a;
  8.         return 0;
  9.     }
a) 35
b) 20
c) 25
d) 30




5. What is the use of dynamic_cast operator?
a) it converts virtual base class to derived class
b) it converts virtual base object to derived objeccts
c) it will convert the operator based on precedence
d) None of the mentioned




6. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         int a = 5, b = 6, c, d;
  6.         c = a, b;
  7.         d = (a, b);
  8.         cout << c << 't' << d;
  9.         return 0;
  10.     }
a) 5 6
b) 6 5
c) 6 7
d) none of the mentioned




7. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         int i, j;
  6.         j = 10;
  7.         i = (j++, j + 100, 999 + j);
  8.         cout << i;
  9.         return 0;
  10.     }
a) 1000
b) 11
c) 1010
d) 1001




8. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main ()
  4.     {
  5.         int x, y;
  6.         x = 5;
  7.         y = ++x * ++x;
  8.         cout << x << y;
  9.         x = 5;
  10.         y = x++ * ++x;
  11.         cout << x << y;
  12.         return 0;
  13.     }
a) 749736
b) 736749
c) 367497
d) none of the mentioned




9. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         int a = 5, b = 6, c;
  6.         c = (a > b) ? a : b;
  7.         cout << c;
  8.         return 0;
  9.     }
a) 6
b) 5
c) 4
d) 7




10. What is the output of this program?
  1.     #include <iostream>
  2.     using namespace std;
  3.     main()
  4.     {
  5.         double a = 21.09399;
  6.         float b = 10.20;
  7.         int c ,d;
  8.         c = (int) a;
  9.         d = (int) b;
  10.         cout << c <<'t'<< d;
  11.         return 0;
  12.     }
a) 20 10
b) 10 21
c) 21 10
d) none of the mentioned



Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(30)

Our website uses cookies to enhance your experience. Check Now
Accept !