C++ Structures vs Classes Quiz

C++ Structures vs Classes Quiz

Assessment

Interactive Video

Computers

9th - 10th Grade

Hard

Created by

Nancy Jackson

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main topic of this tutorial?

Introduction to C++

Structures vs Classes in C++

Advanced C++ Programming

C++ for Beginners

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true about structures in C++?

Structures are private by default.

Structures are meant for object-oriented programming.

Structures cannot have member functions.

Structures are public by default.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default access specifier for classes in C++?

Internal

Protected

Private

Public

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can structures be used in C++?

To group items of different types into a single type

To create a single data type

To implement inheritance

To define private methods

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a key similarity between structures and classes in C++?

Both are private by default

Both can have constructors

Both cannot have member functions

Both are used for procedural programming

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the code example, what error occurs when trying to access a private member?

Compilation error

Access violation error

Runtime error

Syntax error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What must be done to access private members of a class in C++?

Use a reference

Use a pointer

Declare them as public

Use a friend function

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?