by Farhan Karim Shaikh on
MCQs almost past some new which can be solved with basic programming knowledge.
1. #include <iostream> 5marks
using namespace std;
int main() {
int a[6]={2,1,3,15,20,50};
int i=++a[1];
int j=a[1]++;
int k=a[i++];
int l=a[--i]*i;
int m=a[++i]-1;
couti" "j" "k" "l" "m" ";
return 0;
}
2. Bitwise operators to mention
using namespace std;
int main() {
int a[6]={2,1,3,15,20,50};
int i=++a[1];
int j=a[1]++;
int k=a[i++];
int l=a[--i]*i;
int m=a[++i]-1;
couti" "j" "k" "l" "m" ";
return 0;
}
2. Bitwise operators to mention
3.
int A[5] = {1 , 2, 3, 4};
int i;
for (i=0; i<5; i++)
{
A[i] = 2*A[i];
cout A[i] " ";
}
4.
What will be the output of the following; (5 marks)
void main()
{
union Num
{
int ValueI;
float ValueF;
double ValueD;
char ValueC;
};
Num TestVal = {100};
cout"Integer =" TestVal.ValueIendl;
TestVal.ValueF = 2.123;
cout "Float=" TestVal.ValueFendl;
cout"Uninitialzed double =" TestVal.ValueD endl;
cout"Some rubbish???"endl;
TestVal.ValueC = 'U';
cout"character=" TestVal.ValueCendl;
}
5.
#include <iostream.h>
main ()
{
int y[10] = {10,20,30,40,50,60,70,80,90,100};
int *yptr, i;
yptr = y;
cout*(yptr+1*2)endl;
}
Comments
Post a Comment
Please give us your feedback & help us to improve this site.