MCQ PORTAL

Back to All Topics

Structures

Showing 12 of 12 questions in this topic

Start Practice Mode

Answer Green MarksON

Correct answers are highlighted in green

C054Structures • Definition
Most ImportantEasy

Q1.Which keyword is used to define a structure in C?

A
struct
Correct answer
B
structure
C
class
D
record
C055Structures • Member access
Most ImportantMedium

Q2.Which operator accesses a member of a structure using a structure VARIABLE?

A
-> (arrow)
B
. (dot)
Correct answer
C
:: (scope)
D
* (star)
C142Structures • Concept
Most ImportantMedium

Q3.A structure is used to group together variables that are:

A
all of the same type
B
of different data types
Correct answer
C
only integers
D
only pointers
C143Structures • Member access
Most ImportantEasy

Q4.If s is a structure variable, how do you access its member age?

A
s->age
B
s.age
Correct answer
C
age.s
D
s[age]
C056Structures • Concept
ImportantMedium

Q5.A structure in C can hold:

A
only integers
B
only variables of the same type
C
members of different data types
Correct answer
D
only functions
C057Structures • Nested structure
ImportantMedium

Q6.A structure defined inside another structure is called a:

A
array of structure
B
nested structure
Correct answer
C
union
D
self-referential structure
C058Structures • Array of structures
ImportantMedium

Q7.What does struct student s[10]; declare?

A
10 structures named student
B
an array of 10 student structures
Correct answer
C
a structure with 10 members
D
a syntax error
C144Structures • Nested access
ImportantMedium

Q8.To access the year inside a nested structure as s.dob.year, you use the dot operator:

A
once
B
twice
Correct answer
C
three times
D
not at all
C145Structures • Definition syntax
ImportantMedium

Q9.A structure definition must end with:

A
a colon
B
a semicolon after the closing brace
Correct answer
C
a full stop
D
nothing
C147Structures • Structure assignment
ImportantMedium

Q10.Can one structure variable be assigned to another of the same type directly?

A
yes, member by member is copied
Correct answer
B
no, never
C
only if it has no arrays
D
only pointers can be copied
C059Structures • Arrow operator
OtherMedium

Q11.The arrow operator -> is used to access structure members through a:

A
structure variable
B
pointer to a structure
Correct answer
C
array
D
function
C146Structures • Memory
OtherHard

Q12.Memory for a structure is allocated when:

A
the structure is defined
B
a structure variable is declared
Correct answer
C
the program ends
D
a member is printed