Monday, December 21, 2009

C-LANAGUAGE

C-LANAGUAGE

unit – 1

1. c-programming language was developed by _______
a) *Dennis Ritchie b) Jeff Thmson c) Bill Gates d) None
2. C-language is derived from a computer language named __
a)*B b)D c)C++ d) None
3. In c-language , related data can be stored in _____
a) Arrays b) Structures c)*a & b d)None
4. In every c-program , ____ function is must .
a)printf() b)scanf() c)*main() d)None
5. _____ functions is starting of c-language program.
a)*main() b)getchar() c)putchar() d)None
6. ______ header file allows the program to interact with the screen , keyboard and file system of the computer.
a)* b) c) d)None
7. __ brackets in C are used to group together as in a function, or in body of a loop.
a)*Curly b)square c)small d)None
8. Grouping statements is known as a ________.
a)Compound statement b)block c)*a & b d) None
9. At run time , program execution starts at the first line of the ___ function.
a)*main() b)scanf() c)printf() d) None
10. _______ is a library function used in C to display any output to the terminal.
a)display() b)*printf() c)scanf() d)None
11. The text to be printed is enclosed in ____ quotes.
a)single b)*double c)triple d)None
12. The __ at the end of the text tells the program to print a new line as part of the output.
a)\t b)*\n c)\v d) None
13. Most C-programs are in ____ case letters.
a)*lower b)upper c) both d) None
14. C- language is case sensitive. (true / false)
a)*True b)False c)Both d) None
15. C-language is a powerful and efficient _____ programming language .
a)*Structured b)Object Oriented c)unstructured d)None

UNIT – II
CONSTRAINTS, DATA TPES AND VARIABLE TYPES
1) Octal constants are written with a leading _____.
a)*zeros b)0x c)trailing L d)None
2) Hexa decimal constants are written with a leading ____.
a)zeros b)*0x c)trailing L d)None
3) Long constants are written with a trailing _____.
a)zeros b)0x c)*trailing L d)None
4) Single character constants are usually just the character enclosed within in _ quotes.
a)*Single b)double c)brackets d) None
5) ______ is used to get the new line .
a)*\n b)\t c)\\ d) None
6) ______ is used to get the tab space.
a)\n b)*\t c)\\ d) None

7) ______ is used to get the null.
a)\n b)\t c)*\0 d) None
8) A string constants is surrounded by ______ quotes.
a)Single b)*double c) brackets d) None

9) In , C language , a variable must be declared _____ it can be used.
a)*before b)after c) both d) None
10) Most _______ variables are created when the function is called and are destroyed on return from that function.
a)*local b)static c) global d) None
11) Variables can be initialized by using _____ symbol.
a)= = *b)= c)[] d) None
12) Char data type occupy ____ number of bytes.
a)*one b)two c)four d) None
13) Int data type occupy ____ number of bytes.
a)one b)*two c)four d) None
14) float data type occupy ____ number of bytes.
a)one b)two c)*four d) None
15) _ allows a user to define an identifier that would represent an existing data type .
a)*typedef b) struct c) union d) None
16) Every variable must be starting with _______
a)*letter b)Number c)both d) None
17) _ variables are declared within the body of function , and only be used within function.
a)*local b)global c)static d) None
18) A global variables must be declared outside of ____ function.
a)scanf() b)printf() c)*main() d)None
19) The external variables must be declared by using _____ word.
a)external b)*extern c)global d)None
20) The variables is not destroyed on exit from the function .
a)local b)*static c)global d)None
21) The static variables must be declared by using ___ word.
a)local b)*static c)global d)None
22) An _____is a collection of variables of the same data types.
a)structure b)*Array c)union d)None
23) An array having one variable name and using only one subscript value is called _.
a) *single dimension array b) double dimension array
c) multiple dimension array d) None
24) In array , subscript value starting from ____ value .
a)one b)*zero c)any number d)None
25) Subscript value should be mention with in ____ brackets.
a){} b)() c)*[ ] d) None 

