Sie sind auf Seite 1von 6

C PROGRAMMING

2) Which of the following is a keyword used for a storage class?


A] Printf B] external C] auto D] scanf
4) Preprocessor Directives are used for -
A] Macro Expansion B] File Inclusion
C] Conditional Compilation D] All of these
5) Which operator has the lowest priority ?
A] ++ B] % C] + D] ||
6) The type cast operator is-
A] (type) B] cast() C] // D]
7) File manipulation functions in C are available in which header file ?
A] streams.h B] stdio.h C] stdlib.h D] files.h
8) Which pair of functions below are used for single character I/O ?
A] getchar() and putchar() B] scanf() and printf()
C] input() and output() D] Non of these
10) What is the output of this program ?
void main() {
int a=b=c=10;
a=b=c=50;
printf(\n %d %d %d,a,b,c); }
A] 50 50 50 B. Compile Time Error C. 10 10 10 D. Three Gaebage Value

12) Which of the following is not s keyword of C ?


A]auto B]register C]int D]function

13) Explicite type conversion is known as


A] conversion B] disjunction C] separation D] casting

14) By default a function returns a value of type


A] int B] char C] void D] None of these

15) What is sizeof In C ?


A] Operator B] Reserve Worf C] Both (A) and (B) D] Function

16) Which is not keyword in C ?


A]typedef B] const C] near D] complex

18) What will be the output ?


void main ( ) {
printf(%d,B < A ); }
A] Error B] 1 C] 0 D] None of these
20) What will be the output (assume int is 4 bytes0?
void main ( ) {
int x;
unsigned y;
printf(\n%d %d, sizeof(x), sizeof(y) ); }
A] 22 B] 24 C] 44 D] None of these

21) int **x;


A]x is a pointer to pointer B] x is not pointer
C] x is long D] None of these

22) What will be the output ?


void main ( ) {
printf(\n %d %d, 10&20, 10/ 20); }
A] 00 B] 10 10 C] 0 30 D] 20 20

23) Which of the following is used as a string termination character ?


A] 0 B] \0 C] /0 D] None of these
24) A static variable by default gets initialized to
A] 0 B] blank space C] 1 D] garbage value

25) Which function reallocates memory ?


A] realloc B] alloc C] malloc D] None of these

1. The keyword used to transfer control from a function back to the calling function is
a.switch b.goto
c.go back d. return

3. How to declare a pointer to a function?

a) Int *(fp)() b) Int (*fp)() c) Int * (fp)() d) None

6. printf() belongs to which library of c


a)stdlib.h b)stdio.h c)stdout.h d)stdoutput.h

7. Compiler generates ___ file.


a) Executable code b) - Object code c)- Assembly code d) - None of the above.

8. The keyword break cannot be simply used within:


a) do-while
b) if-else
c) for
d) while
10. Which looping process is best used when the number of iterations is known?
a. for
b. while
c. do-while
d. all looping processes require that the iterations be known

13. In the C language 'a represents


a) a digit b) an integer c) a character d) a word
14. The number of the relational operators in the C language is

a) Four b) Six c)Three d) One

15. A compound statement is a group of statements included between a pair of


a) double quote b) curly braces c) parenthesis d) a pair of /s

17. A continue statement causes execution to skip to


a. the return 0; statement
b. the first statement after the loop
c. the statement following the continue statement
d. the next iteration of the loop

18. Input/output function prototypes and macros are defined in which header file?
a. conio.h b. stdlib.h
c. stdio.h d.dos.h

23. When the main function is called, it is called with the arguments
a) argc b)argv c) None of these d) both a & b

24. A multidimensional array can be expressed in terms of


a) array of pointers rather than as pointers to a group of contiguous array
b) array without the group of contiguous array
c) data type arrays
d) None of these

7. Which of the following is a correct format for declaration of function?


a) return-type function-name(argument type);
b) return-type function-name(argument type) {}
c) return-type (argument type)function-name;
d) Both (a) and (b)

8. Which of the following function declaration is illegal?


a) int 1bhk(int);
b) int 1bhk(int a);
c) int 2bhk(int*, int []);
d) All of the mentioned
9. Which function definition will run correctly?
a) int sum(int a, int b)
return (a + b);
b) int sum(int a, int b)
{return (a + b);}
c) int sum(a, b)
return (a + b);
d) Both (a) and (b)

10. Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]
a) Yes, and we can use the function value conveniently
b) Yes, but we call the function again to get the value, not as convenient as in using variable
c) No, C does not support it.
d) This case is compiler dependent

11. The value obtained in the function is given back to main by using ________ keyword?
a) return
b) static
c) new
d) volatile

12. The continue command cannot be used with


;a) for b) switch c) do while d) while

16. Array subscripts in C always start at


a) -1 b) 1 c) 0 d) Value provided by user

17. What will the function rewind() do?


a) Reposition the file pointer to a character reverse.
b) Reposition the file pointer stream to end of file.
c) Reposition the file pointer to begining of that line.
d) Reposition the file pointer to begining of file.

18. How will you free the allocated memory ?


a. remove(var-name); b. free(var-name); c.delete(var-name);d. dalloc(var-name);

21. The meaning of arrow operator in a->b


a) ( *a).b b) b.(*) c) a.b d)None of these

24. A declaration float a,b; accupies ______of memory ?


a) 1 bytes b) 4bytes c) 8byte d) 16 bytes

25. Which among the following is a unconditional control structure?


a) do-while b) if else c) goto d) for
1. A pointer to a pointer in a form of
A] multiple indirection B] a chain of pointers C] both a and b D] None of these

2. For binary files, a ___ must be appended to the mode string.


a) Nothing
b) b
c) binary
d) 01

3. If there is any error while opening a file, fopen will return


a) Nothing
b) EOF
c) NULL
d) Depends on compiler

6. FILE is of type ______ ?


a) int type
b) char * type
c) struct type
d) None of the mentioned

7. What is the meant by a in the following operation?


fp = fopen(Random.txt, a);
a) Attach
b) Append
c) Apprehend
d) Add

10. Which of the following fopen statements are illegal?


a) fp = fopen(abc.txt, r);
b) fp = fopen(/home/user1/abc.txt, w);
c) fp = fopen(abc, w);
d) None of the mentioned

11. What does the following segment of code do?


fprintf(fp, Copying!);
a) It writes Copying! into the file pointed by fp
b) It reads Copying! from the file and prints on display
c) It writes as well as reads Copying! to and from the file and prints it
d) None of the mentioned
12. FILE reserved word is
a) A structure tag declared in stdio.h
b) One of the basic data types in c
c) Pointer to the structure defined in stdio.h
d) It is a type name defined in stdio.h

13. stdout, stdin and stderr are


a) File pointers
b) File desciptors
c) Streams
d) Structure

20. How to call a function without using the function name to send parameters?

a) typedefs
b) Function pointer
c) Both (a) and (b)
d) None of the mentioned

21. Correct syntax to pass a Function Pointer as an argument


a) void pass(int (*fptr)(int, float, char)){}
b) void pass(*fptr(int, float, char)){}
c) void pass(int (*fptr)){}
d) void pass(*fptr){}

25. Calling a function f with a an array variable a[3] where a is an array, is equivalent to
a) f(a[3])
b) f(*(a + 3))
c) f(3[a])
d) All of the mentioned

Das könnte Ihnen auch gefallen