Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Fundamentals

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is a struct in C++?

a)

A struct in C++ is a built-in data type for storing integers.

b)

A struct in C++ is used for defining functions.

c)

A struct in C++ is a keyword for loops.

d)

A struct in C++ is a user-defined data type that allows you to group different types of variables under one name.

2.

Who developed the C++ programming language?

a)

Linus Torvalds

b)

Bjarne Stroustrup

c)

Tim Berners-Lee

d)

Dennis Ritchie

3.

What are the different data types available in C++?

a)

int, float, double, char, bool, arrays, structures, classes

b)

string

c)

boolean

d)

pointers

e)

float

4.

How can you perform iterations in C++?

a)

Iterations in C++ are done by using 'switch' statements.

b)

Performing iterations in C++ involves using 'goto' statements.

c)

You can perform iterations in C++ using 'if-else' statements.

d)

You can perform iterations in C++ using loops like 'for', 'while', or 'do-while'.

5.

Why are structs used in C++?

a)

To perform mathematical operations efficiently

b)

To handle exceptions in the code

c)

To create user-defined data types that can hold multiple variables of different data types under a single name.

d)

To improve the readability of comments

6.

When was C++ first released?

a)

1985

b)

2005

c)

1975

d)

1990

7.

Give an example of a primitive data type in C++.

a)

double

b)

string

c)

float

d)

int

8.

What is the syntax for a 'for' loop in C++?

a)

for(initialization; condition; increment) {}

b)

for(initialization; condition; decrement) {}

c)

for(initialization; condition; increment/decrement) {}

d)

for(initialization; condition; increment/decrement) ;

9.

What is the significance of the 'auto' keyword in C++?

a)

It is used for type inference in C++.

b)

It is a deprecated keyword in C++.

c)

It is used for memory allocation in C++.

d)

It is used for defining global variables in C++.

10.

What are the advantages of using C++ over other programming languages?

a)

C++ is not compatible with C code

b)

C++ offers high performance, strong hardware control, extensive libraries, and compatibility with C code.

c)

C++ has limited libraries

d)

C++ is slower than other languages