UNIT – 3
Operators and Expressions
1) An _____ is a function , which is applied to values to give a result.
a)*Operator b)equals to c)condition d)None
2) I+=10 is equivalent to _______
a)*I = I + 10 b)I = I * 10 c)I = I – 10 d)None
3) I-=10 is equivalent to _______
a)I = I + 10 b)I = I * 10 c)*I = I – 10 d)None
4) C = c + ‘A’ + ‘a’ is a valid statement in c-language.
a) *true b)false c)None

5) Characters have _____ sizes on different machines.
a)*different b)same c)both d)None
6) The _____ symbol is used for compare the values.
a)= b)*== c)<> d) None
7) C makes use of the _____ symbol as an assignment operator.
a) *= b)== c)<> d) None
8) _____ symbol is used for logical AND .
a)*&& b)| | c)! d) None
9) _____ symbol is used for logical OR
a) && *b) | | c)! d) None
10) If a=1110 , b = 1100 then a & b is equal to _____
a)111100 b)*1100 c)1110 d)None
11) If a=1110 , b = 1100 then a | b is equal to _____
a)111100 b)1100 c)*1110 d)None
12) If a=1110 , b = 1100 then a ^ b is equal to _____
a)*0010 b)1100 c)1110 d)None
13) Shift operators are represented by the symbols _____ and _____.
a)* << and >> b)< and > c)&& and ^^ d)None
14) ____ operator is used to link the related expressions together.
a)* comma b)semicolon c)colon d)None
15) _____ operator returns the number of bytes occupied .
a)*sizeof() b)numberof() c)bytesof() d)None 

UNIT – 4
CONTROL STATEMENTS

1) The ____ statement is used to control the flow of execution of statements.
a) *if b)loops c)arrays d) None
2) In if statement, block of statements enclosed within a pair of ___ braces.
a) *{ } b)[ ] c) ( ) d) None
3) _____ statement is used for multi-way decision making .
a) while b)for c)*switch d) None
4) The _ statement at the end of block enables the control to exit from the switch statement.
a)exit() b)*break c)for d) None
5) The _____, is the optional case which is executed only when the result of the conditional expression does not match with any of the case values.
a) case b)switch c)*default d) None
6) C support the _ statement to branch unconditionally from one to another in the program.
a) *goto b)if c)switch d) None
7) The goto statement requires a _____ to identify the place where the control should be branched to .
a) if b)*label c)break d) None
8) ______ allow a statement or block of statements to be repeated.
a) if b)switch c)*loop d) None
9) In entry-controlled loop, the control conditions are tested _the loop execution begins.
a) *before b)after c) end d) None
10) If the condition does not result in termination of the loop then body of the loop keeps executing continuously . This type of loop is called ____.
a) *Infinite loop b)condition loop c)exit-controlled loop d)None
11) The ____ loop keeps repeating an action until an associated test returns false.
a)for b)*while c)do-while d) None

12) In ____ loop, the condition is first evaluated and if the condition evaluate to true, then the body of loop is executed.
a) for b)*while c)do-while d) None
13) In _____ type of loop, condition is at the end of the loop body.
a) for b)while c)*do-while d) None
14) In _____ type of loop, guarantees that the loop body is executed at least once even condition is true or false.
a) for b)while c)*do-while d) None
15) The _____ loop keeps repeating an action until an associated test returns false.
a) for b) *while c) do-while d) None
16) The _____ loop keeps repeating an action until an associated test returns true.
a) for b) while c) *do-while d) None
17) The do-while loop is called __________.
a) *exit-controlled loop b)entry-controlled loop c)both d) None
18) The for loop is called __________.
a) exit-controlled loop b)*entry-controlled loop c) both d)None
19) The ____ loop works well where the number of iterations of the loop is known before the loop is entered.
a) *for b)while c)do-while d) None
20) The _____ loop is extremely flexible and allows many types of program behavior to be specified simple and quickly .
a) *for b)while c)do-while d) None
21) The loop with in loop is called _______.
a) two loops b)many loops c)*nested loop d)None
22) Nested loop may continue upto ____ levels in ANSI – C.
a) 10 b) *15 c)22 d) None
23) The _____ statement is used to exit from a loop or switch , control passing to the first statement beyond the loop or switch.
a) *break b)exit() c)default d) None
24) _____ statement works only within loops where its effect is to force an immediate jump to the loop control statement.
a) break b)*continue c)default d) None
25) What is out put of the program.
For(int I=0;I<10;I++);
Printf(“\n%d”,I);
a) display 0 to 9 b)display 1 to 10 c) *display 10 only d) None 

