Provided by www.YuvaJobs.com - General - other TEST GUIDELINES Answers should be indicated by placing a tick mark ( ) in the relevant box. To change any answer already marked, cancel the previous mark by placing an”=” symbol. Thereafter, place a fresh tick mark ( ). All questions have only one right answer. If more than one answer is indicated, the question will not be evaluated. Use of Calculators; log tables etc. is not permitted. The duration of this test is strictly 60 minutes. In case you continue to answer beyond 60 minutes, your sheet will not be evaluated. Any attempt to impersonate will be viewed seriously. SECTION A Directions : For each question in this section, select the best of the choices given #define AND && #define OR || #define LE = main( ) { char ch = ‘D’; if((ch GE 65 AND ch LE 90) OR (ch GE 97 AND ch LE 122)) printf(“Alphabet”); else printf(“Not an alphabet”); } a) No Alphabet b) Alphabet c) error d)None main( ) { int n[25]; n[0] = 100; n[24] = 200; printf(“%d %d”, *n, *(n + 24) + *(n + 0)); } a) 200 100 b) 100 300 c) 100 200 d) None main( ) { int arr[ ] = { 0, 1, 2, 3, 4}; int i, *ptr; for(ptr = arr + 4; ptr = arr; ptr--) printf(“%d”, *ptr); } a) 0 1 2 3 4 b) 4 3 2 1 0 c) 1 2 3 4 0 d)None main( ) { struct employee { char name[25]; int age; float bs; }; struct employee e; e.name = “Hacker”; e.age = 25; printf(“%s%d”, e.name, e.age); } a) Hacker, 25 b) Error message c) 25 Hacker d) None #define NULL 0 main( ) { struct node { struct node *previous; int data; struct node *next; } ; struct node *p, *q; p = malloc(sizeof(struct node)); q = malloc(sizeof (struct node)); p->data = 75; q->data = 90; p->previous = NULL; p->next = q; q->previous = p; q->next = NULL; while(p!=NULL) { printf(“%d\n”, p->data); p =p->next; } } a) 90 b) 75 c) 90 d) None 75 90 90 main( ) { int i=3; i=i++; printf(“%d”,i)); } a. 3 b. 4 c. undefined d. Error What error would the following function give on compilation. f (int a,int b) { int a; a=20; return a; } #define sqr(x) (x*x) main( ) { int a,b=3; a=sqr(b+2); printf(“%d”,a); } a. 25 b. 11 c. Error d. Garbage value #define str(x) #x #define Xstr(x) str(x) #define oper multiply main( ) { char *opername=Xstr(oper); printf(“%s”,opername); } a. oper b. multiply c. Error d. None main( ) { printf(“%c”,”abcdefgh”[4]); } a. a b. e c. Error d. None main( ) { printf(“%d %d %d”,sizeof(‘3’),sizeof(“3”),sizeof(3)); } a. 1 1 1 b. 2 2 2 c. 1 2 2 d. 1 1 1 Note: Assume size of int is 2 bytes. main( ) { struct emp{ char n[20]; int age;} struct emp e1={“david”,23}; struct emp e2=e1; if(e1= = e2) printf(“structures are equal”); } main( ) { char a[ ]; a[0] = ‘A’; printf(“%c”, a[0]); } a) Compilaltion Error b) No output c) A d) None main( ) { int x = 5; printf(“%d %d”, x++, ++x); return 0; } a) Error b) 6, 6 c) 5, 7 d) 7, 6 main( ) { int z = 4; printf( “%d”, printf(“ %d %d “, z, z)); } a) 4 4 3 b) 4 4 5 c) 4 4 4 d) Error int i = 0; main( ) { printf(“i = %d”, i); i++; val( ); printf(“After i=%d”, i); val( ); } val( ) { i =100; printf(“val’s i=%d\n”, i); i++; } a) i =0 b) i=0 c) Error d) None of the above val’s i=100 val’s i =100 i =1 i=101 val’s i =100 val’s i =100 main( ) { int a[ ] = { 10, 20, 30, 40, 50}; int j; for (j = 0; j < 5; j++) { printf(“ \n %d”, * a); a ++; } } a) 0..5 b) 0..4 c) Error d) None of the above main( ) { int a[5] = {2, 4, 6, 8, 10); int i, b =5; for(i=0; i0); i = i +n; } The end value of i is (a)210 (b) 20 ( c) -1 (d) 200 main( ) { int i = 0; char ch = ‘A’ do { printf(“%c”, ch); } while (i++