Sei sulla pagina 1di 31

JULY-99 Q1.Each question below gives a multiple choice of answers.

Choose the most appropriate one and enter in the answer sheet provided, following instruction there in. 1)Assuming a short int occupies two bytes, an ordinary int 4 bytes, a long int 8 bytes and a chara 1 byte,what is the size of population (in bytes)? Struct struct_tag{ Short a1; Char add[10]; Int a2 [2][4]; Long a3; } population[10]; a)52 b)520 c)240 d)343 ans=(b) 2) if( "india"=="india") printf("equal"); else printf("unequal"); What will be printed by the above code? a)equal b)unequal c)India ans=(b) 3) main() { int *iptr , I; I=12; *iptr= I*I; ++I; printf( "%d %d \n", I, *iptr); } What will be printed by the above code? a)12 144 b) 13 144 c) 13 0 ans=(b)

d)the program will cause runtime error

d) none

4) how many times will the following loop be executed? Ch='b'; While(ch>='a' && ch<='z') Ch++; a)0 b)25 c)26 d)1 ans=(b) 5) what will be the value assigned to x,y and z if following statement is executed with input data 1234b5678b9(b denotes blank)? Scanf("%3d %3d %3d ", &x ,&y, &z); a) x=123 y=456 z=789 b)x=123 y=567 z=9 c)x=123 y=4 z=567 d)x=1234 y=5678 z=9

ans= (c) 6) Given the following typedef Union unox{ char cox; uox;} struct mox{ char box; uox lox; fox; } Which of the following will cause acorrect assignment? a) fox.uox.cox='p'; b)fox.lox.cox="pp"; c)fox.lox.cox='p'; d)fox.fox.unox.cox='p'; ans=(c) 7) What is the output of the following program? Main() { int a=0; while(a<5)} sum(a); a++ }} void sum(int a) { static kk; printf("%d ",kk+a); kk++; } a) 02468 ans=(a) b)1234 c)13579 d)12345

8) What is the output of the following program? Int arr[]={1,2,3,4} Main() { int a,*ptr,b,c; a=51%26; ptr=&a; a+=2; b= arr[1]+a; c= *ptr +b; printf("%d %d %d", a,b,c); } a) 25 27 52 b) 27 29 54 c)27 29 54 ans=(d) 9)Consider the following program segment: switch(input)

d)27 29 56

case1: printf("one"); case3: printf("three"); case5: printf("five"); default: printf("odd"); break; } What will be printed when input is '3'? a)three five odd b)three c)three odd ans=(a) 10) Arrays can be initialized only if they are a)automatic b)static c)external ans=(d) January-2000

d)three three odd

d)both b and c

1)Arrays are passed as arguments to a function by a)value b) reference c) both value & reference ans=(c)

d) none of the above

2) It is necessary to declare the type of function in the calling prog. If a) the function returns an integer b) the function returns a non-integer value c) the function is not defined in the same file d) none of these ans=(b) 3) A ststic variable is onea) which can not be initialized b) which is initialized once at the commencement of the execution and can not be changed at the run time. c) Retains its value throughout the life of the program d) Which is the same as an automatic variable ,but is placed at the head of the program ans=(c) 4)What will be the value of count after the following program is executed? Main() { int count, digit=0; count=1; while(digit<=9) { printf("%d\n", ++count); ++digit; } a)10 b)9 c)12 d)11 ans=(d)

5)A switch statement is used to a) Switch between function in a program b) Switch from one variable to another variable c) To choose from multiple possibilities which may arise due to different values of a single variable. d) To use switching variable ans=(c) 6) If the following variable are set to the values as shown below, then what will be the value of the expression following it ? answer=2; marks=10; ! (( "answer<5)&& (marks>2)) a)1 b)0 c)-1 d)2 ans=(b) 7) What should be the value of I and k at the end of the following program segment ? int I,j,k ; { j=5; I=2*j/2; K= 2* (j/2); } a)I=5, k=5 b)I=4 , k=4 c)I=5, k=4 d)I=4 , k=5 ans=(c) 8) What is the value of v1 and v2? Int v1 , v2; Int v=3; Int *pv; pv=&v; v1=2* (v+5); v2=2* (*pv+5); a)v1=16 , v2=16 b)v1=8 , v2=16 ans=(a)

c)v1=16 , v2= 3

d)v1=8 , v2=3

9)Consider the following program fragment. Main() { int a,b,c ; b=2; a=2; a= 2*(b++); c= 2*(++b); } the correct values of a) a=4, c=6 b)a=3,c=8 c)b=3,c=6 d)a=4,c=8 ans=(d) 10)Identify the most appropriate sentence to describe unions.

a) unions are like structure b) unions contain members of different datatypes which share the same storage area in memory c) unions are less frequently used in programs d) unions are used for set operations. ans=(b)