UNIT – 5
INPUT AND OUTPUT
1) Input and output functions are in ____ header file.
a) *#include b)#include c) #include d)None
2) The contents of header file becomes part of the program sources code during __.
a) execution b)*compilation c) processing d) none
3) _____ function is used to reading a single character at the run time.
a) *getchar() b)getchars() c)putchar() d)None
4) _____ function is used to writing a single character at the run time.
a) getchar() b)putchars() c)*putchar() d)None
5) getchar() function is used on the _____ side of an assignment statement.
a) left b)center c)*right d)None
6) ‘\0’ is indicated by _______
a) null b)*NULL c)end d)None
7) EOF can be generated by pressing ______ key.
a)*Ctrl + d b)Alt + d c)Shift + d d)None

8) _______ function is used to puts on character on the standard output each time.
a)*putchar() b)getchar() c)puts() d)None
9) ______ function is used to convert lower case to upper case.
a)*toupper() b)tolower() c)upper() d)None
10) ______ function is used to convert upper case to lower case.
a)toupper() b)*tolower() c)upper() d)None
11) The _ method is used for checking whether the character types is an alphabet or a digit.
a) isdigit() b)*isalpha() c)Isbeta() d)None
12) Isalpha() returns _____ value.
a) zero b)*non-zero c)null d)None
13) _______ is used for formatted output.
a) scanf() b)putchar() c)*printf() d)None
14) _______ is used for formatted input.
a) *scanf() b)putchar() c)printf() d)none
15) ____ is the address of an operator.
a)* b)*& c)# d)None
16) yourname[0] refers the _____ element of the arrays.
a)*first b)zeroth element c)last element d)None
17) ______ reads a whole line of input into a string until a newline or EOF is encountered.
a)*gets() b)getchar() c)puts() d)None
18) gets() function returns ______ , if end of file is reached .
a)EOF b)*NULL c)BOF d)None
19) _____ function writes a line of output to standard output.
a)*puts() b)gets() c)putchar() d)None
20) ____ specifier is used for integer data type.
a)%f b)%c c)*%d d)None

UNIT – 6
POINTERS IN C

1) ____ is the variable that store the memory address of other variables.
a) *pointer b)integer c)character d)None
2) ____ symbol is used to get the address of the variable.
a)# b)*& c)* d) None
3) Dereferencing is done with the unary operator _____.
a)* * b)& c)# d) None
4) *ptr=&x; is a valid statement ?
a)false b)*true c)none
5) Address operator is ______
a)# b)*& c)* d) None
6) ____ is the format specifier for memory address.
a)%d b)*%p c)%f d)None
7) ______ allows the data at the memory address to be modified.
a)*Dereferencing b)addressing c) a & b d)None
8) Pointers can be incremented, decremented and manipulated using
arithmetic expressions.[ true/false] a)*True b)false c) None
9) In array, first element position is ______
a)*0 b) 1 c)2 d) None
10) X should return the value of ______ array.
a)*first value b)last value c)middle value d)None


11) ++p is _______ increment.
a)*pre b)post c)middle d) None
12) Pointers are particularly useful for manipulating _____ .
a)*strings b)integers c)float d) None
13) ______ returns the current value that the pointer is pointing to and then moves the pointer one step forward.
*a) *(ptr++) b)*ptr++ c)ptr*++ d)none
14) _______ gives the number of elements between ptr1 and ptr2.
*a)ptr2 – ptr1 b)ptr1 – ptr2 c)*ptr2 - *ptr1 d)None
15) _____ the contents of the address contained in ptr3 are assigned to the contents of the address contained in ptr4.
a)*ptr4=ptr3 *b)*ptr4 = *ptr3 c)ptr4 = ptr3 d) None 

