Top Banner

of 31

csolutin

Apr 14, 2018

Download

Documents

Anurag Goel
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/30/2019 csolutin

    1/31

    JULY-99

    Q1.Each question below gives a multiple choice of answers.Choose the most appropriateone 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)343ans=(b)

    2) if( "india"=="india")printf("equal");else

    printf("unequal");What will be printed by the above code?a)equal b)unequal c)India d)the program will cause runtime error 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 d) noneans=(b)

    4) how many times will the following loop be executed?Ch='b';While(ch>='a' && ch

  • 7/30/2019 csolutin

    2/31

  • 7/30/2019 csolutin

    3/31

    { 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 d)three three oddans=(a)

    10) Arrays can be initialized only if they area)automatic b)static c)external d)both b and c

    ans=(d)

    January-2000

    1)Arrays are passed as arguments to a function bya)value b) reference c) both value & reference d) none of the aboveans=(c)

    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 valuec) the function is not defined in the same filed) none of these

    ans=(b)

    3) A ststic variable is one-a) which can not be initialized

    b) which is initialized once at the commencement of the execution and can not bechanged at the run time.

    c) Retains its value throughout the life of the programd) Which is the same as an automatic variable ,but is placed at the head of the

    programans=(c)

    4)What will be the value of count after the following program is executed?Main(){ int count, digit=0;

    count=1;while(digit

  • 7/30/2019 csolutin

    4/31

    5)A switch statement is used toa) Switch between function in a program

    b) Switch from one variable to another variablec) To choose from multiple possibilities which may arise due to different values of a

    single variable.

    d) To use switching variableans=(c)

    6) If the following variable are set to the values as shown below, then what will be thevalue of the expression following it ?

    answer=2;marks=10;! (( "answer2))

    a)1 b)0 c)-1 d)2ans=(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=5ans=(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 c)v1=16 , v2= 3 d)v1=8 , v2=3ans=(a)

    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.

  • 7/30/2019 csolutin

    5/31

    a) unions are like structure b) unions contain members of different datatypes which share the same storage

    area in memoryc) unions are less frequently used in programsd) 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 languagec) high level language with low level featuresd)none

    ans=(c)

    3) An external variable is onea) Which is globally accessible by all function

    b) Which is declared outside the body of any functionc) Which resides in the memory till the end of programd) All of the above

    ans=(d)

    4) Study the following c program#includemain(){int I, n=2;for(I=0;I

  • 7/30/2019 csolutin

    6/31

    c)4 d)none of theseans=(a)

    5. study the following c prigram:#include

    #

  • 7/30/2019 csolutin

    7/31

    }What will be the value of the variable snm after the execution of the variable sumafter the execution of above program?a)1 b)0c)3 d)None of these

    ans=(c)

    8. study the following statements:#include #includemain(){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 Gujratc) India is my coumtry!!d) None of these

    ans=(a)

    9. Recursive function are executed ina. Last in first out order

    b. First in last out order c. Parallel fashiond. Any of the above.

    ans=(a)

    10. study the following C program:#includeint a,I=4,fsum=0;main(){for(;I>0;--I)fsum = fsum + fact(i);}fact(i){

  • 7/30/2019 csolutin

    8/31

    if(I==1)return (1);elsereturn (I* fact (I-1));}

    what will be the value of fsum after the execution of the above progran?a)35 b)32c)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 isto:a) exchange the elements of the two rows.

    b) exchange the address of each element in the two rowsc) store the addresses of the rows in an array of pointers and exchange the pointersd) noneans=(c)

    3) A typecast is used to:a) define a new datatype b) force a value to be of a particular variable typec) rename an old type d) none

    ans=(b)

    4)what will be the output of following 'c' program?#include#include#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 = -1c) The difference is =1 d) None of theseans=(d)

    5 operator precedence determines which operator a) Operates on the largest numbers.

    b) Is used first

  • 7/30/2019 csolutin

    9/31

    c) Is most importantd) None of theseans=(b)

    6 If you don't initialize a static array, what will be the elements set to?

    a) zero b) an undetermined valuec) a floating pointe number d) none of theseans=(a)7 What will be the output of the following 'C' program?#includemain()}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)92c) 91 d)90ans=(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#includevoid main(){char ch,st[80];int j,len;gets(st);len=strlen(st);for(j=0;j

  • 7/30/2019 csolutin

    10/31

    #includevoid 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 isa) 8 b) 7 c) 6 d) none of these.ans=(d)

    July 20011 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 theseans=(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 themost correct answer from the following.

    a. Only statement (i) is correct b. Only statement (ii) is correctc. Both statements are correctd. None of these

    ans=(a)

    3 Study the following C program:

    #include#includemain(){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 theseans=(d)

    4 The ternary operator(? :) and size of operator have:a) Same associativity b) Different associativityc) No associativity d) None of theseans=(a)

  • 7/30/2019 csolutin

    11/31

    5 Study the following C program :# includevoid 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)noneans=(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 binaryc) operators have some precedenced) operators have some associativity.ans=(b)

    7) function arguments can bea) a structure member

    b) a pointer variablec) a complete structured) all of the above

    ans=(d)

    8)study the following C program:#includevoid 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 theseans=(a)

    9) A "switch" statement is used to:a) switch between user defined function in aprogram

    b) switch from one variable to another variablec) jump from one place to another in a programd) none of these

    ans=(d)

  • 7/30/2019 csolutin

    12/31

    10) study the following C program:#include 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 theseans=(c)

    January-2002

    1)consider the following statementsint 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,5ans=(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) 14c) 12 d)the second assignment statement is syntactically incorrectans=(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

  • 7/30/2019 csolutin

    13/31

    return 1;for(I=0;I

  • 7/30/2019 csolutin

    14/31

    9) which of the following expression would correctly add just 4 to a pointer "p" pointingto 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 aboveans=(a)

    10)which of the following is returned by the function "strcmp" if the strings that arecompared are identical?a)0 b) 1 c) 2 d) trueans=(a)

    JULY-2002

    1) The conversion specification character for signed decimal integer isa)c b)o c)I d) none of these

    ans=(c)2) The statement scanf("%5cs",str) readsa) maximum 5 characters b) minimum 5 charactersc) exactly 5 characters d) none of theseans=(a)

    3) C compiler trapsa) logical errors b)syntax errorsc) both a&b d) none of theseans=(b)

    4)A pointer isa) address of variable

    b) a variable for storing addressc) an indication of the variable to be accessed nextd) none of these

    ans=(b)5) You cannot use command-line arguments in a program that involvea) structure b) file handling c) string d) none of theseans=(d)6) Which mode is used to open a file for reading and writinga) r+ b) w+ c) both a & b d) none of theseans=(c)7) An enumeration is a data typea) similar to file b) similar to manyc) similar to pointer d) none of theseans=(b)8)Which of the following is not a library functiona) isprint() b) isxdigit() c) isspace() d) none of theseans=(d)

  • 7/30/2019 csolutin

    15/31

    9) Which library function returns number of seconds elapsed beyond a designated basetimea) time() b) ctime() c) stime() d)none of theseans=(a)10) The default value 1 is initialized in

    a) local variable b) static variablec) external variable d) none of theseans=(d)

    Extra practice setsSet-A1) 'C' is a language mostly used for a) scientific application b) business applicationsc) 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 above3) The || operator is used for a) And b) Or c) Not d) Ternary

    4)The && operator is used for a) And b) Or c) Not d) none of these

    5)The ! operator is used for a) And b) Or c) Not d) none of above

    6) In 'C' language reserved word is also known asa) operator b) keyword c) character d) none of these

    7) In 'C'++ isa)Unary operator b) Binary operator c) none d) both a & b8) Switch is used for

    a) To be switching between function in a program b) To be switching variablesc) To switch from one variable to another d) To choose one option from multiple options

    9) The operator x

  • 7/30/2019 csolutin

    16/31

    3) The conversion specification for character isa) %d b) %c c) %s d) %f 4) The conversion specification for integer isa) %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 isa) dot b) comma c) colon d) semicolon7) malloc() function is used for a) dynamic memory allocation b) static memory allocationc) both a& b d) none of a & b8)the statement used to quit one of statement in switcha) break b) continue c) exit d) all of the above9) To perform string operation , the header file needed isa) string.h b) conio.h c) stdio.h d) ctype.h10) '\0' denotes

    a) null character b) end of file c) end of line d) none of these

    SET-C1) 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=52)In case of ordinary int variables

    a) the leftmost bit is reserved for sign b) the rightmost bit is reserved for signc) no bit is reserved for signd) none of above

    3) Recursive functions are executed in aa) last in first out order b) first in first outc) first in last out order d) a and c4)The scope of local variable isA) throughout the program b) within a function, it is definedc) sometimes a and sometimes b d) neither a nor b5) Arrays can be automatically initialized if they area) static b) automatic c) external d) none of these6) The meaning of declaration is

    enum days { Sunday=5,Monday}a) Sunday =5,monday=6

    b) Sunday =0,monday=1c) Sunday =4,monday=5d) None of above

    7) The size of structure isstruct st

  • 7/30/2019 csolutin

    17/31

    { int a;char b[5];

    }st1[10];a) 70 b) 7 c) 17 d) none of these8) 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 these9) 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 these10) The ascii code of 'A' isa)65 b)97 c)67 d)95

    SET-D1) The return statement isA) Optional B) CompulsoryC) a and b D) None of these

    2) The function which calls itself :-A) Recursive function B) Library functionC) External function D) None of these

    3) To close a file we useA) Fclose B) FopenC) FCLOSE D) FOPEN

    4) The statementChar a='a'

    Printf("%d",a);Will print

    A) 97 B) 65C) 90 D) None of these

    5) is a :-

  • 7/30/2019 csolutin

    18/31

    A) Unary operater B) Binary operator C) Ternary operator D) None of these

    6) int a[5] ={1,3,5,7,9} printf("%d",a[2]);

    will print the valueA) 3 B) 5C) 7 D) None of these

    7) int a=0,b=0 b=++a; printf("%d",++b);will print the valueA) 0 B) 1C) 2 D) None of these

    8) a++is equivalent to ++aA) YesB) NoC) Some times a, some times bD) None of these

    9) The * and /, binary operators haveA) Different precedenceB) Same precedenceC) Depends upon the associativityD) 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.07C) 35.0 D) none of these

    SET-E

    1) To allocate the dynamic memory we usea) malloc b) calloc c) both a& b d) none of above2) To open a file we usea) fopen b) fclose c)FOPEN d)both a & c3) Linked list uses

  • 7/30/2019 csolutin

    19/31

    a) dynamic memory allocation b) static memory allocationc) any of above d) none of a & b4) The function which returns nothing can be declared asa) int b) void c)float d) all of above5) The structure is a

    a) user defined datatype b) system defined datatypec) both a & b d) none of these6) The header file necessary to do mathematical calculationa) conio.h b) math.h c) stdio.h d)string.h7) How many times will be loop be executeddo

    { x=5;if (x==1){

    x=x+1;}

    }while(x>=5);a) 1 b)2 c) infinite time d) none8)The size of character isa) 1 byte b) 2 bytes c) 4 bytes d) 8 bytes9)An array is stored ina) different location b) contigous locations c) none d) both a and b10) Arrays are passes as argument to function bya) value b) reference c) both a & b d) none

    ANSWERSSET-A1) D 2) C 3) B 4)A 5)C 6)B 7)A 8)D 9)A 10)CSET-B1) A 2) C 3) B 4)A 5)D 6)A 7)A 8)A 9)A 10)ASET-C1)C 2)A 3)D 4)B 5)A 6)A 7)A 8)A 9)C 10)ASET-D1) A 2)A 3)A 4)A 5)A 6)B 7)C 8)A 9)A 10)BSET-E1) C 2)A 3) A 4)B 5)A 6)B 7)C 8)A 9)B 10)B

    JULY-1999

    Q2. Each statement below is either TRUE or FALSE. Choose the most appropriate oneand 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 thesame 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.

  • 7/30/2019 csolutin

    20/31

    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 toallocate memory7)The function gets() does not include the terminating newline character,but thefgets()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 nextiteration.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

  • 7/30/2019 csolutin

    21/31

    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 constant5)Passing a value to a function places the address of that value in the functions privatememory space.6) A function operates on a integer array passed to it as an argument by placing the valueof 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 aninformation 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- 20011) Redirection is given input to a program beside the keyboard.2)Pre-increment operator and post-increment operator has some effect, while using the onthe 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 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 STATEMENTAND 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-20021)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.

  • 7/30/2019 csolutin

    22/31

    8)The function "fopen" takes only two arguments-a file pointer and representing thename 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 function4) The statement "for(;;);" in perfectly valid 'C' statement.5) When a user defined function is defined in program, than we have to call that functionat 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-A1) MAIN() function is must condition to write a 'C' language program.2)floating point numbers have a fractional portional.3) 5%2 gives result 24) 5/2 gives result 25) 5%2 gives result 16) 5/2 gives result 17) || 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-B1) ;(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 colon5) The character has a size of 1 byte.6) We can store 305.9 in integer type variable7) 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.

  • 7/30/2019 csolutin

    23/31

    10) C language is used for making business applications , scientific tasks.

    SET-C1) 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-D1) 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) , both are the header files and have same functions in them. Thismeans anyone can be used in place of any other.10) The ++ operator increments the value of variable by 2.

    SET-E1) In C language 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

  • 7/30/2019 csolutin

    24/31

    SET-C1) True 2) True 3)True 4)True 5) False 6) True7) False 8) True 9) True 10) TrueSET-D1) False 2) True 3) True 4)False 5) False 6) True

    7) True 8) False 9) False 10) FalseSET-E1) True 2) True 3) True 4)True 5) True 6) True7) True 8) False 9) True 10) False

    JULY 1999

    Q3. Match the words and phrases in col. X with the closet related word in col. Y.

    X Y1. While Modes for opening files2. Goto statement Standard I/O library3. Fread () and fwrite () Compile-time operator 4. W+ and r+ Command- Line arguments5. Strcpy (s1, s2) Macro6. Size of Reading and writing structures7. int p[10], a; p = &a; Should be avoided, as far as possible8. main(int argc, char *argv[]) Bit manipulation9. #define sqr (x) x*x Infinite loop10. The operator & Illegal in C

    Strings libraryAns=1)I 2) G 3) B 4) A 5) K 6) H 7) J 8) D 9) E 10) C

    JANUARY-2000

    X Y1. While(0) a) P is a pointer to a function that

    returns a pointer to integer 2. for(;;)

    { I=2; } b) assignment never take place.

    3. While (*pb ='\0')p++; c)Output character to screen

    4. int (*(p())) d) Occupy 20 bytes of memory5. In a sorting program, for the sake of generality , a programmer decided to usefunctions for comparing keys

    e) does not append a new linecharacter

    6. In a sorting program, for the sake of generality , a programmer decided to usemacros for implementing the code for

    f) assignment operationtakes place inan infinite loop.

  • 7/30/2019 csolutin

    25/31

    comparison of keys7. Puts() g)P is a pointer to a character string8. fputs() h)run time overhead is significant9. int a[2]; float x,y;

    char b[8];i) scope till the end of the function inwhich declared

    10. Automatic variables j) Runtime overhead is minimal andhence a desirable strategy.

    Ans=1)B 2) F 3) G 4) A 5) H 6) J 7) C 8) E 9) D 10) I

    JULY-2000

    X Y1. To issue DOS commands a) 2. int(*p)[25] b) address operator 3. '\0' c) are slower 4. isalpha() d) 35. 1%1 c) user defined datatype4. switch d) double quote5. e) zero6.#define f) single quote

  • 7/30/2019 csolutin

    26/31

    7.string g) non-zero8. 5>3?3>2:2>3 h) undefines a macro9. typedef i) 10. character constant j) unary operator

    k) NULL

    l)defaultm) structuren) defines a macro

    Ans=1)J 2) H 3) B 4) L 5) I 6)N 7) D 8) G 9) C 10) F

    JULY-2001

    X Y

    1. ispunct() a) Actual argument2. function calling b) User defined data type3. a symbolic constant c) Formal arguments4. global variable d) < ctype.h>5.Array e) Command- line argument6. Storage management f) Preprocessor command7. Switch statement g) Limited scope & lifetime8. Continue statement h) #define9. typedef i) 10.Function definition j) subscript

    k) malloc()

    l) Are automatically initialized bycompiler.m) loopn) Default optiono) greater scope &lifetime.

    p) Are not automatically initialized by the compiler.

    Ans =1) D 2) A 3) H 4) O 5) J 6) K 7) N 8) M 9) B 10) C

    January-2002X Y1.Variable record a) Printf 2. Premature loop termination b) 23. Size of "int" variables in bytes c) Int4. Parameter passing machanism in 'C' d) Struct5. Data type whose size in always 1 byte e) Call be teference6. Return type of "getc" function f) Typedef 7. variable argument list function g) Machine dependent8. Dynamic memory allocation with h) Main

  • 7/30/2019 csolutin

    27/31

    initialization9. Creation of a new type i) Char 10.Program execution termination j) Calloc

    k) Mallicl) Break

    m) Allocn) Call be valueo) Union

    p) exitAns=1)D 2) L 3) G 4) N 5) I 6) C 7) E 8) J 9) F 10) P

    JULY-2002

    X Y

    1. int *f() a) To get multiword string2. int (*f)() b) Pointer to array of type char 3. getchar() c) Pointer to function returning int4. long double a[3] d) Occpies 24 bytes of memory(on

    DOS)5. isodigit(c) e) Function returning pointer to array

    of int6. scant("*s",str) f) Function returning pointer to an

    array of pointer to int7. char (*day)[13] g) It is a macro8. char *day[13] h) Occupies 30 bytes of memory (on

    DOS)9. union{int a[2];float x,y;char b[12];}

    i) Library function

    10. gets(str) j) To get single word stringk) Occupy 28 bytes of memory (onDOS)l) Array of pointer to char m) Function returning pointer to intn) Returns next character from stdouto) User-defined function

    p) Pointer to pointer to intAns=1)M 2) C 3) N 4) D 5) I 6) J 7) B 8) L 9) H 10) A

  • 7/30/2019 csolutin

    28/31

    EXTRA PRACTICE SETS

    X Y1)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

    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 .. libraryfunction.

    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 remainingstatements 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 complement6)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 ..

  • 7/30/2019 csolutin

    29/31

    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 anddouble the result is of the type

    Ans= 1)one or zero 2) randomly 3) integers 4) bytes 5) string 6) bound 7) reserved8) buffer 9) conditional 10) double

    JULY-20001) 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 isdeclared 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 arisedue 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 6510) different January-2001

    1) If we define an array in a function with . class, we cannot pass theaddress of that array back to the main of subsequent work.

    2) .. enables the programmer to divide the program into smaller, moreeasily managed segment.3) The .. statements tells the computer "SKIP THE FOLLOWINGSTATEMENTS 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 ,therecursion is said to be6) 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.

  • 7/30/2019 csolutin

    30/31

    Ans=1)auto 2) function 3)continue 4)3 5)indirect 6)semicolon 7)= = 8)switch 9)2 10)3

    JULY-20011) 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 type6) logical operators can only be applied to integer operands.7) The following 'C' expression

    (3>>2)>(3

  • 7/30/2019 csolutin

    31/31