JULY-2000 1) Which one of the following statement is incorrect? a) a compiler compiles the source program. b) An assembler takes an assembly program as input. c) A compiler does the same type of function as interpreter d) None ans=(c) 2) 'c' is a a) completely high level language b) completely low level language c) high level language with low level features d)none ans=(c) 3) An external variable is one a) Which is globally accessible by all function b) Which is declared outside the body of any function c) Which resides in the memory till the end of program d) All of the above ans=(d) 4) Study the following c program #include<stdio.h> main() { int I, n=2; for(I=0;I<e;I++) { if(!(I<=n)&&(++n==I)) n=n+2; else n=n-2; } } what will be the value of n after the execution of the above progran? a)3 b)2

c)4 ans=(a) 5.

d)none of these

study the following c prigram: #include <stdio.h> #<- define F(a,b) (a+b) *(a*a+2*a*b+b*b) main() { int I,j,sum; I=j=sum=1; For(I=0;I<2;I++) Sum=sum+f(I,j); Printf("\nsum=%d",sum); } what will be the nalue of variable sum after execution of above program? a)1 1 b)12 c)10 d)none of these ans=(c)

6.

study the following c program: #include<stdio.h> main() { int a,*b=&a, **c=&b; a=2; **c=2; b=(int*) **c; printf("A=%d,B=%d",a,*b); } what will be wutput of the above program? a)A=2,B=1 b)A=2,B=2 c)A=2,b=0 d)None of these ans=(d)

7.

study the following 'c' program:#include<stdio.h> mein() { int sum=1;count-1; do { Count --; Sum=3 * sum; While (count >5); }

} What will be the value of the variable snm after the execution of the variable sum after the execution of above program? a)1 b)0 c)3 d)None of these ans=(c) 8. study the following statements: #include <stdio.h> #include<string.h> main() { char *st1.*st3, *st3; st1="India is My", st2="!!Yrtnuoc", st3="Gujarat"; clrscr(); Strncat (St1, strrev(st2),strlen (st3)); Puts (st1); } What will be the output of the above program? a) India is my country b) India is my Gujrat c) India is my coumtry!! d) None of these ans=(a) 9. Recursive function are executed in a. Last in first out order b. First in last out order c. Parallel fashion d. Any of the above. ans=(a) 10. study the following C program: #include<stdio.h> int a,I=4,fsum=0; main() { for(;I>0;--I) fsum = fsum + fact(i); } fact(i) {

if(I==1) return (1); else return (I* fact (I-1)); } what will be the value of fsum after the execution of the above progran? a)35 b)32 c)33 d)None of these ans=(c) January-2001 1)what is the correct way to declare to pointer? a)int_ptr x; b)int *ptr; c)*int ptr; d)none of these ans=(b) 2) If you want to exchange two rows in a two dimensional array,the fasrest way is to: a) exchange the elements of the two rows. b) exchange the address of each element in the two rows c) store the addresses of the rows in an array of pointers and exchange the pointers d) none ans=(c) 3) A typecast is used to: a) define a new datatype c) rename an old type ans=(b) b) force a value to be of a particular variable type d) none

4)what will be the output of following 'c' program? #include<stdio.h> #include<conio.h> #define f(x,y) x*y-y*y+1 #define g(x,y) f(f(1,-1),f(1,-1)) void main() { int dif; dif=f(1,-1)+g(1,-1); printf("\n The difference is =%d",dif); } a) The difference id =12 b) The difference is = -1 c) The difference is =1 d) None of these ans=(d) 5 operator precedence determines which operator a) Operates on the largest numbers. b) Is used first

c) Is most important d) None of these ans=(b) 6 If you don't initialize a static array, what will be the elements set to? a) zero b) an undetermined value c) a floating pointe number d) none of these ans=(a) 7 What will be the output of the following 'C' program? #include<stdio.h> main() } int *I,*j,a=12,b=2,c; c=a=(a+b,b=a/b,a=a*b,b=a-b); i=&c; printf("%d",--(*I)); } a) 93 b)92 c) 91 d)90 ans=(d) 8 Which is more appropriate for reading in multi-word string? a) gets() b) printf() c)scanf() d) puts() ans=(a) 9 Study the following program to reverse any given string of maximum length 80. #include<stdio.h> #include<string.h> void main() { char ch,st[80]; int j,len; gets(st); len=strlen(st); for(j=0;j<len/2;j++) { ch=st[j]; ----------------statement S1------st[len-j-1]=ch; } } To complete the above program, choose the appropriate expressions that is required as statement S1. a) st[j]=st[len-j-1]; b) st[j]=[len-j+1]; c) st[j]=st[len+j+1] d) none of these ans=(a) 10 Study the following program;

#include<stdio.h> void main() { int a[3][3]={8,7,6,5,4,3,5} printf("%d",(a[2][0]>a[0][0]?a[0][2]:a[2][2]); } the output of the above program is a) 8 b) 7 c) 6 d) none of these. ans=(d)