UNIT – 7
FUNCTIONS IN C

1) ______ are used to encapsulate a set of operations and return information to the main program or calling module.
a)*function b)pointers c)if condition d)None
2) Functions may be reused in multiple programs. (true/false)
a)*true b)False c)none
3) The function prototype is called the _______.
a) Function definition b) *Function declaration
c) Function execution d) None
4) The ______ statement can be used to return a single value from a function to main program.
a)call b)send to c)*return d)None
5) In Function , return statement is ______
a)compulsory b)*optional c)None
6) Any variable declared within the Function is called ________
a)public variables b)global variables c) *local variables d) None
7) The body of the function is bounded by a set of ______
a)*curly brackets b)square brackets c) small brackets d) None
8) If function not return any value to main , then ____ is used.
a)int b)float c)*void d) None
9) ______ type of variables available to any other function which accesses them.
a)static variables b)*global variables c) local variables d) None
10) Global variables are declared ________
a)*above main() b)within main() c) any where in the program d) None
11) When an array is passed into a function, the function receives ______
a)all values b) first values only c) *address of first element d)None
12) Strings are stored in C as _____ terminated character arrays.
a) *null b) blank c)\n d) None
13) In C, all arguments are passed into functions by value popularly called as ______
a)*pass by value b)pass by reference c) pass address d) None
14) A _______ function is a function which call itself.
a) *recursive b)function within function c) nested function d) None
15) ______ key word is used to declare the extern storage class variable.
a)*extern b)external c)exter d) None





UNIT – 8
WORKIGN WITH STRINGS
1) String in C are stored as ______
*a) ‘\0’ b)blank c)\n d)None
2) String functions are available in _____ header file
a) *string.h b)stdio.h c)conio.h d) None
3) _____ function is used to copy the string value from one variable to another variable.
a)strcat() b)*strcpy() c)strlen() d)None
4) _____ function is used to compare both the string values are same or not .
a)strcat() b)*strcmp() c)strlen() d)None
5) _____ function is used to find the number of characters in a string.
a) strcat() b)strcpy() c)*strlen() d)None
6) ______ function is useful to initialize a string to all nulls or to any character.
a) strcat() b)strcpy() c)*memset() d) None
7) _ function is used to copy the specify the number of characters into another variable.
a) strcat() b)strcpy() c)*strncpy() d)None
8) _______ function appends at most N characters from the source string to the end of the destination string.
a) strcat() b)*strncat() c)strncpy() d) None
9) In C, strings are arrays of _______.
a) *characters b)integer c)float d) None
10) Char word[20]=”acme” . ____ number of bytes will occupy in the memory.
a) 4 b)*5 c)1 d)None

 UNIT – 9
STRUCTURES IN C

1) A _____ is a collection of different types of variables under a single name.
a) *Structure b)pointer c)Array d)None
2) A ____ is convenient way of grouping several pieces of related information together.
a) *Structure b)pointer c)Array d)None
3) A ____ define the name a new type, allowing its use throughout the program.
a) struct b)*typedef c)array d) None
4) The structure tag is used to declare variables of the type structure also called as _____.
a) * structure variable b)structure pointer c)structure array d) None
5) A _____ symbol is used to select a member from a structure.
a) *dot(.) b) comma(,) c) dollar ($) d) None
6) A _____ symbol is used to select a member from a structure pointer.
a) dot(.) b) comma(,) *c)  d) None
7) Structure initializing the values like a array . (true / false)
a) *true b) false c) None
8) A _____ is a collection of variables of different types just like a structure.
a) pointer b) array c) *union d) None 
9) Once a new value is assigned to a field in the union, the existing data is __ with the new data.
a) *wiped over b)adding c)editing d) None
10) The size of union is size of its _______.
a)all fields b)*large field c) small field d) None
11) In the original C (kernighan & Ritchie 1st edition ), it was not possible
to pass a structure. ( true / false) a)*true b)false c) None


