c language programming

41
C language

Upload: anshy-singh

Post on 20-Oct-2015

64 views

Category:

Documents


6 download

DESCRIPTION

hhhhh

TRANSCRIPT

C language

What will be output when you will execute following c code?

#include<stdio.h>void main(){     int check=2;     switch(check){        case 1: printf("D.W.Steyn");        case 2: printf(" M.G.Johnson");        case 3: printf(" Mohammad Asif");        default: printf(" M.Muralidaran");     } }

Choose all that apply:

•M.G.Johnson • M.Muralidaran•M.G.Johnson Mohammad Asif M.Muralidaran(D) Compilation error (E) None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){     int check=2;     switch(check){        case 1: printf("D.W.Steyn");        case 2: printf(" M.G.Johnson");        case 3: printf(" Mohammad Asif");        default: printf(" M.Muralidaran");     } }

Choose all that apply:

•M.G.Johnson • M.Muralidaran•M.G.Johnson Mohammad Asif M.Muralidaran(D) Compilation error (E) None of the above

What will be output when you will execute following c code?#include<stdio.h>void main(){     int movie=1;     switch(movie<<2+movie){        default:printf("3 Idiots");        case 4: printf(" Ghajini");        case 5: printf(" Krrish");        case 8: printf(" Race");     }  }

Choose all that apply:

•3 Idiots Ghajini Krrish Race •Race •Krrish •Ghajini Krrish Race • Compilation error

What will be output when you will execute following c code?#include<stdio.h>void main(){     int movie=1;     switch(movie<<2+movie){        default:printf("3 Idiots");        case 4: printf(" Ghajini");        case 5: printf(" Krrish");        case 8: printf(" Race");     }  }

Choose all that apply:

•3 Idiots Ghajini Krrish Race •Race •Krrish •Ghajini Krrish Race • Compilation error

What will be output when you will execute following c code?#include<stdio.h>void main(){     int const X=0;     switch(5/4/3){        case X:  printf("Clinton");                  break;        case X+1:printf("Gandhi");                  break;        case X+2:printf("Gates");                  break;        default: printf("Brown");     }  }

Choose all that apply:

•Clinton •Gandhi •Gates •Brown •Compilation error

What will be output when you will execute following c code?#include<stdio.h>void main(){     int const X=0;     switch(5/4/3){        case X:  printf("Clinton");                  break;        case X+1:printf("Gandhi");                  break;        case X+2:printf("Gates");                  break;        default: printf("Brown");     }  }

Choose all that apply:

•Clinton •Gandhi •Gates •Brown •Compilation error

What will be output when you will execute following c code?

#include<stdio.h>void main(){     switch(5/2*6+3.0){        case 3:printf("David Beckham");             break;        case 15:printf("Ronaldinho");             break;        case 0:printf("Lionel Messi");             break;        default:printf("Ronaldo");     }   }Choose all that apply:

•David Beckham •Ronaldinho•Lionel Messi •Ronaldo • Compilation error

What will be output when you will execute following c code?

#include<stdio.h>void main(){     switch(5/2*6+3.0){        case 3:printf("David Beckham");             break;        case 15:printf("Ronaldinho");             break;        case 0:printf("Lionel Messi");             break;        default:printf("Ronaldo");     }   }Choose all that apply:

•David Beckham •Ronaldinho•Lionel Messi •Ronaldo • Compilation error

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int x=-1,y=-1;    if(++x=++y)         printf("R.T. Ponting");    else         printf("C.H. Gayle");}

Choose all that apply:

• R.T Ponting • C.H. Gayle • Warning: x and y are assigned a value that is never used • Warning: Condition is always true •Compilation error

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int x=-1,y=-1;    if(++x=++y)         printf("R.T. Ponting");    else         printf("C.H. Gayle");}

Choose all that apply:

• R.T Ponting • C.H. Gayle • Warning: x and y are assigned a value that is never used • Warning: Condition is always true •Compilation error

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int m=5,n=10,q=20;    if(q/n*m)         printf("William Gates");    else         printf(" Warren Buffet");         printf(" Carlos Slim Helu");}

Choose all that apply:

• William Gates •Warren Buffet Carlos Slim Helu •Run time error •Compilation error •None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int m=5,n=10,q=20;    if(q/n*m)         printf("William Gates");    else         printf(" Warren Buffet");         printf(" Carlos Slim Helu");}

Choose all that apply:

• William Gates •Warren Buffet Carlos Slim Helu •Run time error •Compilation error •None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){    char arr[11]="The African Queen";    printf("%s",arr);}

Choose all that apply:

(A)The African Queen (B)The(C) The African(D) Compilation error (E) None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){    char arr[11]="The African Queen";    printf("%s",arr);}

Choose all that apply:

(A)The African Queen (B)The(C) The African(D) Compilation error (E) None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int xxx[10]={5};    printf("%d %d",xxx[1],xxx[9]);}

Choose all that apply:

(A)Garbage Garbage (B)0 0 (C)null null (D)Compilation error (E)None of the above

