The pow() function returns:
What is the value of the following expression?
i = 1;
i = (i << 1) % 2
What will be the output?
#define x 10 * 10
#include <stdio.h>
int main()
{
int a = x + x;
printf("%d",a);
return 0;
}
What is the output of the following code?
void main()
{
int i=2, j=2;
while(i+1 ? --i : j++)
printf("%d", i);
}
Which access specifier makes all the data members and functions of the base class inaccessible to the derived class?
There are two types of polymorphism: compile-time polymorphism and runtime polymorphism. Runtime polymorphism can be achieved through:
Predict the output of the following program:
#include <stdio.h>
int fun(int n)
{
if (n == 4)
return n;
else return 2*fun(n+1);
}
int main()
{
printf("%d", fun(2));
return 0;
}
What is the output of this C code?
int x = 5;
void main()
{
int x = 3;
m();
printf("%d", x);
}
void m()
{
x = 8;
n();
}
void n()
{
printf("%d", x);
}
#include "stdio.h"
int * arrPtr[5];
int main()
{
if(*(arrPtr+2) == *(arrPtr+4))
{
printf("Equal!");
}
else
{
printf("Not Equal");
}
return 0;
}
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
int mycount = count (myints, myints + 8, 10);
cout << "10 appears " << mycount << " times.\n";
vector<int> myvector (myints, myints+8);
mycount = count (myvector.begin(), myvector.end(), 20);
cout << "20 appears " << mycount << " times.\n";
return 0;
}