NewsTicker

C Language Quiz


Online Examination for C Language Quiz Question And Answer





Online Test


1. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?

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?
 
Internal and External
External, Internal and None
External and None
Internal
 -----------------------------------------------------------------------------------------------------------------
3. What are the different types of real data type in C ?
float, double
short int, double, long int
float, double, long double
double, long int, float
-----------------------------------------------------------------------------------------------------------------
4. What will you do to treat the constant 3.14 as a long double?
 
use 3.14LD
use 3.14L
use 3.14DL
use 3.14LF
-----------------------------------------------------------------------------------------------------------------
5. What is (void*)0?

Representation of NULL pointer
Representation of void pointer
Error
None of above
-----------------------------------------------------------------------------------------------------------------
6. In which header file is the NULL macro defined?
 
stdio.h
stddef.h
stdio.h and stddef.h
math.h
-----------------------------------------------------------------------------------------------------------------
7. How will you free the allocated memory ?
 
remove(var-name);
free(var-name);
delete(var-name);
dalloc(var-name);
-----------------------------------------------------------------------------------------------------------------
8. What is the similarity between a structure, union and enumeration?
 
All of them let you define new values
All of them let you define new data types
All of them let you define new pointers
All of them let you define new structures
-----------------------------------------------------------------------------------------------------------------
9. In which numbering system can the binary number 1011011111000101 be easily converted to?
 
Decimal system
Hexadecimal system
Octal system
No need to convert
-----------------------------------------------------------------------------------------------------------------
10. Which bitwise operator is suitable for turning off a particular bit in a number?
 
&& operator
& operator
|| operator
! operator
-----------------------------------------------------------------------------------------------------------------
11. Which header file should be included to use functions like malloc() and calloc()?
 
memory.h
stdlib.h
string.h
dos.h
-----------------------------------------------------------------------------------------------------------------
12. What function should be used to free the memory allocated by calloc() ?

dealloc();
malloc(variable_name, 0)
free();
memalloc(variable_name, 0)
-----------------------------------------------------------------------------------------------------------------
13. What will the function rewind() do?
 
Reposition the file pointer to a character reverse
Reposition the file pointer stream to end of file.
Reposition the file pointer to begining of that line.
Reposition the file pointer to begining of file
-----------------------------------------------------------------------------------------------------------------
14. Input/output function prototypes and macros are defined in which header file?
 
conio.h
stdlib.h
stdio.h
dos.h
-----------------------------------------------------------------------------------------------------------------
15. Which of the following is not logical operator?
 
&
&&
||
!
-----------------------------------------------------------------------------------------------------------------
16. In mathematics and computer programming, which is the correct order of mathematical operators ?
 
Addition, Subtraction, Multiplication, Division
Division, Multiplication, Addition, Subtraction
Multiplication, Addition, Division, Subtraction
Addition, Division, Modulus, Subtraction
-----------------------------------------------------------------------------------------------------------------
17. The keyword used to transfer control from a function back to the calling function is
 
switch
goto
go back
return
-----------------------------------------------------------------------------------------------------------------
18. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
 
The element will be set to 0
The compiler would report an error
The program may crash if some important data gets overwritten.
The array size would appropriately grow
-----------------------------------------------------------------------------------------------------------------
19. What does the following declaration mean?int (*ptr)[10]; 
 
ptr is array of pointers to 10 integers
ptr is a pointer to an array of 10 integers
ptr is ptr is an array of 10 integers
ptr is an pointer to array
-----------------------------------------------------------------------------------------------------------------
20. In C, if you pass an array as an argument to a function, what actually gets passed?
 
Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
-----------------------------------------------------------------------------------------------------------------
21. In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain?
 
"I am a boy\r\n\0"
"I am a boy\r\0"
"I am a boy\n\0"
"I am a boy"
-----------------------------------------------------------------------------------------------------------------
22. Which of the following is the correct order of evaluation for the below expression?z = x + y * z / 4 % 2 - 1 
 
* / % + - =
= * / % + -
/ * % - + =
 * % / - + =
-----------------------------------------------------------------------------------------------------------------
23. Which of the following correctly shows the hierarchy of arithmetic operations in C?
 
/ + * -
* - / +
+ - / *
/ * + -
-----------------------------------------------------------------------------------------------------------------
24. Which of the following is the correct usage of conditional operators used in C?
 
a>b ? c=30 : c=40;
a>b ? c=30;
max = a>b ? a>c?a:c:b>c?b:c
return (a>b)?(a:b)
-----------------------------------------------------------------------------------------------------------------
25. Which of the following function sets first n characters of a string to a given character?
 
strinit()
strnset()
strset()
strcset()
-----------------------------------------------------------------------------------------------------------------
Score =
Correct answers: