C Programming Questions Answers - Chapter 1 Online Quiz Test
-
1. We can insert pre written code in a C program by using
- #read
- #get
- #include
- #put
-
2. The first expression in a for loop is
- Step value of loop
- Value of the counter variable
- Any of above
- None of above
-
3. Break statement is used for
- Quit a program
- Quit the current iteration
- Both of above
- None of above
-
4. Continue statement used for
- To continue to the next line of code
- To stop the current iteration and begin the next iteration from the beginning
- To handle run time error
- None of above
-
5. What will be output of
#include
void main()
{
char test =`S`;
printf("\n%c",test);
}- S
- Error
- Garbage value
- None of above
-
6. Due to variable scope in c
- Variables created in a function cannot be used another function
- Variables created in a function can be used in another function
- Variables created in a function can only be used in the main function
- None of above
-
7. What will be the output of following program
#include
main()
{
int x,y = 10;
x = y * NULL;
printf(\"%d\",x);
}
- error
- 0
- 10
- Garbage value
-
8. Difference between calloc() and malloc()
- calloc() takes a single argument while malloc() needs two arguments
- malloc() takes a single argument while calloc() needs two arguments
- malloc() initializes the allocated memory to ZERO
- calloc() initializes the allocated memory to NULL
-
9. Exit() is same as return
- TRUE
- FALSE
-
10. calloc() belongs to which library
- stdlib.h
- malloc.h
- calloc.h
- None of above
-
11. If include files can be nested
- Yes
- No
-
12. Which of the following below is/are valid C keywords
- integer
- int
- null
- none of above
-
13. total number of keywords in C are
- 30
- 32
- 48
- 132
-
14. What is use of \r in c
- used to insert a vertical tab
- used to insert a tab
- places cursor at the end of line
- places cursor at the start of line
-
15. Out of following program :
float x = 10.7;
int i;
i = (int) x;
print i;
- null
- error
- 10
- garbage value
-
16. rand() function returns
- float value
- integer value
- any type
- none of above
-
17. The compiler in C ignores all text till the end of line using
- //
- /
- */
- none of above
-
18. Which operator in c can't be overloaded
- %
- +
- ::
- -
-
19. Which operator has the highest priority
- ()
- []
- *
- /
-
20. What is the purpose of getc()
- read a character from STDIN
- read a character from a file
- read all file
- read file random