July 2001
the process of translating a source program into fan equivalent target language is not a funtion of : a. Compiler b. Translator c. Assembler d. None of these ans=(b) 2 Study the following statements: i. Continue statement may also be used in a for loop. ii. Bread statements may also be used in if statement. Pick out the most correct answer from the following. a. Only statement (i) is correct b. Only statement (ii) is correct c. Both statements are correct d. None of these ans=(a) 3 Study the following C program: #include<stdio.h> #include<string.h> main() { char *s1="overly", *s2="butter"; strcpy(s1,strcpy(s1,s2),3); strnset(s1,77,1); puts(s1); } what will be the output of the above program? a) mut b) mutter c) butter d)none of the these ans=(d) 4 The ternary operator(? :) and size of operator have: a) Same associativity b) Different associativity c) No associativity d) None of these ans=(a) 1

Study the following C program : # include<stdio.h> void main() { int a=7,b=5; switch(a/a%b) { case 1: a=a-b; case 2: a=a+b; case 3: a=a*b; case 4: a=a/b; default: a=a; } } on the execution of the above program, what will be the value of the variable a? a)7 b)5 c)2 d)none ans=(a) 6) indicate which of the following is not true about 'C' operators: a)operators must have one or more operands b) operators are either unary or binary c) operators have some precedence d) operators have some associativity. ans=(b) 7) function arguments can be a) a structure member b) a pointer variable c) a complete structure d) all of the above ans=(d) 8)study the following C program: #include<stdio.h> void main() { static a,b; while(A>b++); } what will be the value of a and b on the execution of above program? a)a=0,b=1 b)a=0,b=0 c)a=1,b=1 d)none of these ans=(a) 9) A "switch" statement is used to: a) switch between user defined function in aprogram b) switch from one variable to another variable c) jump from one place to another in a program d) none of these ans=(d)

10) study the following C program: #include <stdio.h> void main() { int a=0; for(; a ;); a++; } what will be the value of the variable a, on the execution of the above program? a)-1 b)0 c)1 d)none of these ans=(c) January-2002 1)consider the following statements int a=2,b=3,c=4; a=(b++) +c; b= a+ (++c); what are the value of a,b and crespectively? a) 8,12,5 b)8,13,5 c) 7,12,5 d)7,11,5 ans=(c) 2)consider the following code fragment int a,c; c=2; a=(c+=5)*2 what will be the value of the "a" after the above lines are executed? a) 10 b) 14 c) 12 d)the second assignment statement is syntactically incorrect ans=(b) 3) consider the following program int f(int x) { static int y; y += x; return (y); } main() { int a,I; for(I=0;I<6;I++) a=f(i); printf("%d", a); } what would be printed if the above program is run? a)6 b) 8 c) 10 d) 15 ans=(d) 4) consider the following function int f(int x) { int I,j=0 ;

return 1; for(I=0;I<x/2;I++) j += f(i); return j; what is the result of invoking f(4)? a) 0 b) 1 c)2 d)3 ans=(b) 5) consider the following statements int a[5]={ 2,3,4,1,9}; int *pb = a; int I=4; which of the following is not a valid statement in "C"? a) * (pb +3) = 9; b) pb[3]; c)pb =pb+2; d) pb=pb*1; ans=(d) 6) what is the result of executing the folloeing "C" expression? -(-0<<4) a)an integer whose right most four bits are one and and all other bits are zero. b) an integer whose right most four bits are zero and and all other bits are one. c)an integer whose left most four bits are one and and all other bits are zero. d)none of the above ans=(d) 7) consider the followinf code fragment. Struct xyz { char *s; inti; }; struct xyz a,b; a.s= (char *) malloc (6); strcpy(a.s, "hello"); b=a; b.s[0]='H'; printf("%s", a.s); what would be printed? a) there will be a runtime error b) hello c)Hello d) there is a syntax error ans=(c) 8) study the following code. Main() { char *p= NULL; strcpy (p, ""); printf("%s/n", p); } what will be printed if the above program is run? a) NULL b) Undefined c) compiler can not recognize "in the stropy function" d) run time error as "p" has not been allocated. ans=(b)

9) which of the following expression would correctly add just 4 to a pointer "p" pointing to an element of type "struct abc"? a) p+ 4 b) (struct abc *)(( char *) p+4) c) (struct abc *)((void *)[ + 4) d) more than one of the above ans=(a) 10)which of the following is returned by the function "strcmp" if the strings that are compared are identical? a)0 b) 1 c) 2 d) true ans=(a) JULY-2002 1) The conversion specification character for signed decimal integer is a)c b)o c)I d) none of these ans=(c) 2) The statement scanf("%5cs",str) reads a) maximum 5 characters b) minimum 5 characters c) exactly 5 characters d) none of these ans=(a) 3) C compiler traps a) logical errors c) both a&b ans=(b) b)syntax errors d) none of these

4)A pointer is a) address of variable b) a variable for storing address c) an indication of the variable to be accessed next d) none of these ans=(b) 5) You cannot use command-line arguments in a program that involve a) structure b) file handling c) string d) none of these ans=(d) 6) Which mode is used to open a file for reading and writing a) r+ b) w+ c) both a & b d) none of these ans=(c) 7) An enumeration is a data type a) similar to file b) similar to many c) similar to pointer d) none of these ans=(b) 8)Which of the following is not a library function a) isprint() b) isxdigit() c) isspace() d) none of these ans=(d)