12) Struct emp employees. Here employees is called ________-
a)structure tag b)*structure variable c) structure pointer d) None
13) Struct emp employees. Here emp is called ________-
a) *structure tag b)structure variable c)structure pointer d) None
14) Struct item
{ char itname[20];
int qty;
}
here , itname is called __________
a)structure element b)structure member c) *a & b d) None
15) _____ key word is used to declare the union .
a) struct b) *union c) extern d) None

UNIT – 10
FILE HANDING IN C

1) _____ provide a way to pass a set of arguments into a program at run time.
a)*command line arguments b)variables c) pointer d) None
2) _______ function is used to open a file .
a)fileopen() b)*fopen() c)open() d)None
3) _______ function is used to close the opened file.
a)fileclose() b)*fclose() c)close() d)None
4) fopen() returns a ______ on success.
a)*file pointer b)NULL c)blank line d)None
5) _____ is used to flush any buffered data out of an output.
a)*fflush() b)free() c)delete() d)None
6) fclose() returns _____ on success .
a)*zero b)null c)blank d) None
7) _____ statement is written to a file .
a) *fprintf() b)fscanf() c) filewrite() d) None
8) fprintf() returns the ______ if successful.
a)null b)zero c)*number of characters d) None
9) Data is read from file by using _______.
a)fprintf() b) *fscanf() c)read() d)None
10) _____ function returns the next character in the input stream.
a)fprintf() b)fscanf() c)*fgetc() d)None
11) _____ function read a string to the stream.
a)*fgets() b)fputs() c)fputc() d)None
12) _____ function writes a string to the stream.
a)fgets() b)*fputs() c)fputc() d)None
13) _______ function to write a single character to the output stream.
a)*fputc() b)fgetc() c)fputs() d)None
14) C communicates with files using a new datatype called _____.
a)file address b)*file pointer c)file array d)None
15) The file mode ____ is used for reading .
a)w b)*r c) a d) None
16) The file mode ____ is used for writing.
a)*w b)r c) a d)None
17) The file mode ____ is used for append any previous contents.
a) w b) r c) *a d) None
18) The ______ function can be used to disconnect a file pointer.
a)fopen() b)fdelete() c)*fclose() d) None


19) NULL is commonly written as _____
a)EOF b)*‘\0’ c)Blank d)None
20) ______ is a character which indicates the end of a file.
a)*EOF b) ‘\0’ c)Blank d)None

UNIT – 11
MEMORY ALLOCATION

1) _____ allocation provides a way to dynamically create buffers and arrays.
a)*Memory b)array c)pointer d) None
2) _______ means that the space is allocated in memory as the program is executing .a)Static b)*Dynamic c)Allocation d) None
3) ________ function required the number of bytes to allocate dynamically.
a)*malloc() b)realloc() c)calloc() d)None
4) malloc() function return a ______ , if the memory allocation was successful.
a)NULL b)EOF c)*void pointer d) None
5) malloc() function return a ______ , if the memory allocation was failure.
a)*NULL b)EOF c)void pointer d) None
6) _______ function returns the size in bytes of an object.
a)count() b)*sizeof() c)printf() d)None
7) Allocate the memory dynamically using _ function and store a certain number of bytes.
a)*malloc() b)realloc() c)calloc() d)None
8) ______ function is used to release the used memory.
a)*free() b)delete() c)remove() d) None
9) __ function is used to store the values in the allocated memory space is zero by default.
a)malloc() b)realloc() c)*calloc() d)None
10) calloc() function return ______ if the memory allocation was successful .
a)null b)EOF c)*void pointer d) None
11) _______ function is used to modify the allocated memory.
a)alloc() b)malloc() c)*realloc() d)None
12) realloc() function returns ______ if succssful.
a)null b)EOF c)*void pointer d)None
13) realloc() function returns ______ if not successful.
a)*NULL b)EOF c)void pointer d)None
14) If memory allocation failed , then malloc() will return a _____ pointer.
a)*NULL b)EOF c)void pointer d) None
15) Calloc() function required _____ number of arguments.
a) 1 b)*2 c)3 d)None 

    UNIT – 12
THE C PREPROCESSOR