What will be output when you will execute following c code?

#include<stdio.h>void main(){    int xxx[10]={5};    printf("%d %d",xxx[1],xxx[9]);}

Choose all that apply:

(A)Garbage Garbage (B)0 0 (C)null null (D)Compilation error (E)None of the above

What will be output if you will compile and execute the following c code?

#define x 5+2void main(){    int i;    i=x*x*x;    printf("%d",i); }OUTPUT:(A)343 (B)27 (C)133 (D)Compiler error (E) None of above

What will be output if you will compile and execute the following c code?

#define x 5+2void main(){    int i;    i=x*x*x;    printf("%d",i); }OUTPUT:(A)343 (B)27 (C)133 (D)Compiler error (E) None of above

What will be output if you will compile and execute the following c code?

void main(){  int i=4,x;  x=++i + ++i + ++i;  printf("%d",x); }OUTPUT: (A) 21 (B) 18 (C) 12 (D) Compiler error (E) None of above

What will be output if you will compile and execute the following c code?

void main(){  int i=4,x;  x=++i + ++i + ++i;  printf("%d",x); }OUTPUT: (A) 21 (B) 18 (C) 12 (D) Compiler error (E) None of above

What will be output if you willcompile and execute the following c code?

void main(){  int a=10;  printf("%d %d %d",a,a++,++a); }

OUTPUT:(A)12 11 11 (B)12 10 10 (C) 11 11 12 (D)10 10 12 (E)Compiler error

What will be output if you willcompile and execute the following c code?

void main(){  int a=10;  printf("%d %d %d",a,a++,++a); }

OUTPUT:(A)12 11 11 (B)12 10 10 (C) 11 11 12 (D)10 10 12 (E)Compiler error

What will be output if you will compile and execute the following c code?

void main(){  int x;  for(x=1;x<=5;x++);    printf("%d",x); }OUTPUT:(A)4(B) 5 (C) 6 (D) Compiler error(E) None of above

What will be output if you will compile and execute the following c code?

void main(){  int x;  for(x=1;x<=5;x++);    printf("%d",x); }OUTPUT:(A)4(B) 5 (C) 6 (D) Compiler error(E) None of above

What will be output if you will compile and execute the following c code?

#define max 5;void main(){int i=0;i=max++;printf("%d",i++); }

OUTPUT:(A) 5 (B) 6 (C) 7 (D) 0 (E) Compiler error

What will be output if you will compile and execute the following c code?

#define max 5;void main(){int i=0;i=max++;printf("%d",i++); }

OUTPUT:(A) 5 (B) 6 (C) 7 (D) 0 (E) Compiler error

What will be output of the following c program?

#include<stdio.h>int main(){long int new=5l;printf("%ld",new);return 0;}

OUTPUT:(A)5 (B)51(C)0 (D)Compilation error (E)None of these

What will be output of the following c program?

#include<stdio.h>int main(){long int new=5l;printf("%ld",new);return 0;}

OUTPUT:(A)5 (B)51(C)0 (D)Compilation error (E)None of these

What will be output of the following c program?

#include<stdio.h>int main(){ long int _=5l;printf("%ld",_);return 0;}OUTPUT:(A)5(B)51(C) 0 (D)Compilation error (E)None of these

What will be output of the following c program?

#include<stdio.h>int main(){ long int _=5l;printf("%ld",_);return 0;}OUTPUT:(A)5(B)51(C) 0 (D)Compilation error (E)None of these

What will be output of the following c program?

#include<stdio.h>int main(){long int a;(float)a=6.5;printf("%f",a);return 0;}

OUTPUT: (A) 6.5

(B) 6.500000 (C) 7.000000 (D) Compilation error (E) None of these

What will be output of the following c program?

#include<stdio.h>int main(){long int a;(float)a=6.5;printf("%f",a);return 0;}

OUTPUT: (A) 6.5

(B) 6.500000 (C) 7.000000 (D) Compilation error (E) None of these

What will be output of the following c program?

#include<stdio.h>int main(){const a=10;a=~a;printf("%d",a);return 0;}

OUTPUT: (A) 10

(B) -11 (C) 12 (D) Compilation error (E) None of these

What will be output of the following c program?

#include<stdio.h>int main(){const a=10;a=~a;printf("%d",a);return 0;}

OUTPUT: (A) 10

(B) -11 (C) 12 (D) Compilation error (E) None of these

What will be output of the following c program?

main(){static int var = 5;printf("%d ",var--);if(var)main();}Answer:

?

What will be output of the following c program?

main(){static int var = 5;printf("%d ",var--);if(var)main();}

Answer:5 4 3 2 1

#include<stdio.h>main(){ int i=1,j=2;switch(i){case 1: printf("GOOD");break;case j: printf("BAD");break;}}

#include<stdio.h>main(){ int i=1,j=2;switch(i){case 1: printf("GOOD");break;case j: printf("BAD");break;}}Answer:Compiler Error: Constant expression required in function main