9) Which library function returns number of seconds elapsed beyond a designated base time a) time() b) ctime() c) stime() d)none of these ans=(a) 10) The default value 1 is initialized in a) local variable b) static variable c) external variable d) none of these ans=(d) Extra practice sets Set-A 1) 'C' is a language mostly used for a) scientific application b) business applications c) none of above d) all of above 2) The result of the expression x=2/3+5*9 is a) 5 b)10 c) 45 d) none of above 3) The || operator is used for a) And b) Or c) Not 4)The && operator is used for a) And b) Or c) Not 5)The ! operator is used for a) And b) Or c) Not d) Ternary d) none of these d) none of above

6) In 'C' language reserved word is also known as a) operator b) keyword c) character d) none of these 7) In 'C'++ is a)Unary operator b) Binary operator c) none 8) Switch is used for a) To be switching between function in a program b) To be switching variables c) To switch from one variable to another d) To choose one option from multiple options 9) The operator x<<2 is equivalent to a) x=x*4 b) x= x*2 c) x = x+4 D) x = x+2 10) if x=-11 , y= -3 ; the result of x%y will be a) 3 b) 3 c)-2 d) 2 SET-B 1) The statement used to exit from a loop is a) break b) continue c) exit 2) The conversion specification for string is a) %d b) %c c) %s d) %f d) both a & b

d) none

3) The conversion specification for character is a) %d b) %c c) %s d) %f 4) The conversion specification for integer is a) %d b) %c c) %s d) %f 5) The conversion specification for float is a) %d b) %c c) %s d) %f 6) The operator used to access the members of a structure is a) dot b) comma c) colon d) semicolon 7) malloc() function is used for a) dynamic memory allocation b) static memory allocation c) both a& b d) none of a & b 8)the statement used to quit one of statement in switch a) break b) continue c) exit d) all of the above 9) To perform string operation , the header file needed is a) string.h b) conio.h c) stdio.h d) ctype.h 10) '\0' denotes a) null character b) end of file c) end of line d) none of these SET-C 1) What will be the value of I & k after execution { int I , j , k; j=5; I= 2*j/2; K=2*(j/2); } a) I=5,k=5 b) I=4,k=4 c) I=5,k=4 d)I=4,k=5 2)In case of ordinary int variables a) the leftmost bit is reserved for sign b) the rightmost bit is reserved for sign c) no bit is reserved for sign d) none of above 3) Recursive functions are executed in a a) last in first out order b) first in first out c) first in last out order d) a and c 4)The scope of local variable is A) throughout the program b) within a function, it is defined c) sometimes a and sometimes b d) neither a nor b 5) Arrays can be automatically initialized if they are a) static b) automatic c) external d) none of these 6) The meaning of declaration is enum days { Sunday=5,Monday} a) Sunday =5,monday=6 b) Sunday =0,monday=1 c) Sunday =4,monday=5 d) None of above 7) The size of structure is struct st

int a; char b[5]; }st1[10]; a) 70 b) 7 c) 17 d) none of these 8) The correct way to call for the following is struct a1 { int a11; char a12[5]; }a10; struct b1 { int b11; char b12[5]; struct a1 a3; }struct b3; a) b3.a3.a11 b)a11 c)a3.b3.a11 d)none of these 9) What is the output of program if input is 'x'? main() { int lower , up; up = getchar(); up = toupper(lower); putchar(up); } a) 7 b)x c)x d) none of these 10) The ascii code of 'A' is a)65 b)97 c)67 d)95 SET-D 1) The return statement is A) Optional C) a and b B) Compulsory D) None of these

2) The function which calls itself :A) Recursive function B) Library function C) External function D) None of these 3) To close a file we use A) Fclose C) FCLOSE 4) The statement Char a='a' Printf("%d",a); Will print A) 97 C) 90 5) is a :B) Fopen D) FOPEN

B) 65 D) None of these

A) Unary operater C) Ternary operator 6) int a[5] ={1,3,5,7,9} printf("%d",a[2]); will print the value A) 3 C) 7 7) int a=0,b=0 b=++a; printf("%d",++b); will print the value A) 0 C) 2 8) a++is equivalent to ++a A) Yes B) No C) Some times a, some times b D) None of these

B) Binary operator D) None of these

B) 5 D) None of these

B) 1 D) None of these

9) The * and /, binary operators have A) Different precedence B) Same precedence C) Depends upon the associativity D) None of these 10) What would be the value of C? {int C; float a,b; a=25.05; b=10.02; c=a+b; printf("%d",c); A) 35 B) 35.07 C) 35.0 D) none of these SET-E 1) To allocate the dynamic memory we use a) malloc b) calloc c) both a& b 2) To open a file we use a) fopen b) fclose c)FOPEN 3) Linked list uses

d) none of above d)both a & c

