C Programming 1. main( ) { int x = 10, y = 20;/. x =!x; y =!x&&!y; printf(“x =%d y =%d”, x, y); } b) x = 0 a) x = 10 y = 20 y=0
c) x = 20 y = 10
d) None
2. main( ) { int x = 5; x++; printf(“x =%d\n”, x); ++x; printf(“x = %d\n”, x); } a) x = 5 b) x = 6 c) x = 7 x=7 x=7 x=5 3. main( ) { int x = 10, y =x, z =x; y = x; z = -x; t = - x; printf(“y =%d z=%d t=%d”, y, z, t); } a) y = -10 b) y = 0 c) y = 0 z=0 z = -10 z = -10 t = -10 t = -10 t = -10 4. main( ) { int i; for(i = - 1; i < = 10 ; i + +) { if ( i < 5 ) continue ; else break; printf(“Gets printed only once!!”); }} a) No output b) Gets printed only once
c)Error
d ) No n e
d) None
d ) No n e
5. main( ) { int i =135, a =135, k; k =function(!++i, !a++); printf(“i =%d a=%d k=%d”, i, a, k); } function(j, b) int j, b; { int c; c = j + b; return( c ); }
a) i = 136
a = 135 k=0
b) i = 136 a = 136 k=0
c) i = 135 d)None a = 136 k=0
6. main( ) { int k = 35, z; z = func(k); printf(“z =%d”, z); } func(m) int m; { + +m; return(m = func1 (++m)); } func1(m) int m; { m ++; return(m); } a) z = 38
b) z = 36
None 7. main( ) { if(printf(“C for yourself how it works\n”)) main( ); }
c) z = 37
d)
a)error d) None
b) C for yourself it works
c) C for yourself how it works C for yourself how it works C for yourself how it works C for yourself how it works …….. ………. …….. ……. ……… ……… ………. …
8. main( ) { int i = 1; if(!i ) printf(“Recursive calls are real pain!”); else { i = 0; printf(“Recursive calls are challenging\n”); main( ); } } a)Recursive calls are challenging b) Recursive calls are challenging c) Error d) None Recursive calls are challenging Recu Recurs rsiv ivee cal calls ls are are cha chall llen engi ging ng . ……… ……….. ………….. ……… ………. …………… 9. int i = 0; main( ) { printf(“in main i =%d\n”, i); i ++; val( ); printf(“in main i =%d\n”, i); } val( ) { int i = 100; printf(“in val i = %d\n”, i); i ++; } a) 101 1 10. #define NO #define YES main( ) { int i = 5, j;
b) Error message
c)1 100
d ) No n e
if( i > 5) j = YES; else j = NO; printf(“%d”, j); } a) Yes Yes Yes Yes Yes Yes b) Error Message c) None
d ) No No No
11. #define AND && #define OR || #define LE <= #define GE >= 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
12. main( ) { int n[25]; n[0] = 100; n[24] = 200; printf(“%d %d”, *n, *(n + 24) + *(n + 0)); } a) 200 200
100 100
b) 100 100
300 300 c) 100
200
d) None None
13. 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( )
14.
{ static char s[ ] = “Rendezvours!”; printf(“%d”, *(s + strlen(s))); strlen(s)));
} a) 0
b) 1
15.
main( )
c) e
d) None
{ static char str[ ] = { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48}; char *s; int i; s = str; for(i = 0; i <=9; i++) { if(*s) printf(“%c”, *s); s++; } } a)0 0 0 0 0 0 0 0 0 0 b) 1 1 1 1 1 1 1 1 1 1 c) 48 48 48 48 48 48 48 48 48 48 d) None
main( )
16.
{ 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 ker, 25 b) Error message
17. main( ) { struct s1 { char*str; int i; struct s1*ptr; }; static struct s1 a[ ] ={
c) 25 Hacker d) d) None one
{“Nagpur”, 1, a + 1}, {“Raipur”, 2, a + 2}, {“Kanpur”, 3, a} }; struct s1*p = a; int j; for (j = 0; j <=2; j++) { printf(“%d”, --a[j].i); printf(“%s\n”, ++a[j].str); } } a) 1 0 2
18.
aipur agpur anpur
b) 0 1 2
agpur aipur anpur
#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; } }
c) 0 1
aipur d) None agpur 2 anpur
a) 90 75
b) 75 c) 90 d) None 90 90
19. main( ) { struct a { int i; int j; }; struct b { char x; char y[3]; }; union c { struct a aa; struct b bb; }; union c u; u.aa.i = 512; u.aa.j = 512; printf(“%d%d”, u.bb.x, u.bb.y[0]); printf(“%d%d”, u.bb.y[1], u.bb.y[2]); }
a)2020
b) 0022
c) 0202
d) None
20. main( ) { int a = 3, b = 2, c =1, d; d = a| b & c; printf(“d = %d\n”, d); d = a| b & ~ c; printf(“d =%d\n”, d); } a)
d=2 d=2
b) d = 3 d=3
c) d = 1 d=1
d) None
21. main( ) { static char a[]=”Bombay”; char *b=”Bombay”; printf(“%d %d”,sizeof(a),sizeof(b)); } a. 1 6 b. 1 1 c. 6 6
d. None
22. main( ) { int i=3; i=i++; printf(“%d”,i)); } a. 3 b. 4
d. Error
c. undefined
23. What error would the following function give on compilation. f (int a,int b) { int a; a=20; return a; } a. Missing parantheses parantheses in return statement. b. The function should be defined as int f(int a,int b) c. Redeclaration of a. d. None of the above. 24. main( ) { int b; b=f(20); printf(”%d”,b); } int f(int a) { a>20?return (10):return (20); } a. 20
b. 10
25. #define sqr(x) (x*x) main( )
c. No output
d. Error
{ int a,b=3; a=sqr(b+2); printf(“%d”,a); } a. 25
b. 11
c. Error
d. Garbage value
26 #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
27. main( ) { printf(“%c”,7[“sundaram”]); } a. S b. m c. \0
d. Error
28. main( ) { int a[ ]={10,20,30,40,50}; char *p; p=(char *)a; printf(“%d”,*((int *)p+4)); } a. 50 b. 10 c. Error
d. None
29. main( ) { printf(“%c”,”abcdefgh”[4]); } a. a b. e c. Error
d. None
30. main( ) { printf(“%d %d %d”,sizeof(‘3’),sizeof(“3”),si %d”,sizeof(‘3’),sizeof(“3”),sizeof(3)); zeof(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. 31. main( ) { struct emp{
char n[20]; int age;} struct emp e1={“david”,23}; struct emp e2=e1; if(e1= = e2) printf(“structures are equal”); a. b. c. d.
} structures are equal No output Error None
32. main( ) { char a[ ]; a[0] = ‘A’; printf(“%c”, a[0]); } a) Compilation Error b) No output c) A d) None 33. main( ) { char **p =”Hello”; printf(“%s”, **p); } a) Hello b) **p c) Error
d) None
34. main( ) { int count, end=20; for (count=1; count<=end; count++) { if(count %2) continue; else if(count %4) continue; else if(count %6) continue; else if(count %8) continue; else if(count %10) continue; else if(count %12) continue; else printf(“%d”, count); }
printf(“%d”, count); } The output is a)No display
b) Error c) 20 21 d) 21
35. main( ) { int a=5; do { printf(“%d\n”, a); a = -1; } while (a>0); } a) 0
b) -1
c) Error
d) 5
36. main( ) { int x = 5; printf(“%d %d”, x++, ++x); return 0; } a) Error
b) 6, 6
c) 5, 7
d) 7, 6
37. main( ) { int z = 4; printf( “%d”, printf(“ %d %d “, z, z)); } a) 4 4 3 b) 4 4 5 c) 4 4 4
38. 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++;
d) Error
} a) i =0 b) i=0 val’s val’s i=100 i=100 val’s val’s i =100 =100 i =1 i=101 val’s i =100 val’s i =100
c) Error
d) None of the above
39. main( ) { printf( “%d %c \n”); printf( “%d %c \n”); return 0; } a) Erro Errorr
4 0.
b) d c d c
c) Com Compil pilatio ation n err error
d) Som Some gar garbage bage valu valuee will be the output
main( ) { int i; scanf( “%d”, &i); switch( i ){ case 1 : printf( “Do”); case 2 : printf( “ Re “); case default : printf( “ SACHIN “); }} The output will be a) DO Re SACHIN
b) SACHIN
c) Do Re
d) Error
41. # define COND(a > = 65 & & a < = 90) main( ) { char a = ‘R’; if (COND) printf(“ UPPER CASE”); else printf(“ LOWER CASE”); } a) LOWER LOWER CASE b) UPPER CASE c) ERROR-COMPILE d) RUN-TIME ERROR 42. 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
43. main( ) { int a[ ] = { 10, 20, 30, 40, 50} char *p; p = (char *) a; printf( “ %d”, * ((int*) p+4)); } a) 50
b) 10
c) Error
d) None
44. main( ) { int a[5] = {2, 4, 6, 8, 10); int i, b =5; for(i=0; i<5; i++) { f(a[i], &b); printf(“\n %d %d”, a[i], b); } } f(int x, int *y) { x = *(y) +=2; }
a) 2 7 4 9 6 11 8 13 10 15
b) 4 9 6 11 8 13 10 15 12 17
45. main( ) { int a,b; b=7; printf(“%d”, a = =b); printf(“%d”, a=b); } (a) 6 7 (b) 7 6 ( c ) 1 7 ( d ) 0 7
c) 7 9 11 13 15
2 4 6 8 10
d) Error
46. main ( ) { int n=20, i = 0; while(n- - >0); i = i +n; } The end value of i is (a)210 (b) 20 ( c) -1 (d) 200 47. main( ) { int i = 0; char ch = ‘A’ do { printf(“%c”, ch); } while (i++ <5| | ++ch < =’F’); } The output of above program is (a) ABCDEF (b) AAAAAA BCDEF ( c) A will be displayed infinitely (d)None of the above 48. Assume that a,b,c are integer variables. variables. Values of a,b and c are 2,3 and 1 respectively. Which of the following statement is correct regarding the assignment d=a < b < c - 1; (a) Above statement is syntactically not correct (b) Value zero will be stored in variable d (c) Value one will be stored in variable d (d) Value -1 will be stored in variable d 49. int count, sum; main( ) { for(count = 4; sum + = - - count); printf(“%d”, sum); } (a) (b) (c) (d)
Programs goes into an infinite loop 356653 will be displayed 354453 will be displayed None of the above
50. main( ) { static int c =5; printf(“%d”, c--); if (c ) main( );
} 5 5 5 5 5 (b) 5 4 3 2 1 (c ) 5 4 3 2 1 0 (d) None of the above
1) what will be the result of executing following program main( ) { char *x="New"; char *y="Dictionary"; char *t; void swap (char * , char *); swap (x,y); printf("(%s, %s)",x,y); char *t; t=x; x=y; y=t; printf("-(%s, %s)",x,y); } void swap (char *x,char *y) { char *t; y=x; x=y; y=t; } a).(New,Dictionary)-(New,Dictionary) b).(Dictionary,New)-(New,Dictionary) c).(New,Dictionary)-(Dictionary,New) d).(Dictionary,New)-(Dictionary,New)
2) What will be result of the following program main() { void f(int,int); int i=10; f(i,i++); } void f(int i,int j) {
if(i>50) return; i+=j; f(i,j); printf("%d,",i); } a).85,53,32,21 b)10,11,21,32,53 c)21,32,53,85 d)none of the above 3)What is the size of 'q'in the following program? union{ int x; char y; struct { char x; char y; int xy;}p; }q; a)11 b)6 c)4 d)5
4)Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } a)0,5,9,13,17 b)5,9,13,17 c)12,17,22 d)16,21
5)What is the result main() { char c=-64; int i=-32 unsigned int u =-16; if(c>i){ printf("pass1,"); if(c
6) 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) Hacker 25 c) Error 7) *p++ a)increments p, b)increments value pointed by p c) increments both d none of the above
d) None of the above
w 8) What's wrong with the code "char c; while((c = getchar()) != EOF) ..."? a) EOF cannot cannot be used used in whil whilee loop loop b) EOF cannot be used with getchar c) C sho shoul uld d be be an an int integ eger er d) None None of the the abo above ve 9) What is the O/P of the program given below main( ) { static char a[]=”Bombay”; char *b=”Bombay”; printf(“%d %d”,sizeof(a),sizeof(b)); } a. 1 6 b. 1 1 c. 6 6 d. None
10 What is the O/P of the program given below main( ) { int I=3; I=I+ +; printf(‘%d”,I)); } a. 3 b. 4
c. undefined
d. Error
11What error would the following function give on compilation. f (int a,int b) { int a; a=20; return a; } a. Missing parantheses parantheses in return statement. b. The function should be defined as int f(int a,int b) c. Redeclaration of a. d. None of the above. 2 )#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
13)main( ) { printf(“%c”,7[“sundaram”]); } a. S b. m c. \0
d. Error
14)main( ) { int a[ ]={10,20,30,40,50}; char *p; p=(char *)a; printf(“%d”,*((int *)p+4)); } a. 50 b. 10 c. Error
d. None
15)When a array int arr[MAXROW][MAXCOL] is passed to a function fun( ) then the function fun( ) will be defined as a. fun(int a[ ][MAXCOL]) ][MAXCOL]) b. fun(int a[ ][MAXROW]) c. fun(int (*ptr)[MAXCOL])) d. fun(int a[ ])
16)main( ) { printf(“%c”,”abcdefgh”[4]); } a. a b. e c. Error
d. None
17)main( ) { printf(“%d %d %d”,sizeof(‘3’),sizeof(“3”),si %d”,sizeof(‘3’),sizeof(“3”),sizeof(3)); zeof(3)); } a. 1 1 1 b. 2 2 2 c. 1 2 2 d. 1 1 1
18)main( ) {
struct emp{ char n[20]; int age;} struct emp e1={“david”,23}; struct emp e2=e1; if(e1= = e2) printf(“structures are equal”); a. b. c. d.
} structures are equal No output Error None
19)main( ) { FILE *fp; fp=fopen(“x1”,”r”); } fp points to a) The first character in the the file b) A Structure which contains a char pointer which points to the first character in the file. c) Name of the file d) None of the above 20)If the following program (myprog) is run from the command line as myprog “*.c” What would be the output? main (int arg c, char *argv[ ]) { int i; for (i=1; i
*.C List of all .C files in the current directory directory “*.C” None
21)Which of the following is true about argv? a) It is an array of character pointers b) It is a pointer to an array of character pointers c) It is an array of integers. d) None
22)If the following program (myprog) is run from the command line as myprog Friday Tuesday Sunday What would be the output? main(int argc, char *argv[]) { printf(“%C”, (* ++ argv)[0]; } a) m b) f c) myprog d) Friday
23)main( ) { int a; char *[ ]= “Programming”; for (a=0; x[a]! = ‘\0’; a++) if (( a%2 = =0) printf(“% C”, x[a]); x[a]); } The output is a) Programming b) rgamng c) Pormig d) None
24)float *(* x[20]) (int *a) a) x is array of pointer to functions accepting integer pointer as an argument and returning a pointer to float. b) x is pointer to a function which accepts an array of pointers and returns a float c) x is a pointer to a function that accepts a pointer to an integer array and returns a character d) None 25)Declaration for a pointer to function pointer that accepts an argument which is an array of pointer 5 integers and returns a pointer to a character is a) char * (* ptr) (int * a[5]) b) char (*x) (int (*a) []) c) char * (*x) (int a[5]) d) char * (*x[5]) (int a[5]) 26) main( ) { int count, end=20; for (count=1; count<=end; count++) { if(count %2) continue; else if(count %4) continue; else
if(count %6) continue; else if(count %8) continue; else if(count %10) continue; else if(count %12) continue; else printf(“%d”, count); } printf(“%d”, count); } The output is a)No display b) Error c) 20 21 d) 21
27) main( ) { int n[25]; n[0] = 100; n[24] = 200; printf(“\n%d%d”, * n, *(n+24) + *(n+0)); } a) 100
300
b) 100
200 c) Error
d) 300, 100
28) main( ) { int i; scanf( “%d”, &i); switch( i ){ case 1 : printf( “Do”); case 2 : printf( “ Re “); case default : printf( “ SACHIN “); }} The output will be a) DO Re SACHIN
29) . main( ) { int b; b = f(20);
b) SACHIN
c) Do Re
d) Error
printf( “%d”, b); } int f(int a) { a>20 ? return(10) : return(20); } a) 20
b) 10 c) No output
d) Error
30) main( ) { int arr[ ] = { 0, 1, 2, 3, 4}; int *ptr; for (ptr = &arr[0]; ptr <= &arr[4]; ptr++) printf(“%d”, *ptr); } a) 0 1 2 3 4 b) 1 2 3 4 5
c) Error
d) Some Garbage Value
1)
main( ) { struct s1 { char*str; int i; struct s1*ptr; }; static struct s1 a[ ] ={ {“Nagpur”, 1, a + 1}, {“Raipur”, 2, a + 2}, {“Kanpur”, 3, a} }; struct s1*p = a; int j; for (j = 0; j <=2; j++) { printf(“%d”, - - -a[j].i); printf(“%s\n”, ++a[j].str); } }
a) 1 0 2
aipur agpur anpur
b) 0 1 2
agpur aipur anpur
c) 0 1 2
aipur d) None agpur anpur
2) #define NULL 0 main( ) { struct node { struct node *previous; int data; struct node *next; }; struct node *p, *q; p = malloc(size of(struct node)); q = malloc(size of (struct node)); p->data = 75; q->data = 90; p->previous = NULL; p->next = q; q->previous = p; a->next = NULL; while(p!=NULL) { printf(“%d\n”, p->data); p =p->next; } } a) 90 b) 75 c) 90 d) None 75 90 90 90 3) main( ) { struct a { int i; int j; }; struct b { char x; char y[3]; }; union c { struct a aa; struct b bb;
}; union c u; u.aa.i = 512; u.aa.j = 512; printf(“%d%d”, u.bb.x, u.bb.y[0]); printf(“%d%d”, u.bb.y[1], u.bb.y[2]); } a)2020
b) 0022
4)main( ) { int a = 3, b = 2, c =1, d; d = a| b & c; printf(“d = %d\n”, d); d = a| b & ~ c; printf(“d =%d\n”, d); } a) d = 2 d=2
c) 0202
b) d = 3 d=3
c) d = 1 d=1
5) What is the output? line 1 main ( ) line 2 { line 3
char a{3}{3}= {{‘a’,’b’,’c’},{‘p’,’q’,’r’},{‘x’,’y’,}}
line 4
char**p;
line 5
*p=a[0];
line 6
printf(“%s\n”.*p);
line 7
} c)
a)Abc b)Compilation error
6.
d ).
Abcpqrxy None of the above
What will be the output of this program? #include
d ) No n e
d) one
void main(void) { int varl=5,var2=5,var3=6,minmax; minmax=(var1>var2)?(var1>var3) ? varl:var3:(var2>var3)? var2:var3; printf(“%d\n”,minmax); } This program will a. b.
7.
Print 5
d.
Produce a compilation error
Print 6
What hat wil will be the out output put of the fol followi lowing ng prog progrram? am? main( ) { int x = 1, y = 4, z = 4; printf("ans=%d", z >= y && y >= x ? 100:200); } a. b.
8.
c.
Produce a runtime error
100 100 200
c. d.
200 None of the above
c. d.
typedef enum code CODE None of the above
To get the output c=0 d=2 What should be coded in the blank space? main( ) { enum code { add, delete, modify, unchanged }; ............................... ; CODE c,d; c = add; d = modify; printf("c=%d d=%d",c,d); } a. b.
Typedef code CODE Typedef enum code
9 #include"stdio.h" main( ) { FILE *fp; Char str[80]; /*TRIAL.C contains only one line: it’s a round,round,round world!*/ fp=fopen(“TRIAL.C","r"); ________________________ ; puts(str); } To get this output "its a round, round, round world!" in an infinite loop, what should be coded in the blank space. a. b.
While(fgets(Str,80,fp)!=EOF) While(fp!=NULL)
c. d.
while(getch(fp)!=EOF None of the above
10)What will be the output of the following program? #define ISLOWER(a) (a >= 97 && a <= 127) #define TOUPPER(a) (a-32) main( ) { char ch='c'; if(ISLOWER(ch)) ch=TOUPPER(ch); printf("%c",ch); } a. C c. 99 b. C d. None of the above
11)for(; i<5;) is equivalent to 1. while(i<5) statements; 2. do statements; while(i<5); 3. if(i<5) statements; a . 1 , 2 ,3
b. 2
c. 1,2
12) If a = 010011 then a << 2 is
d. 1
a. b. c. d.
010110 011100 101100 None of the above
13. If you are using “open” function for opening a file the file handle should be of ____________ type. a) b) c) d)
FILE int char None None of the the abo above ve
14)main( ) { static float a[ ] = { 13.24, 1.5} float *j, *k; j = a; k = a + 2; j = j * 2; k = k/2; printf(“%f%f ”, *j, *k); } a) Error b) Some value
c) No output
d) None of the above
15)main( ) { static char s[ ] = “Rendezvous”; printf(“%d”, *(s+ strlen(s))); strlen(s))); } a) 0
b) Rendezvous
16)# include “stdio.h” main( ) { FILE *fp; char c; fp = fopen(“TRY.C, “,”r”); if(fp = NULL) { puts(“Cannot open file”); exit(1) } while((c =getc(fp))! = EOF)
c) ‘\0’
d) Error
putch(c ); fclose(fp); } a) Erro Errorr
c) Each Each char charac actter read ead wou woulld be be di displa splay yed on the the scr scree een n
b) No output 17)main( ) { char ch = `E` switch(ch) { case(ch > = 65 && ch < =90): printf(“Capital Letter”); break; case(ch >=97 && ch<=122): printf(“small case letter”); break; default: printf(“BAI”); } } a) Error message b) Capital Letter c)small case letter letter d) BAI 18) Carefully go through the following code #include void main(void); void main(void) { struct s{ int x; float y; }s1 = {25,45.00}; union u{ int x; float y; }u1; u1=(union u)s1; printf("%d and %f",u1.x,u1.y); } /* What will this program point ? a) 25 and 45.00 b) Produce a compilation error c) 45 and 45.00 d) Produce a runtime error */
19) Consider the following C program. #include void main(void) { unsigned int c; unsigned x=0x0003; scanf("%u",&c); switch(c&x) { case 3 : printf("Hello! \t"); case 2 : printf("Welcome \t"); case 1 : printf("To All \t"); default: printf("\n"); } } If the value input for the variable c is 10, what will be the output of the program ? a) The program will generate a compile compile time error as there there is no break statement for the various case choices. b) The program will print Hello! c) The program program will print Welcome Welcome To All d) None of the above 20) Study the following program #include void main(void); void main(void) { int var1=5,var2=5,var3=6,minmax; minmax = (var1 > var2) ? (var1 > var3) ? var1:var3:(var2 > var3) ? var2:var3; printf("%d\n",minmax); } This program will a) Produce a runtime error b) Produce a compilation error c) Print 5 d) Print 6 21) Consider the following C program. #include void main(void)
{ unsigned int c; unsigned x=0x0003; scanf("%u",&c); switch(c&x) { case 3 : printf("Hello! \t"); case 2 : printf("Welcome \t"); case 1 : printf("To All \t"); default: printf("\n"); } } If the value input for the variable c is 10, what will be the output of the program ? a) The program will generate a compile compile time error as there there is no break statement for the various case choices. b) The program will print Hello! c) The program program will print Welcome Welcome To All d) None of the above 22. 22.
What What will will be the the out outpu putt of the the fol follo lowi wing ng prog progra ram? m? main( ) { int i=3; switch (i) { case 1: printf("au revoir!”); case 2: printf("adieu!"); case 3: continue; default: printf("plain simple goodbye!"); } } a. b.
23. 23.
plain simple goodbye Error
c. d.
au revoir adieu None of the above
What What will will be the the out outpu putt of the the fol follo lowi wing ng prog progra ram? m? main( ) { static float a [ ]={13.24,1.5,1.5,5.4,3.5}; float *j, *k;
j=a; k=a+4; j=j*2; k=k/2; printf("%f %f",*j,*k); } a. b. 24. 24.
13.24 1.5 15.5 5.4
c. d.
Compilation error Runtime error
What hat is the the outp output ut of the the foll ollowin owing g code code?? main ( ) { struct xyz { int I; int k; } pqr = {100,300}; struct xyz *z; z=&pqr; z->I=300; z->k=100; abc(z) } abc(char *p) { p++; printf(“%d\n”,*p); } a. b. c. d.
25. 25.
5 1 2 None of of th the ab above
What hat wil willl be be the the outp output ut of the the cod codee gi given ven bel below ow?? main ( ) { int c =0,d=5,e=10, a; a=c>1?d>1||e>1? 100:200:300; printf(“a=%d”,a); } a. b. c.
300 200 100
d. 2 6.
What will this program print? #define MAX (x,y)(x)>(y)>(y)?(x)(y) (x,y)(x)>(y)>(y)?(x)(y) main ( ) { int I=10,j=5,k=0; k=MAX(I++,++j); printf(“%d…%d…%d”,I,j,k); } a. b. c. d.
27. 27.
Error
11…12…13 12...11...13 12...6…11 None of of th the ab above
What What will will be the the out outpu putt of of the the foll follow owin ing g ‘C’ ‘C’ prog progra ram? m? main ( ) { int I=0; switch (I) { case 0: I++ ; printf(“%d..”,I); case 1: printf(“%d..”,I); case 2: printf(“%d..”,I); } } a. b. c. d.
1 . .1 . . 1 . . 1.. 1 . .1 . . Error
28. 28.
What hat wil willl be be the the outp output ut of the the cod codee gi given ven bel below ow?? main ( ) { static char *s [ ] ={ “ice”, “green”, “cone”, “please” }; static char **ptr[ ]={s+3,s+2,s+1,s}; char ***p=ptr; printf(“%s\n”,**++p); printf(“%s\n”,*--*++p+3); printf(“%s\n”,*p[-2]+3); printf(“%s\n”,p[-1][-1]+1); printf(“%s\n”,p[-1][-1] +1); } A
cone
B
ase
ase reen 29
reen
cone reen
D
None
ase cone
What hat wil willl be be the the resul esultt of of the the fol followi lowing ng prog progrram? am? main ( ) { void f(int,int); int i=10; f(i,i++); } void f(int i, int j) { if(i>50) return; i+=j; f(i,j); printf(“%d”,i); } a.
30. 30.
C
85,53,32,21
b.
10,11,21,32,53
c.
What hat wil willl be be the the outp output ut of the the fol folllowin owing g cod code? e? main ( ) { FILE*fp; fp=fopen(“TRIAL.C”,”r”); fclose(fp);
21,32,53,85
d.
None
} a. b. c. d. 31
What What is the the valu valuee of of i aft after er the the fol follo lowi wing ng fun funct ctio ion n is is exe execu cute ted d 17 time timess void test ( ) { static float i=0.0; i=7.5; i=+=7.5; } a. b.
32. 32.
The file TRIAL.C if existing will be opened in read mode Error will be generated because c file cannot be opened through fopen Error will be generated becaus ause fclose( ) canno nnot be given with the file pointer None of the above
7. 7.5 15+16*7.5
c. d.
15.0 0.0
What What is the the val value ue of m whe when n the the foll follow owin ing g pro progr gram am runs runs?? void transform(register int*x) { x+=5*3; } void main ( ) { register int m=3; transform(&m); } a. b. c. d.
18 24 3 Erro Errone neou ouss pro progr gram am as a reg regis iste terr var varia iabl blee has has no addr addres esss
________________________ _______________________________________________ ____________________________________________________ ___________________ _
FUNDAMENTALS OF COMPUTERS
1.
What What was was the the name name of of the the fir first st comme commerc rcial ially ly ava avail ilab able le Mic Micro ropr proc oces esso sorr chi chip? p? a. Intel 8008 b. Intel 8080 c. Intel 4004 d. Motorola
2.
The The par parit ity y bit bit is add added ed for ____ ______ ____ ____ ____ ____ __ pur purpose pose a. b. c. d.
3.
Coding Indexing Error detection Controlling
A logi ogic gat gatee is an elec electtroni onic ci circui rcuitt whi which a. b. c. d.
4.
The The proce process ss of conve convert rtin ing g anal analog og sig signal nal into into dig digit ital al signa signals ls so they they can can be processed by a receiving computer is referred to as a. b. c. d.
5.
Modulation Demodulation Synchronizing Desynchronozing
A dist distri ribut buted ed dat dataa proce process ssin ing g conf config igur urat atio ion n in which which all all acti activi viti ties es mus mustt pass pass through a centrally located computer is called a. b. c. d.
6.
Makes logic decisions Allows electron flow in only direction Works on binary algebra Alternates between 0 and 1
Ring Ne Network Spider network Hier Hierar arch chic ical al Netwo Network rk Data Data cont contro roll Netw Networ ork k
Comm Commun unic icat atiion bet between ween com comput puters ers is alwa alway ys a. b. c. d.
Serial parallel series parallel direct
7.
Two ba basic ty types of of Op Operating Sy Systems ems ar are a. b. c. d.
8.
Multiprogr ogramming wa was ma made po possible by by a. b. c. d.
9.
DML DDL Query language Any of the Above
In data data flow flow diagr diagrams ams,, an origin originato atorr or receiv receiver er of of data data is is usua usually lly design designate ated d by a. b. c. d.
13.
Tables Treelike structure Complex logical relationship Records
The languag languagee used used in in the the appl applica icati tion on progr programs ams to reque request st data data from from the the DBMS DBMS is referred to as the a. b. c. d.
12.
Utility so software Specific software End-user software Practical software
Whic Which h of the the fol follo lowi wing ng is is not not the the char charac acte teri rist stic ic of a rela relati tiona onall databa database se mod model el a. b. c. d.
11.
Inpu Input/ t/Ou Outp tput ut unit unitss tha thatt ope opera rate te inde indepe pend nden entl tly y of of the the CPU CPU Operating Systems Both c and d Neither a and b
What What is the the alt alter erna nati tive ve name name for for app appli lica cati tion on soft softwa ware re a. b. c. d.
10
Sequential and direct Batch and timesharing Direct an and interactive Batch and interactive
square box a circle a rectangle an arrow
A. Decisio Decision n trees trees are easier easier for most most peopl peoplee to unders understan tand d than than deci decisio sion n tabl tables. es.
B. Structured English is easier to convert to program code than regular regular narrative English. a. b. c. d. 14.
Who invent invented ed the the GOTO GOTO instru instructi ction on that that tells tells a compu computer ter to jump jump backwa backwards rds or forwards in its program a. b. c. d.
15.
Scrambling Structured Programming Micro Programming Sub Programming
Data integrity refers to a. b. c. d.
18.
Pseudocode Spaghetti Complex Code Object Code
What What is is the the name name of the progra programm mming ing techni technique que,, which which emphas emphasize izess break breaking ing large and complex tasks into successively smaller sections? a. b. c. d.
1 7.
Charles Babbage Ada Augusta Byron JM Jackguard Grace Murray Hooper
What What is is the the name name of the progra program m codi coding ng that that is unneces unnecessar sarily ily comple complex x and and difficult to follow a. b. c. d.
16.
both A and b are true both A and B are false Only A is true Only B is true
Privacy of data The simplicity of data The validity of da data The security of data
Which Which data data communi communicati cation on meth method od is is used used for for send sending ing data data in both both direc directio tions ns at at the same time. a. b. c. d.
Super duplex Simplex Half duplex Full duplex
19.
What What is the usual usual numb number er of of bits bits tran transm smitt itted ed simu simult ltaneo aneousl usly y in in paral parallel lel data data transmission used by microcomputers? a. b. c. d.
20.
The trans transfer fer of data data from from a CPU to peri periphe pheral ral device devicess of a compu computer ter is achieved achieved through a. b. c. d.
21. 21.
dialed service multiplexing polling conversational mode
A cha chara ract cter eris isti ticc of of a mult multii pro progr gram ammi ming ng syst system em is a b. c. d.
24. 24.
postal mail services telephone lines radio signals all the above
The syste systemat matic ic access access of small small comput computers ers in a dist distrib ribute uted d data data proces processin sing g syste system m is referred to as a. b. c. d.
23.
modems computer ports interfaces buffer memory
The The chan channe nell in in the the data data com commu muni nica cati tion on mod model el can can be be a. b. c. d.
22.
6 9 8 7
Simu Simult ltan aneo eous us exe execu cuti tion on of of Prog Progra ram m inst instru ruct ctio ions ns fro from m two two appl applic icat atio ions ns Concurrent processing of two or more programs Multiple CPU’s\ All the above
In the the IBM IBM PC - AT, AT, What What do the the word wordss AT stan stand d for for a. b. c. d.
Additional Te Terminal Advance Technologies Applied Technologies Advanced terminology
25.
Differ Different ent compone components nts on the mother motherboa board rd of of a PC proc process essor or unit unit are are link linked ed together by sets of parallel electrical conducting lines. What are these lines called? a. b. c. d.
26.
Execut Execution ion of of inst instruc ructi tions ons from from diff differe erent nt and and inde independ pendent ent progra programs ms by a comput computer er at the same instant time is called a. b. c. d.
27.
Fields are composed of bytes Fields are composed of characters Records are composed of fields All the above
Whic Which h of of the the fol follo lowi wing ng hardw hardwar aree com compo ponen nentt is is mos mostt vol volat atil ile? e? a. b. c. d.
30.
nonvolatile permanent control unit temporary
Which hich of the the fol folllowi owing are are tru true? e? a. b. c. d.
29
Multiprogramming Multiprocessing Concurrent Programming Multitasking
Which Which of of the the foll followi owing ng terms terms is the most most close closely ly rela related ted to main main memor memory? y? a. b. c. d.
28. 28.
Conductors Buses Connecto ctors Conn Connec ecttivity vity
ROM RAM PROM EEPROM
Whic Which h of of the the foll followi owing ng affe affect ctss the the proce process ssin ing g pow power er?? a. b. c. d.
Data bus capacity Addressing scheme Register size All the above
31
An integrated circuit is a. b. c. d.
32
Data processing is a. b. c. d.
33
Telephone lines Coaxial cables Modem Microwave sy systems
10 GB HD space refers to a. b. c. d.
3 7.
programmer skill language availability prog progra ram m com compati patibi bili lity ty with with othe otherr soft oftware ware all the above
Whic Which h of of the the fol follo lowi wing ng is not not tra trans nsmi miss ssio ion n medi medium um a. b. c. d.
3 6.
assembler object computer machine
A fac facttor in the secti ection on of sourc ourcee lan langu guag agee is is a. b. c. d.
35.
The same thing as data collection Similar to computer programming Most Mostly ly ass associ ociated ated wit with com commerci ercial al net networ work Akin to data coding
A prog progra ram m wri writt tten en in in mach machine ine lang languag uagee is call called ed as as ____ _______ _____ ____ __ pro progr gram am a. b. c. d.
34
a complicated circuit an integrating device much cos costtlier th than si singl ngle transistor fabricated in a single silicon chip
A byte is a. b. c. d.
10 gigabytes of of main me memory 10 gigabytes of section memory 10 gigabytes of Virtual memory All the above
8 bits 4 bits 16 bits 32 bits
38.
If you have have a 64 64 kbps kbps Inte Interne rnett line line,, it means means that that your your maxim maximum um data data transf transfer er rate rate is a. b. c. d.
3 9.
Unix is a. b. c. d.
4 0.
Multi-user OS Multi-user and Multitasking OS Multitasking OS Batch OS
A stack is a a. b. c. d.
41. 41.
64 X 1000 bits per sec 64 X 1024 bits/sec 64 X 1000 bytes/sec 64 X 1024 bytes/sec
FIFO list LIFO list Linear list Circular list
A directory ory is org organiz nized as a. b. c. d.
An inverted tree Is a one-d list of all files in the system system Cont ontain a list of of al all us users of of the sy system All the above
e.