C Question Bank

C Programming
What is Storage class?
Dangling and Wild Pointers
Unions-Why And When To Use
1. Difference between structure and union 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
Answer: Option C
2. 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
Answer: Option C
3. To access the members of structure which symbol is used
- *
- -
- ,
- .
4. A member is a
- Variable in a structure
- Datatype of structure
- Structure pointer
- None of above
Answer: Option A
5. Structures can be used
- to hold different datatypes
- have pointers to structures
- to assign to one another
- all of above
Answer: Option D
6. UML meaning is
- Unique modeling language
- Unified modeling language
- Unified modern language
- Unified master language
Answer: Option B
7. printf() belongs to which library of c
- stdlib.h
- stdio.h
- stdout.h
- stdoutput.h
Answer: Option B
8. 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
Answer: Option D
9. What is correct order of precedence in C
- Addition, Division, Modulus
- Addition, Modulus, Division
- Multiplication, Substration, Modulus
- Modulus, Multiplication, Substation
Answer: Option D
10. What is true about fputs function
- write to a file
- takes two parameters
- requires a file pointer
- all of above
Answer: Option D
11. Adding to a pointer that points to an array will
- Cause an error
- Increase the value of the element that the pointer is pointing to
- Cause the pointer to point to the next element in the array
- None of above
Answer: Option C
12. Which is invalid name of identifier
- world
- addition23
- test_name
- factorial
Answer: Option C
13. 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
Answer: Option A
14. Wild pointer in C
- if pointer is pointing to a memory location from where variable has been deleted
- if pointer has not been initialized
- if pointer has not defined properly
- if pointer pointing to more than one variable
Answer: Option B
15. Disadvantage of array in C is
- We can easily access each element
- It is necessary to declare too many variables
- It can store only one similar type of data
- None of above
Answer: Option C
16. What is prototype of a function in C
- It is the return type of a function
- It is the return data of the function
- It is declaration of a function
- It is a datatype
Answer: Option C
17. Any type of modification on the parameter inside the function will reflect in actual variable value can be related to
- call by value
- call by reference
- both of above
- none of above
Answer: Option B
18. Size of void pointer is
- 1 byte
- 2 byte
- 4 byte
- 8 byte
Answer: Option B
19. What is wild pointer in c
- a pointer which we need to write in future
- a pointer which has bad naming convention
- a pointer which has no limit
- a point which has not initialised
Answer: Option D
20. 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
Answer: Option B
21. What will be output of
#include
void main()
{
char test =`S`;
printf("\n%c",test);
}
- S
- Error
- Garbage value
- None of above
Answer: Option A