a) dynamic memory allocation b) static memory allocation c) any of above d) none of a & b 4) The function which returns nothing can be declared as a) int b) void c)float d) all of above 5) The structure is a a) user defined datatype b) system defined datatype c) both a & b d) none of these 6) The header file necessary to do mathematical calculation a) conio.h b) math.h c) stdio.h d)string.h 7) How many times will be loop be executed do { x=5; if (x==1) { x=x+1; } }while(x>=5); a) 1 b)2 c) infinite time d) none 8)The size of character is a) 1 byte b) 2 bytes c) 4 bytes d) 8 bytes 9)An array is stored in a) different location b) contigous locations c) none d) both a and b 10) Arrays are passes as argument to function by a) value b) reference c) both a & b d) none ANSWERS SET-A 1) D 2) C SET-B 1) A 2) C SET-C 1)C 2)A SET-D 1) A 2)A SET-E 1) C 2)A JULY-1999 Q2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and record in the "tear off" sheet attached to the question paper. 1) Adding a constant value to a pointer is permissible ,but addition of two pointers (of the same type) is not. 2) The C language does not support recursion. 3) A static variable can not be initialized. 4) The name of array represents a address. 3) B 3) B 3)D 3)A 3) A 4)A 4)A 4)B 4)A 4)B 5)C 5)D 5)A 5)A 5)A 6)B 6)A 6)A 6)B 6)B 7)A 7)A 7)A 7)C 7)C 8)D 8)A 8)A 8)A 8)A 9)A 9)A 9)C 9)A 9)B 10)C 10)A 10)A 10)B 10)B

5) C does not support call-by-value but support call-by-reference. 6) There is no difference between the functions malloc() and calloc() both are used to allocate memory 7)The function gets() does not include the terminating newline character,but the fgets()function does. 8) A structure cannot be passed to a C function through call by value mechanism. 9) There is no limit to the number of files that a single C program can open. 10) The following two code fragments perform exactly the same task. i) While (*p)p++; ii) while(*p++);
ans=1)False 2)False 3) False 4) True 5) False 6)True 7) True 8) False 9) True 10) True

JANUARY-2000 1)All function in C have return an integer or a character value. 2) Static variables are nothing but global constant. 3) Typedef is a facility in C for specifying new datatypes. 4) Arrays cannot be returned by functions, however pointer to arrays can be returned. 5)The continue statement is used to skip some statements within a loop and start next iteration. 6) It is not possible to have a switch statements nested within while or for loops. 7) A union can not be a member of a structure. 8) Relational operators have higher precedence than arithmetic operators. 9) The statement x=x<<2; is equivalent to the statement x=x*4; 10) The fscanf function can take variable number of arguments.
Ans=1) False 2) False 3) True 4)True 5) False 6) False 7) False 8) False 9) True 10)True

JULY-2000 1) In C the bitwise operators can be applied to integer type operands only. 2) A file can be rewound by the following statement fseek(fp, ol, o) 3) A file can contain the null characters as part of its actual data , whereas a string can not. 4) The statement char (*( *z())[])(); indicates that 'z' is function returning a pointer to an array of pointers to function returning char. 5) In a C program ,header may be included in any order any number of times. 6) Void file copy (FILE* , FILE*); is avalid function declaration statement. 7) The conversion specification %h is used to read values in hexadecimal format. 8) An if statement may contain compound statements only in the else clause. 9) It is possible to declare and initialize on array in 'C' simultaneously.

10) A pointer variable can be at most two level deep.


Ans=1) True 2)True 3) True 4) True 5)True 6) True 7) True 8) False 9) True 10) False

January-2001 1) The bitwise operators treat all variables as either true or false. 2) It is possible to pass a structure to a function in the same way a simple variable is passed . 3)The exit() function causes an exit from a function. 4)The address of an array is a pointer constant 5)Passing a value to a function places the address of that value in the functions private memory space. 6) A function operates on a integer array passed to it as an argument by placing the value of that array into a separate place in memory known only to the function. 7) the function puts () always adds a '\n' to the end of the string it is prtinting. 8) A function can still be useful even if you can't pass it any information and can't get an information back from it. 9) To return from a function you must use the keyword return. 10) The address operator(&), is the inverse of the de-referencing operator(*)
Ans=1) True 2)True 3) false4) True 5)True 6) True 7) True 8) True 9) False 10) False

JULY- 2001 1) Redirection is given input to a program beside the keyboard. 2)Pre-increment operator and post-increment operator has some effect, while using the on the right side of an expression. 3)A union consist of a number of elements that all occupy the same apace in the memory. 4)NULL is defined in <ctype.h> 5) 'C' allows mixing of float and integer in arithmetic expressions. 6) A cast is a binary operator and has the same precedence as the other unary operators. 7) If no value is to be returned, the return statement need not be written. 8) The function puts() always adds a '\n' to the end of the string. 9) The break statement tells the compiler "SKIP THE FOLLOWING STATEMENT AND CONTINUE WITH THE NEXT OPERATION". 10) A register is a variable and expected to be placed in machine register.
Ans=1) True 2) false 3) True 4) false 5)True 6) false 7) True 8) false 9) True 10) True

