strcpy(somekey.word, “const”); somekey.count += 1; cout<<somekey.word<< “\t” <<somekey.count<< “\n”; } Ans : #define 10 #const 11 #define 10 Q2. Find the output of the following program: #include <iostream.h> int modify(int temp = 2) { if(temp % 3 == 0) temp = temp + 1; else temp = temp + 3; return temp; } void doupdation(int m, int &n) { static int i; i++; m = n + i; if(n 10) n = modify(); else n = modify(n); cout<<m<<" ; "<<n<<endl; } void main() { int x = 8, y = 20; doupdation(x,y); cout<<x<<" ; "<<y<<endl; doupdation(y,x); cout<<x<<" ; "<<y<<endl; doupdation(y,x); cout<<x<<" ; "<<y<<endl; } Ans: 21 ; 5 8 ; 5 10 ; 11 11 ; 5 14 ; 5 5 ; 5 Q4. Give the output of the following program: #include<iostream.h> void main() { int a, *b, **c, ***d; a=12, b=&a, c=&b, d=&c; ***d*=5; a + *b; (**c) += cout<<”\n”<<a<<”,”<< 10;
strcpy(somekey.word, “const”); somekey.count += 1; cout<<somekey.word<< “\t” <<somekey.count<< “\n”; } Ans : #define 10 #const 11 #define 10 Q2. Find the output of the following program: #include <iostream.h> int modify(int temp = 2) { if(temp % 3 == 0) temp = temp + 1; else temp = temp + 3; return temp; } void doupdation(int m, int &n) { static int i; i++; m = n + i; if(n 10) n = modify(); else n = modify(n); cout<<m<<" ; "<<n<<endl; } void main() { int x = 8, y = 20; doupdation(x,y); cout<<x<<" ; "<<y<<endl; doupdation(y,x); cout<<x<<" ; "<<y<<endl; doupdation(y,x); cout<<x<<" ; "<<y<<endl; } Ans: 21 ; 5 8 ; 5 10 ; 11 11 ; 5 14 ; 5 5 ; 5 Q4. Give the output of the following program: #include<iostream.h> void main() { int a, *b, **c, ***d; a=12, b=&a, c=&b, d=&c; ***d*=5; cout<<”\n”<<a<<”,”<< a + *b; (**c) += 10;
1274748946compt_sci.docx