1) The ______ is a program that is executed before the source code is compiled.
a) *C – Processor b)pointer c)Union d)None
2) C processor commands are called ________
a)dictionary b)*directives c)pointers d)None
3) All c-processor commands are begin with a ____ symbol.
a)* b)& c)* # d) None
4) No semi colon is not required at the end of c-processor. (true / false)
a)*true b)false d) None


5) The _____ directive is used to define a macro substitution .
a)* #define b)#if c) #undef d) None
6) The _____ directive is used to undefine a macro substitution .
a) #define b) #if c) *#undef d)None
7) The _____ directive is used to undefine a macro substitution .
a) #define b)*#if c)if d)None
8) The _____ directive is used to specifies the end of #if .
a) *#endif b) #ifend c)#undef d)None
9) The _____ directive is used to test whether a macro is not defined
a) #ifdef b)*#ifndef c)#undef d)None
10) A external file can be included as part of a program by using ______.
a)*#include<> b)#define c)#filename d)None
11) ______ files contain details of functions and types used within the library.
a)*Header file b)Text file c)Binary file d)None
12) Library header file names are enclosed with in _______
a)“ “ b)*Angle bracket c) ( ) d) None
13) #ifdef returns _____ if the name has already been defined.
a)*True b)False c)Null d) None
14) ____ takes the name as argument and checks whether it has been defined or not.
a)*#ifndef b)#ifdef c)#defined d) None
15) The directives are read by the C-Processor , ______ main() is executed.
a)After b)*Before c)any time d) None

*-*-*-*-*-*
KEY
UNIT – 1
A Quick Overview of C

1 A 2 A 3 C 4 D 5 A
6 A 7 A 8 C 9 A 10 B
11 B 12 B 13 A 14 A 15 A

UNIT – II
CONSTRAINTS, DATA TPES AND VARIABLE TYPES
1 A 2 B 3 C 4 A 5 A
6 B 7 C 8 B 9 A 10 A
11 B 12 A 13 B 14 C 15 A
16 A 17 A 18 C 19 B 20 B
21 B 22 B 23 A 24 B 25 C

UNIT – 3
Operators and Expressions
1 A 2 A 3 C 4 A 5 A
6 B 7 A 8 A 9 B 10 B
11 C 12 A 13 A 14 A 15 A
UNIT – 4
CONTROL STATEMENTS
1 A 2 A 3 C 4 B 5 C
6 A 7 B 8 C 9 A 10 A
11 B 12 B 13 C 14 C 15 B
16 C 17 A 18 b 19 A 20 A
21 C 22 B 23 A 24 B 25 C



UNIT – 5
INPUT AND OUTPUT

1 A 2 B 3 A 4 C 5 C
6 B 7 A 8 A 9 A 10 B
11 B 12 B 13 C 14 A 15 B
16 A 17 A 18 B 19 A 20 C

UNIT – 6
POINTERS IN C
1 A 2 B 3 A 4 B 5 B
6 B 7 A 8 A 9 A 10 A
11 A 12 A 13 A 14 A 15 B

UNIT – 7
FUNCTIONS IN C
1 A 2 A 3 B 4 C 5 B
6 C 7 A 8 C 9 B 10 A
11 C 12 A 13 A 14 A 15 A

UNIT – 8
WORKING WITH STRINGS
1 A 2 A 3 B 4 B 5 C
6 C 7 C 8 B 9 A 10 B

UNIT – 9
STRUCTURES IN C
1 A 2 A 3 B 4 A 5 A
6 C 7 A 8 C 9 A 10 B
11 A 12 B 13 A 14 C 15 B

UNIT – 10
FILE HANDING IN C

1 A 2 B 3 B 4 A 5 A
6 A 7 A 8 C 9 B 10 C
11 A 12 B 13 A 14 B 15 B
17 C 18 C 19 B 20 A

UNIT – 11
MEMORY ALLOCATION

1 A 2 B 3 A 4 C 5 A
6 B 7 A 8 A 9 C 10 C
11 C 12 C 13 A 14 A 15 B

UNIT – 12
THE C PREPROCESSOR
1 A 2 B 3 C 4 A 5 A
6 C 7 B 8 A 9 B 10 A
11 A 12 B 13 A 14 A 15 B