JANUARY-2002 1)Type cast is a unary operator. 2)Arrays in "C" language are always stored in row-major fashion. 3)"Static" variables may also be declared "extern". 4)The condition (c=5) is always true; 5)Size of variables of type "long" may always be greater than size of variables of type "inf". 6)Two pointers of the same type may not be subtracted. 7)"default" case is mandatory in a "switch" statement.

8)The function "fopen" takes only two arguments-a file pointer and representing the name of the file to be opened. 9)"*p++" increments the integer pointed to by "p". 2.10"(a==5)? A=6;" is not a valid "C" statement. Ans=1) True 2) True 3) false 4) True 5)True 6) false 7) false 8) false 9) True JULY-2002 1) Static variable will always have assigned value. 2) Single operations involving entire arrays are not permitted in C. 3) You can call function main() from any other function 4) The statement "for(;;);" in perfectly valid 'C' statement. 5) When a user defined function is defined in program, than we have to call that function at least once. 6) Union is used to hold different data at different time. 7) Pointer to integer can hold pointer to char. 8) You can use only one break statement in one loop. 9) You can declare array of size 50012 in a C program on DOS platform. 10) Expression 3**2 evaluates to 9.
Ans=1) True 2) True 3) false 4) false 5) false 6) True 7) True 8) false 9) True 10) True

EXTRA PRACTICE SET FOR TRUE OR FALSE SET-A 1) MAIN() function is must condition to write a 'C' language program. 2)floating point numbers have a fractional portional. 3) 5%2 gives result 2 4) 5/2 gives result 2 5) 5%2 gives result 1 6) 5/2 gives result 1 7) || is used for OR logical operator 8) && is used for AND logical operator 9) + is a unary operator 10) ++ is a binary operator in C language SET-B 1) ;(semi-colon) is used in for loop. 2) ,(Comma) can also be used in for loop under some special condition. 3) While loop ends as while(condition) ; 4) do-while loop ends with a semi colon 5) The character has a size of 1 byte. 6) We can store 305.9 in integer type variable 7) C language is object oriented language. 8) Structure are user defined datatypes. 9) Compiler converts the statements/syntaxes into m,achine language (compiles it) line by line.

10) C language is used for making business applications , scientific tasks. SET-C 1) We can use switch statement in place of if-else. 2) When we initialize an array as static, it get automatically initialized to zeros. 3) The recursive function calls itself. 4) The reserved words are also known as keywords. 5) The keywords can also be used as variable name. 6) The file is opened by fopen(). 7) To close a file in C, we use FCLOSE(). 8) To close a file in C , we use fclose(). 9) +,-,*,/ are binary operators. 10) = is assignment operator. SET-D 1) int a[3][3] is a three dimensional array. 2) int b[4][4] is a two dimensional array. 3) int *p is a pointer of integer type. 4) scanf() statement is used to read from a file. 5) printf() statement is used to print to a file. 6) We can use fprintf() to print the data into file. 7) We can use fscanf() to read from a file. 8) The symbol = = is assignment operator. 9) <math.h> , <stdio.h> both are the header files and have same functions in them. This means anyone can be used in place of any other. 10) The ++ operator increments the value of variable by 2. SET-E 1) In C language <dos.h> is a header file. 2) The symbol \n is used for new line. 3) The symbol \t is used to skip a tab. 4) Ternary operators uses three operands to do the job. 5) In the 'C' language , the statement ends with a semicolon symbol. 6) GOTO statements must not be frequently use in a good program. 7) X<<2 is same as x=x*4; 8) Array a[10] store ten integer values from 1 to 10. 9) Array subscript runs from 0 to 9 in an array. 10) The file created through 'C' program can not have integers as input. ANSWERS SET-A 1) True 7) True SET-B 1) True 7) False

2) True 8) True 2) True 8) True

3) False 9) False 3) False 9) False

4)True 10) False 4)True 10) True

5) True 5) True

6) False 6) False

SET-C 1) True 7) False SET-D 1) False 7) True SET-E 1) True 7) True JULY 1999

2) True 8) True 2) True 8) False 2) True 8) False

3)True 9) True 3) True 9) False 3) True 9) True

4)True 10) True 4)False 10) False 4)True 10) False

5) False 5) False 5) True

6) True 6) True 6) True

Q3. Match the words and phrases in col. X with the closet related word in col. Y. X 1. While 2. Goto statement 3. Fread () and fwrite () 4. W+ and r+ 5. Strcpy (s1, s2) 6. Size of 7. int p[10], a; p = &a; 8. main(int argc, char *argv[]) 9. #define sqr (x) x*x 10. The operator &
Ans=1)I 2) G 3) B 4) A 5) K 6) H 7) J

Y Modes for opening files Standard I/O library Compile-time operator Command- Line arguments Macro Reading and writing structures Should be avoided, as far as possible Bit manipulation Infinite loop Illegal in C Strings library
8) D 9) E 10) C

