Professional Documents
Culture Documents
Test No:1
C Language Test
1. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ? A. B. C. D. rem = 3.14 % 2.1; rem = modf(3.14, 2.1); rem = fmod(3.14, 2.1); Remainder cannot be obtain in floating point division.
2.
What are the types of linkages? A. C. Internal and External External and None B. D. External, Internal and None Internal
3.
Which of the following special symbol allowed in a variable name? A. C. * (asterisk) - (hyphen) B. D. | (pipeline) _ (underscore)
4.
Is there any difference between following declarations? 1 : extern int fun(); 2 : int fun(); A. B. C. D. Both are identical No difference, except extern int fun(); is probably in another file
5.
How would you round off a value from 1.66 to 2.0? A. C. ceil(1.66) roundup(1.66) B. D. floor(1.66) roundto(1.66)
6.
C.
long double
D.
far double
7. Which of the following is not user defined data type? 1 : struct book { char name[10]; float price; int pages; }; 2 : longint l = 2.35; 3 enum day {Sun, 9. :Identify which of the following are declarations Mon, Tue, Wed}; extern int x; 2 : float ( A. 1 square B. 2 float x ) { ... } 3 : double pow(double, double); C. 3 A. 1 C. D. B B. D. 2 3
1 and 3
10.
A.
B. C. D.
int a = 20 is declaration, extern int a is the definition int a = 20 is definition, a is not defined a is declared, a is not defined
11.
In which header file is the NULL macro defined? A. C. stdio.h stdio.h and stddef.h B. D. stddef.h math.h
12.
A. C.
B. D.
13.
A. C.
3, 2, 515 3, 2, 5
B. D.
14.
What will be the output of the program ?
#include<stdio.h>
int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1, 2, 13}; printf("%d, %d, %d\n", bit.bit1, bit.bit3, bit.bit4); return0; } A. C. 1, 2, 13 -1, 2, -3 B. D. 1, 4, 4 -1, -2, -13
15.
What will be the output of the program ?
#include<stdio.h>
int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d\n", ++MON, TUE, WED, THU, FRI, SAT); return0; } A. C. -1, 0, 1, 2, 3, 4 0, 1, 6, 3, 4, 5 B. D. Error 0, 0, 6, 7, 8, 9
16.
The keyword used to transfer control from a function back to the calling function is A. C. switch go back B. D. goto return
17.
In C, if you pass an array as an argument to a function, what actually gets passed? A. B. C. D. Value of elements in array First element of the array Base address of the array Address of the last element of array