C Programming Question Answer

We encourage our readers to provide feedback and ask question if required. We have tried our best to avoid any errors/ misprints,but if found by our readers please let us know.You can reach us at info@ingenuitydias.com
C Question Bank
Differences between Mutex And Semaphore
Difference Between Process and Thread
Storage Classes Interview Q&A
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
- 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 variables 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
- 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. What is dangling pointer in c
- if pointer is pointing to a memory location from where variable has been deleted
- if pointer is assigned to more than one variable
- if pointer is not defined properly
- none of above
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
Answer: Option 1
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
21. Can getch() be used to echo the input
- Yes
- No
22. If (*p) and **p is same
- No
- Yes
23. Difference between structures and unions is
- We can define functions within structures but not within a union
- We can define functions within union but not within a structure
- The way memory is allocated
- There is no difference
24. What among following is true about stack
- stack cannot reuse its memory
- all elements are of different datatypes
- all operation done at one end
- none of above
25. To access the members of structure which symbol is used
- *
- -
- ,
- .
26. A member is a
- Variable in a structure
- Datatype of structure
- Structure pointer
- None of above
27. Structures can be used
- to hold different datatypes
- have pointers to structures
- to assign to one another
- all of above
28. UML meaning is
- Unique modeling language
- Unified modeling language
- Unified modern language
- Unified master language
29. printf() belongs to which library of c
- stdlib.h
- stdio.h
- stdout.h
- stdoutput.h
30. A variable in c
- must have a valid datatype
- can't have a name same as keyword
- must have a name starting with a character
- All of above
It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.
ReplyDelete