JANUARY-2000 X 1. While(0) 2. for(;;) { I=2; } 3. While (*pb ='\0') p++; 4. int (*(p())) 5. In a sorting program, for the sake of generality , a programmer decided to use functions for comparing keys 6. In a sorting program, for the sake of generality , a programmer decided to use macros for implementing the code for Y a) P is a pointer to a function that returns a pointer to integer b) assignment never take place. c)Output character to screen d) Occupy 20 bytes of memory e) does not append a new line character f) assignment operationtakes place in an infinite loop.

comparison of keys 7. Puts() 8. fputs() 9. int a[2]; float x,y; char b[8]; 10. Automatic variables
Ans=1)B 2) F 3) G 4) A 5) H 6) J

g)P is a pointer to a character string h)run time overhead is significant i) scope till the end of the function in which declared j) Runtime overhead is minimal and hence a desirable strategy.
7) C 8) E 9) D 10) I

JULY-2000

X 1. To issue DOS commands 2. int(*p)[25] 3. '\0' 4. isalpha() 5. << 6.operations on register 7. && 8. malloc() 9. int *p[25] 10. 5%3 * 5/3 integer pointer

Y a) <string.h> b) address operator c) are slower d) 3 e) <stdlib.h> f) <ctype.h> g)5 h)bitwise left shift i) character with value () j) system() k) is a pointer to an array of l) are faster m) bitwise AND operator n) p is a pointer to an array of integers

Ans=1)J

2)N

3) I

4)F

5) H

6)L

7) M 8) E 9) K

10)D

JANUARY-2001 X 1.address operator 2. #undef 3. 1/1>1%1 4. switch 5. <stdio.h> 6.#define Y a) <string.h> b) binary operators c) user defined datatype d) double quote e) zero f) single quote

7.string 8. 5>3?3>2:2>3 9. typedef 10. character constant

g) non-zero h) undefines a macro i) <conio.h> j) unary operator k) NULL l)default m) structure n) defines a macro
6)N 7) D 8) G 9) C 10) F

Ans=1)J

2) H 3) B 4) L 5) I

JULY-2001

X 1. ispunct() 2. function calling 3. a symbolic constant 4. global variable 5.Array 6. Storage management 7. Switch statement 8. Continue statement 9. typedef 10.Function definition

Ans =1) D

2) A

3) H 4) O

5) J

Y a) Actual argument b) User defined data type c) Formal arguments d) < ctype.h> e) Command- line argument f) Preprocessor command g) Limited scope & lifetime h) #define i) <string.h> j) subscript k) malloc() l) Are automatically initialized by compiler. m) loop n) Default option o) greater scope &lifetime. p) Are not automatically initialized by the compiler. 6) K 7) N 8) M 9) B 10) C Y a) Printf b) 2 c) Int d) Struct e) Call be teference f) Typedef g) Machine dependent h) Main

January-2002 X 1.Variable record 2. Premature loop termination 3. Size of "int" variables in bytes 4. Parameter passing machanism in 'C' 5. Data type whose size in always 1 byte 6. Return type of "getc" function 7. variable argument list function 8. Dynamic memory allocation with

initialization 9. Creation of a new type 10.Program execution termination

Ans=1)D JULY-2002

2) L

3) G

4) N 5) I

i) Char j) Calloc k) Mallic l) Break m) Alloc n) Call be value o) Union p) exit 6) C 7) E 8) J 9) F 10) P

X 1. int *f() 2. int (*f)() 3. getchar() 4. long double a[3] 5. isodigit(c) 6. scant("*s",str) 7. char (*day)[13] 8. char *day[13] 9. union {int a[2]; float x,y; char b[12]; } 10. gets(str)

Y a) To get multiword string b) Pointer to array of type char c) Pointer to function returning int d) Occpies 24 bytes of memory(on DOS) e) Function returning pointer to array of int f) Function returning pointer to an array of pointer to int g) It is a macro h) Occupies 30 bytes of memory (on DOS) i) Library function

Ans=1)M

2) C

3) N 4) D

5) I

j) To get single word string k) Occupy 28 bytes of memory (on DOS) l) Array of pointer to char m) Function returning pointer to int n) Returns next character from stdout o) User-defined function p) Pointer to pointer to int 6) J 7) B 8) L 9) H 10) A

EXTRA PRACTICE SETS X 1)While(*x!='\0') x++; x++; 2) while(*x!=NULL) x++; 3) int (*x)[10] 4) int *x[ 10] 5) int(*x) (void *, void*) 6) int *x (void *, void*) 7) int (*x[5] ) 8 Y

Table 1

