C Control StatementsC FunctionsC ArrayC PointerC Dynamic MemoryC StringC MathC StructureC UnionC File HandlingC PreprocessorC Command LineC Misc |
structure questions in c
|
#include‹ stdio.h › |
(a) 300 programmingknow
(b) 300
(c) Compiler Error
(d) Runtime Error
Answer: (c)
Explanation: When we declare a structure or union, we actually declare a new data type suitable for our purpose. So we cannot initialize values as it is not a variable declaration but a data type declaration.
2.Assume that size of an integer if it is 32 bit. What is the output of following program?
#include |
a. 4
b. 10
c. Compiler error
d. Runtime error
Answer: (C)
Explanation: In C, struct and union types cannot have static members. In C++, struct types are allowed to have static members, but union cannot have static members in C++ also.
3. What is the output of this Program.?
#include |
a) Compile time error
b) Nothing
c) Junk values
d) st st
Answer: d
Explanation: None.
4. Presence of code like “s.t.b = 10” indicates?
a) Syntax Error |
Answer: b
Explanation: None.
5. An Array elements always stored in ___________ memory location ?
a. Sequential
b. Sequential and rendom
c. Random
d. Non of these
The correct option is (a)
Explanation:
6. What will be print after execution of the program?
#include< stdio.h > |
a. Garbage value
b. 0
c. 6
d. 8
The correct option is (b)
Explanation:
When an array is initialized at the time of declaration then the remaining elements of the array is initialized to 0 by the compiler default.