Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

https://www.tutorialspoint.com/cplusplus/cpp_operators.

htm

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

43. What would be the output from the following C++ code segment?
x=11;
while(x>7){
  cout<<x<<"\t";
  x--;
}

2. Given the following code, what is the final value of i?

int i,j;
for(i = 0;i < 5;i ++)
{
for(j = 0;j < 3;j ++ )
{
if(i == 2)
break;
}
}

3. Given the following code, what is the final value of i?

int i;
for(i = 0; i <= 5;i ++ )
{
cout << i << endl;
}

4. What is the output of the following code fragment?


int x = 0;
while( x < 7)
{
x ++;
}
cout << x << endl;

5. 5+9*3^2-4 > 10 AND (2+2^4-8/4 > 6 OR (2<6 AND 10>11))

6. How many times the current loop will execute? for (int i = 0; i <= 5; i += 3);

7. Assume if A = 60; and B = 13; Find A||B

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

9. Please evaluate !(1 && !(0 || 1)).

10. How many times the current loop will execute? for (int i = 0; i <= 5; i += 3);

You might also like