
chapter 4 -Structures
Authored by MAHANI BINTI ZAKARIA (POLIMAS)
Information Technology (IT)
University
Used 7+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes a structure in C++?
A group of similar data types stored in a single variable
A data type used to store characters only
A user-defined data type that groups variables of different types
A pointer that stores memory addresses
Answer explanation
A structure (struct) in C++ allows grouping of variables of different data types under a single name. This is useful when representing real-world entities such as a student, which may have name (string), age (int), and grade (char).
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the key difference between an array and a structure?
Arrays store values of different types; structures store only one type
Arrays are user-defined; structures are built-in
Arrays store values of the same type; structures can store values of different types
Structures use more memory than arrays
Answer explanation
Arrays in C++ are used to store multiple values of the same data type, whereas structures can combine values of different data types (e.g., int, char, string) under one name.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which syntax correctly declares a structure in C++?
structure Student { string name; int age; };
struct Student = { string name; int age; };
struct Student { string name; int age; };
Student structure { string name; int age; };
Answer explanation
The correct keyword to declare a structure is struct, followed by the structure name and a block containing the members.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access a member of a structure variable named student1 with a member name?
student1->name;
student1:name;
student1.name;
student1->name();
Answer explanation
When using a structure variable (not a pointer), use the dot operator . to access its members. The arrow operator -> is used only with structure pointers.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens when you define a structure but do not create a variable of it?
The program will run with warnings
The compiler ignores the structure
It reserves memory for the structure
No memory is allocated until a structure variable is created
Answer explanation
Defining a structure only creates a new data type. Memory is only allocated when you declare variables of that structure type.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
8 questions
Fundametal DS Training 2025 - Day 2
Quiz
•
University
10 questions
Introduction & Basic Program Structure
Quiz
•
University
10 questions
Computer Networking
Quiz
•
University
10 questions
Week2 上周知识点回顾
Quiz
•
University
10 questions
AverageRound
Quiz
•
University
10 questions
Backend Development
Quiz
•
University
10 questions
Linked List Quiz
Quiz
•
University
9 questions
Condition Programming Quiz
Quiz
•
1st Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
20 questions
Endocrine System
Quiz
•
University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
30 questions
W25: PSYCH 250 - Exam 2 Practice
Quiz
•
University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
38 questions
Unit 8 Review - Absolutism & Revolution
Quiz
•
10th Grade - University