2- What is the output of the following code?
char arr[3][3]={ {'A','H','B'}, {'T','K','N'}, {'D','I','G'} };
for (int k=1; k<=2; k++)
for(int g=1;g<=2;g++)
cout<<arr[g][k];
3- What is the output of the following code?
void startMe(int x){
static int a=2;
a*=x;
cout<<x<<" "<<a<<endl;
}
void main(){
for(int i=2;i<4;++i)
startMe(i);
}
4- What is the output of the following code?
int num[6]={5,11,14,10,18,9}, x;
for (x=0; x<3; ++x){
cout<<num[3-x-1]<<"\t"<< num[3+x];
cout<<endl;
}
5- What is the output of the following code?
void modifyMe(int w, int& r)
{
w+=3;
r-=3;
cout<<w<<"\t"<<r<<endl;
}
void main()
{
int a=12, b=6;
cout<<a<<"\t"<<b<<endl;
modifyMe(a, b);
cout<<a<<"\t"<<b<<endl;
}
6- What is the output of the following code?
int h=10;
void fun(){
int m=3;
++h;
cout<<m<<"\t"<<h<<endl;
--m;
}
void main()
{
int m=8;
cout<<m<<"\t"<<h<<endl;
int h=14;
fun();
cout<<m<<"\t"<<h<<endl;
}