Q4. Each statement below has a blank space to fit one of the wordsin the list given below. 1) Data files are closed in C programs by using the .. library function. 2) Storage for storing a structure type variable is allocated at . time. 3) . refers to the passing of a variable's address to a function without creating any local copy in the called function. 4) When the . Statement is executed, the program skips the remaining statements in the loop and goes back to test the loop condition. 5) The operators can be used for obtaining the of a variable. 6) The function sprintf() places the result in instead of an standard output. 7) The .. function is used to compare two character strings. 8) . variables are the ones that are heavily used. 9) The function .. indicates the end of the file condition for a stream-oriented data file. 10) To share a variable across different files, the storage class is used. Ans=1)fclose() 2)compile 3) call-by-reference 4)continue 5)one's complement 6)string 7) stremp() 8) structure 9)feof 10) external JANUARY-2000 1) On executing F=!(I>10), F will have values . 2) Array elements can be accessed . 3) All characters are represented internally as ..

4) The operator size of returns size of datatype in .. 11) A pointer to void can hold pointer to 12) Each pointer is . To the type of variable to which it points. 13) In C while is word. 14) The function sprintf is meant for formatted write to a memory 15) # is a preprocessor directive for . Compilation. 16) In a c-expression with mixed datatypes containing variables of the float and double the result is of the type Ans= 1)one or zero 2) randomly 3) integers 4) bytes 5) string 6) bound 7) reserved 8) buffer 9) conditional 10) double JULY-2000 1) A character constant is a sequence of one or more characters enclosed in . Quotes. 2) An variable comes into existence when the function in which it is declared is executed. 3) An . consists of one or more constant , variables ,function calls or operations. 4) If numeric or single-character information is being entered by means of scanf() function .. symbol must precede the corresponding variable name. 5) is technique whereby a function calls itself. 6) The logical operator == checks for . of two values. 7) A statement is used to choose from multiple possibilities which may arise due to different values of a single variables. 8) The condition (o|| 1 && 1 &o) will give result as value. 9) The statement puts (Strset("Test",65)); will give result as value. 10) Operators & ,^, == have .. precedence. Ans=1)single 2)auto 3)expression 4)& 5)recursion 6)equality 7)switch 8) false 9)Te 65 10) different January-2001 1) If we define an array in a function with . class, we cannot pass the address of that array back to the main of subsequent work. 2) .. enables the programmer to divide the program into smaller, more easily managed segment. 3) The .. statements tells the computer "SKIP THE FOLLOWING STATEMENTS AND CONTINUE WITH THE NEXT OPERATION". 4) The unary address operator(&) and de-referencing operator(*) have precedence. 5) If a function calls another function,which in turn makes a call to the first one ,the recursion is said to be 6) Multiple increment expression in a for loop expression are separated by. 7) The logical operator .. checks for quality of two values. 8) "C" has a built-in multiway decision statement known as a .. 9) 1/1%1/1+2 will result in 10) The expression (1>2?3>4?1:2:3)will produce as a result.

Ans=1)auto 2) function 3)continue 4)3 5)indirect 6)semicolon 7)= = 8)switch 9)2 10)3 JULY-2001 1) Unless a variable is defines, it be used in an arithmetic expression. 2) The rand() function is defined in .. 3) Logical AND(&&)operator has a precedence than logical OR(||) operator. 4) Using . statement one can execute the body part of it , at least once. 5) A is a variable that may hold (at different times) objects of different type 6) logical operators can only be applied to integer operands. 7) The following 'C' expression (3>>2)>(3<<2)? 0:1 evaluates to the value of . 8) . Permits a group of related variable to be treated as an unit instead of as separate entities . 9) The operator (&) can not be applied to a object. 10) A is used to separate the three part of the loop expression in a for loop . Ans= 1)cannot 2) <math.h> 3)higher 4)<stdlib.h> 5)union 6) bitwise 7)1 8)structure 9) bitfield 10)comma JANUARY-2002 1) Value of "argc" in the prototype of the function "main" given by "int main(int argc, char ** argv)" is always at least 2) If "p" is a pointer to a structure then "p->" is the same as .. 3) Pointer to a list of arrays of 25 integers may be declared as . 4) Example of an infinite loop is 5) .. is an example of a loop that would never be executed . 6) Code enclosed in "#if" and "#end if" is never compiled . 7) is a storage class specifier of data types . 8) The result of right shifting of numbers is machine dependent . 9) Number of bytes occupied by a zero terminated string "a" is 10) Scope of a static variable defined outside any function is . Ans= 1)1 2)(*p) 3)int(*p)[25] 4)while(1){} 5)for(;o;){} 7)auto 8)signed 9)2 10)global JULY-2002 1)The .. operator is used to set a particular bit of operands . 2) If a function does not have return type then it is assumed to a value of type ... 3)If a main() contains arguments then such a argument is called as 4) The size if signed integer is . Bytes. 5) The conversion specification character for long double is . 6) operator is used to refer content of pointer variable . 7) One-way pointers are useful to refer to a memory address that has no 8) Nesting can be done upto level for while loop . 9) The expression 11&3 evaluates to 10) The function fopen() on failure returns Ans= 1)& 2)int 3)command-line 4)2 5)%1f 6)* 7) name 8)3 9)11 10)null

Potrebbero piacerti anche