C Structures-2
1. Which of the following operation is illegal in structures?
a) Typecasting of structure>
b) Pointer to a variable of the same structure>
c) Dynamic allocation of memory for structure>
d) All of the mentioned>
Answer: A
No explanation is given for this question.
2. Presence of code like “s.t.b = 10” indicates __________
a) Syntax Error
b) Structure
c) double data type
d) An ordinary variable name
Answer: B
No explanation is given for this question.
3. Which of the following are themselves a collection of different data types?
a) String
b) Structure
c) Char
d) All of the mentioned
Answer: B
No explaination is given for this question.
4. Which operator connects the structure name to its member name?
a) -
b) .
c) Both (b) and (c)
d) None of these
Answer: B
No explanation is given for this question.
5. Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) None of the mentioned
Answer: B
No explaination is given for that question.
6. Which of the following structure declaration will throw an error?
a)
struct temp{
}s;
main(){
}
b)
struct temp{
};
structtemp s;
main(){
}
c)
struct temp s;
struct temp{
};
main(){
}
d) None of the mentioned
View Answer
Answer: D
No explaination is given for this question.
7. What are the types of data allowed inside a structure?
a) int, float, double, long double
b) char, enum, union
c) pointers and Same structure type members
d) All the above
Answer: D
No explaination is given for this question.
8. What is actually passed if you pass a structure variable to a function?
a) Copy of structure variable
b) Reference of structure variable
c) Starting address of structure variable
d) Ending address of structure variable
Answer: A
Yes. If you pass a structure variable by value without & operator, only a copy of the variable is passed. So changes made within that function do not reflect in the original variable.
9. Which of the following return-type cannot be used for a function in C?
a) An array stores only elements of same type. Accessing elements is easy
b) A structure is preferred when different type elements are to be combined as a single entity
c) An array implementation has performance improvements to structure
d) All the above
Answer: B
No explaination is given for this question.
10. Which properly declares a variable of struct foo?
a) struct foo;
b) struct foo var;
c) foo;
d) int foo;
Answer: B
No explaination is given for this question.