Select an option to see the answer and solution.
Variables and Data Types in C++
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
123
Questions
4/7
Page
Pick an option on a question to see the right answer and solution.
#include <iostream>
using namespace std;
int main()
{
int x = -1;
unsigned int y = 2;
if(x > y)
{
cout << "x is greater";
}
else
{
cout << "y is greater";
}
}Select an option to see the answer and solution.
#include <iostream>
using namespace std;
void addprint()
{
static int s = 1;
s++;
cout << s;
}
int main()
{
addprint();
addprint();
addprint();
return 0;
}Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
int p;
bool a = true;
bool b = false;
int x = 10;
int y = 5;
p = ((x | y) + (a + b));
cout << p;
return 0;
}Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int f(int p, int q)
{
if (p > q)
return p;
else
return q;
}
main()
{
int a = 5, b = 10;
int k;
bool x = true;
bool y = f(a, b);
k =((a * b) + (x + y));
cout << k;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <stdio.h>
int main()
{
char a = '\012';
printf("%d", a);
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
i. extern int func;
ii. extern int func2(int,int);
iii. int func2(int,int);
iv. extern class foo;
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
int i = 3;
int l = i / -2;
int k = i % -2;
cout << l << k;
return 0;
}Select an option to see the answer and solution.
void a;Select an option to see the answer and solution.
int x = 1;
x = x << 7;
x = x >> 7;Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
int num = 0x20 + 020 + 20;
cout << sizeof(num)<<'\n';
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int main()
{
int a = 8;
cout << "ANDing integer 'a' with 'true' :" << (a && true);
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.