WorksheetsC++ Fundamentals
Total questions: 10
Worksheet time: 5mins
What is a struct in C++?
A struct in C++ is a built-in data type for storing integers.
A struct in C++ is used for defining functions.
A struct in C++ is a keyword for loops.
A struct in C++ is a user-defined data type that allows you to group different types of variables under one name.
Who developed the C++ programming language?
Linus Torvalds
Bjarne Stroustrup
Tim Berners-Lee
Dennis Ritchie
What are the different data types available in C++?
int, float, double, char, bool, arrays, structures, classes
string
boolean
pointers
float
How can you perform iterations in C++?
Iterations in C++ are done by using 'switch' statements.
Performing iterations in C++ involves using 'goto' statements.
You can perform iterations in C++ using 'if-else' statements.
You can perform iterations in C++ using loops like 'for', 'while', or 'do-while'.
Why are structs used in C++?
To perform mathematical operations efficiently
To handle exceptions in the code
To create user-defined data types that can hold multiple variables of different data types under a single name.
To improve the readability of comments
When was C++ first released?
1985
2005
1975
1990
Give an example of a primitive data type in C++.
double
string
float
int
What is the syntax for a 'for' loop in C++?
for(initialization; condition; increment) {}
for(initialization; condition; decrement) {}
for(initialization; condition; increment/decrement) {}
for(initialization; condition; increment/decrement) ;
What is the significance of the 'auto' keyword in C++?
It is used for type inference in C++.
It is a deprecated keyword in C++.
It is used for memory allocation in C++.
It is used for defining global variables in C++.
What are the advantages of using C++ over other programming languages?
C++ is not compatible with C code
C++ offers high performance, strong hardware control, extensive libraries, and compatibility with C code.
C++ has limited libraries
C++ is slower than other languages
