C++ Trivia Quiz: Types Of Operators And Variables!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Clilfellac
C
Clilfellac
Community Contributor
Quizzes Created: 2 | Total Attempts: 4,030
| Attempts: 252 | Questions: 76
Please wait...
Question 1 / 76
0 %
0/100
Score 0/100
1. A class is very similar to a(n) _________.

Explanation

A class is very similar to a structure because both are used to define a blueprint for creating objects. They both contain data members and member functions that define the properties and behavior of the objects created from them. Like a structure, a class can have public and private access specifiers to control the visibility of its members. Additionally, both structures and classes can be used to group related data and functions together for better organization and modularity in programming.

Submit
Please wait...
About This Quiz
C++ Trivia Quiz: Types Of Operators And Variables! - Quiz

The quiz below is perfectly designed to test your understanding when it comes to the types and variables of the C++ programming languages. For you to pass that certification exam, you need to have a proper understanding of this topic. So, take up this quiz and see if you need... see moremore time to study well before the exam is due. see less

Personalize your quiz and earn a certificate with your name on it!
2. The default access specification of class members is _________.

Explanation

The default access specification of class members is private. This means that if no access specifier is explicitly defined for a class member, it will be accessible only within the same class and not from outside the class or its derived classes.

Submit
3. The default access specification of a struct in C++ is _________.

Explanation

The default access specification of a struct in C++ is public. This means that all members of the struct can be accessed by any code within the program without any restrictions.

Submit
4. A pointer that contains the address 0 is called a(n) __________ pointer.

Explanation

A pointer that contains the address 0 is called a null pointer. A null pointer is a special value that indicates that the pointer does not point to any valid memory location. It is often used to initialize pointers or to indicate that a pointer is not currently pointing to anything. When a null pointer is dereferenced or accessed, it typically results in a segmentation fault or an error, as the memory location it points to is not valid.

Submit
5. You should only use pointers with delete that were previously used with  __________.

Explanation

When using the delete operator in C++, it is important to only use pointers that were previously allocated using the new operator. This is because new and delete are a pair of operators that work together to dynamically allocate and deallocate memory. Using delete with a pointer that was not allocated with new can lead to undefined behavior and potential memory leaks. Therefore, it is necessary to ensure that the pointer being used with delete was indeed allocated using new.

Submit
6. When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to.

Explanation

When the indirection operator (*) is used with a pointer variable, it allows us to access and manipulate the value stored at the memory address pointed to by the pointer. In other words, it dereferences the pointer and gives us access to the actual value being pointed to. Therefore, the statement "When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to" is true.

Submit
7. A(n) _________ constructor is one that requires no arguments.

Explanation

A default constructor is one that requires no arguments. It is a constructor that is automatically generated by the compiler if no other constructors are defined in the class. This default constructor initializes the object with default values or performs default actions. It is used when an object needs to be created without any specific initialization parameters.

Submit
8. A(n) _________ is a member function that is automatically called when an object is destroyed.

Explanation

A destructor is a member function that is automatically called when an object is destroyed. It is responsible for cleaning up any resources that were allocated by the object during its lifetime. This includes freeing memory, closing files, releasing locks, or any other necessary cleanup operations. The destructor has the same name as the class, preceded by a tilde (~), and does not take any parameters. When an object goes out of scope or is explicitly deleted, the destructor is called to ensure proper cleanup.

Submit
9. Like constructors, destructors cannot have a(n) _________ type.

Explanation

Destructors, like constructors, do not have a return type because they are automatically called when an object is destroyed or goes out of scope. They do not return any value, so specifying a return type is not necessary.

Submit
10. Classes and structures in C++ are very similar.

Explanation

Classes and structures in C++ are very similar because they both allow the creation of user-defined types. They both can have data members and member functions, and can be used to create objects. The main difference between classes and structures is that by default, members of a class are private, while members of a structure are public. However, this difference can be overridden by using access specifiers. Overall, the similarities between classes and structures make them interchangeable in many cases, allowing programmers to choose the one that best suits their needs.

Submit
11. You can use the new operator to dynamically allocate an instance of a class.

Explanation

The statement is true because the new operator in programming languages like C++ and Java is used to allocate memory for a new object dynamically at runtime. This means that the memory for the object is allocated on the heap instead of the stack, allowing for more flexibility in object creation and destruction. By using the new operator, you can create instances of a class dynamically and access them using a pointer or reference.

Submit
12. Member functions may be overloaded.

Explanation

Overloading in programming refers to the ability to define multiple functions with the same name but different parameters. In the case of member functions, it means that within a class, you can have multiple functions with the same name but different parameters. This allows for more flexibility and convenience when working with objects of that class, as you can choose the appropriate function based on the arguments provided. Therefore, the statement "Member functions may be overloaded" is true.

Submit
13. A constructor whose arguments all have default values is a(n) _________ constructor.

Explanation

A constructor whose arguments all have default values is referred to as a default constructor.

Submit
14. When a program is finished with a chunk of dynamically allocated memory, it should  free it with the __________ operator.

Explanation

When a program is finished with a chunk of dynamically allocated memory, it should be freed using the "delete" operator. This operator deallocates the memory previously allocated by the "new" operator, ensuring that the memory is released and can be reused by the program or other processes. Failing to properly free dynamically allocated memory can lead to memory leaks and inefficiency in the program's execution.

Submit
15. When used as function parameters, reference variables are much easier to work with than pointers.

Explanation

Reference variables are easier to work with than pointers when used as function parameters because reference variables provide a more intuitive and convenient way to access and manipulate the data being passed to a function. Unlike pointers, reference variables do not require explicit dereferencing and can be used directly as if they were the original variables. This simplifies the syntax and reduces the chances of errors caused by mistakenly dereferencing a null pointer or accessing invalid memory locations. Additionally, reference variables are automatically bound to the original variables they reference, eliminating the need for explicit memory allocation and deallocation.

Submit
16. The new operator dynamically allocates memory.

Explanation

The statement is true because the new operator in C++ is used to dynamically allocate memory during runtime. It allows the program to request memory from the operating system and then use that memory for storing data. This dynamic allocation is useful when the size of the data needed is not known at compile time or when the program needs to allocate memory for objects that have a variable size. By using the new operator, the program can allocate and deallocate memory as needed, improving flexibility and efficiency.

Submit
17. Each byte of memory is assigned a unique address.

Explanation

In computer systems, memory is divided into small units called bytes. Each byte is assigned a unique address, which allows the computer to locate and access specific data stored in memory. This addressing scheme is essential for efficient data retrieval and manipulation by the computer's processor. Therefore, the statement that each byte of memory is assigned a unique address is true.

Submit
18. It is legal to define a pointer to a class object.

Explanation

In programming, it is legal to define a pointer to a class object. Pointers are used to store memory addresses, and they can be used to access and manipulate objects of a class. By defining a pointer to a class object, we can create dynamic instances of the class, allocate memory for them, and access their properties and methods through the pointer. This allows for more flexibility and dynamic behavior in the program.

Submit
19. Constructors may have default arguments.

Explanation

Constructors in programming are special methods that are used to initialize objects of a class. They can have parameters, which are used to pass values to the constructor during object creation. Default arguments are values that are automatically assigned to parameters if no value is provided when calling the constructor. This allows for flexibility and convenience when creating objects, as certain parameters can be optional. Therefore, constructors can indeed have default arguments, making the given answer "True" correct.

Submit
20. A(n) _________ is automatically called when an object is created.

Explanation

A constructor is automatically called when an object is created. It is a special member function of a class that is responsible for initializing the object's data members. When an object is created, the constructor is invoked automatically, and it sets the initial values for the object's attributes. This ensures that the object is in a valid state when it is first created. Constructors have the same name as the class and do not have a return type.

Submit
21.  _________ programming is centered around functions or procedures.

Explanation

Procedural programming is a programming paradigm that focuses on using procedures or functions to structure the program. In procedural programming, the program is divided into smaller, reusable procedures or functions, which are then called in a specific sequence to perform tasks. This approach allows for modular and organized code, making it easier to understand and maintain.

Submit
22. Each byte in memory is assigned a unique __________.

Explanation

In computer memory, each byte is assigned a unique address. This address is used to identify and locate the specific byte in memory. The address allows the computer to access and manipulate data stored in memory by referencing the unique location of each byte.

Submit
23.  A destructor has the same name as the class but is preceded by a(n) _________ character.

Explanation

A destructor has the same name as the class but is preceded by a tilde (~).

Submit
24. Constructors cannot have a(n) _________ type.

Explanation

Constructors cannot have a return type because their purpose is to initialize objects and allocate memory for them. When a constructor is called, it automatically creates and returns the object being constructed. Therefore, specifying a return type for a constructor is unnecessary and invalid.

Submit
25. Pointers may be compared using the relational operators.

Explanation

Pointers in programming can be compared using relational operators such as greater than, less than, equal to, etc. This is because pointers hold memory addresses, and these addresses can be compared to determine their relative positions in memory. For example, if one pointer points to a memory location that comes before another pointer, then the first pointer would be considered "less than" the second pointer. Therefore, the statement "Pointers may be compared using the relational operators" is true.

Submit
26. _________ are useful for performing initialization or setup routines in a class object.

Explanation

Constructors are special methods in a class that are used to initialize the object's state or perform setup routines. They are automatically called when an object of the class is created. Constructors are useful for setting default values for object properties, allocating memory, or performing any other necessary initializations. They ensure that the object is in a valid and usable state before any other methods or operations are performed on it.

Submit
27. When you add value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer.  

Explanation

When you add value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer. This is because pointers in C++ are used to store memory addresses, and when you perform arithmetic operations on pointers, the compiler automatically scales the value by the size of the data type. For example, if you have a pointer to an integer and you add 1 to it, the pointer will actually move forward by the size of an integer (typically 4 bytes on a 32-bit system). Therefore, the statement is true.

Submit
28. If you were writing the external definitions of the Canine class s member functions,  you would save them in a file named _________.

Explanation

The external definitions of the Canine class's member functions would be saved in a file named "Canine.cpp". This file is likely to contain the implementation of the Canine class's member functions, which are defined separately from the class declaration in a header file. By saving the external definitions in a file with the same name as the class, it helps organize the code and makes it easier to locate and maintain the implementation of the class's member functions.

Submit
29. Pointer variables are designed to hold addresses.

Explanation

Pointer variables are designed to hold addresses. This is because pointers are variables that store memory addresses as their values. They are used to point to the memory locations of other variables. By storing addresses, pointer variables allow us to access and manipulate data indirectly, by referring to the memory location where the data is stored. Therefore, the statement is true.

Submit
30. _____________ variables are designed to hold addresses.

Explanation

Pointer variables are designed to hold addresses. In programming, a pointer is a variable that stores the memory address of another variable. By using pointers, we can indirectly access and manipulate the data stored in that memory address. Therefore, pointer variables are specifically created to store addresses.

Submit
31. If you were writing the declaration of a class named Canine, what would you name  the file it was stored in? _________

Explanation

The file for the declaration of the class named Canine would be named "Canine.h". The ".h" extension is commonly used for header files in C++ to indicate that it contains the declarations of classes, functions, and variables. Naming the file "Canine.h" is a standard convention that helps to organize and identify the contents of the file.

Submit
32. A(n) _________ is a member function with the same name as the class.

Explanation

A constructor is a member function with the same name as the class. It is used to initialize objects of a class and is automatically called when an object is created. Constructors have no return type and can have parameters. They are used to set initial values for the data members of the class.

Submit
33. Class members are private by default.

Explanation

In object-oriented programming, class members refer to the variables and methods within a class. By default, these members are set to private, which means they can only be accessed within the class itself. This is done to encapsulate the internal workings of the class and prevent direct access from outside. Therefore, the statement "Class members are private by default" is true.

Submit
34. Constructors may not have a return type.

Explanation

Constructors are special methods in a class that are used to initialize objects. They do not have a return type because their main purpose is to create and set the initial state of an object. When an object is created using the constructor, it is automatically returned to the caller. Therefore, there is no need for a return type in constructors.

Submit
35. Destructors cannot take arguments.

Explanation

Destructors in programming languages like C++ are special member functions that are automatically called when an object is destroyed or goes out of scope. They are used to release resources and perform cleanup tasks. Destructors do not take any arguments because they are invoked automatically and do not need any input from the user. Therefore, the statement "Destructors cannot take arguments" is true.

Submit
36. The __________ operator can be used to determine a variable's address

Explanation

The ampersand (&) operator can be used to determine a variable's address. By placing the ampersand symbol before the variable name, the memory address of that variable is obtained. This is useful in situations where the address of a variable needs to be passed as an argument to a function or when working with pointers in programming languages like C or C++.

Submit
37.  _________ programming is centered around objects.

Explanation

Object-oriented programming is a programming paradigm that revolves around the use of objects. In this approach, data and functions are encapsulated within objects, which are instances of classes. The main goal of object-oriented programming is to organize and structure code in a way that promotes modularity, reusability, and flexibility. By focusing on objects, this programming style allows for easier maintenance and modification of code, as well as better collaboration among developers.

Submit
38. The __________ operator is used to dynamically allocate memory.

Explanation

The "new" operator is used to dynamically allocate memory. It is used in programming languages like C++ to create objects or variables at runtime, rather than at compile time. The "new" operator allocates memory for the object or variable on the heap, and returns a pointer to the allocated memory. This allows for dynamic memory management and the creation of objects or variables with a size determined at runtime.

Submit
39. When a member function s body is written inside a class declaration, the function is  _________.

Explanation

When a member function's body is written inside a class declaration, the function is considered as an inline function. This means that the function is defined and implemented within the class itself. Inline functions are typically used for small and simple functions that are called frequently, as they eliminate the overhead of function calls. By defining the function inside the class declaration, the compiler can directly substitute the function code wherever it is called, resulting in faster execution.

Submit
40. A classes responsibilities are the things the class is responsible for knowing, and actions the class must perform.

Explanation

This statement is true because in object-oriented programming, a class is responsible for defining the properties (knowledge) and methods (actions) that an object of that class can have. The class encapsulates the data and behavior of the objects it represents, and it is responsible for knowing and performing those actions.

Submit
41. In C++ the _________ is the construct primarily used to create objects.

Explanation

In C++, the "class" is the construct primarily used to create objects. A class is a blueprint or template for creating objects that define their properties and behaviors. It encapsulates data and functions together, allowing objects to be created based on the defined class. By creating objects from a class, we can utilize its properties and methods to perform various operations and achieve desired functionality in our C++ programs.

Submit
42. The ____________ operator can be used to work with the variable a pointer points to.

Explanation

The indirection operator (*) is used to work with the variable a pointer points to. It is used to access the value stored at the memory location pointed to by the pointer. By dereferencing the pointer with the indirection operator, we can manipulate the value stored at that memory location. So, in this case, the correct answer is indirection(*).

Submit
43. Under older compilers, if the new operator cannot allocate the amount of memory  requested, it returns __________.

Explanation

The new operator in older compilers returns either 0 or null if it is unable to allocate the requested amount of memory.

Submit
44. A class may only have one destructor.

Explanation

In C++, a class can only have one destructor. The destructor is a special member function that is automatically called when an object of the class goes out of scope or is explicitly deleted. It is responsible for releasing any resources that were allocated by the object during its lifetime. Having multiple destructors in a class would lead to ambiguity and confusion, as the compiler would not know which destructor to call. Therefore, it is a rule in C++ that a class can only have one destructor.

Submit
45. Creating variables while a program is running is called __________.

Explanation

Dynamic Memory Allocation refers to the process of allocating memory for variables at runtime, rather than at compile time. This allows the program to create variables as needed during program execution. It is commonly used when the size or number of variables required is not known in advance or may change during program execution. This technique is often used in programming languages like C and C++ to manage memory efficiently and avoid wasting memory resources.

Submit
46. Constructors cannot take arguments.

Explanation

This statement is false. Constructors can take arguments. In object-oriented programming, a constructor is a special method that is used to initialize objects. It can have parameters that allow the caller to provide initial values for the object's attributes. By passing arguments to the constructor, we can customize the initialization process and create objects with different initial states.

Submit
47. The & symbol is called the indirection operator.

Explanation

The & symbol is not called the indirection operator. The indirection operator in programming languages is typically represented by the * symbol, not the & symbol. The & symbol is commonly used as the address-of operator, which returns the memory address of a variable.

Submit
48. The address operator is not needed to assign the address an array to a pointer.

Explanation

The address operator is not needed to assign the address of an array to a pointer because the name of an array itself represents the address of its first element. Therefore, when assigning the address of an array to a pointer, the address operator (&) is not required.

Submit
49. Any mathematical operation, including multiplication and division, may be performed on a pointer.

Explanation

Pointers are used to store memory addresses, not numerical values. Therefore, mathematical operations like multiplication and division cannot be performed directly on pointers. These operations only make sense when performed on numerical values. Hence, the statement is false.

Submit
50. Array names can be used as _____________, and vice versa.

Explanation

Array names can be used as pointers, and vice versa, because in C and C++, the name of an array is essentially a pointer to the first element of the array. So, when we use the array name in an expression, it is automatically converted to a pointer to the first element. This allows us to perform pointer arithmetic and access elements of the array using pointer notation. Similarly, we can also assign the address of an array to a pointer variable, treating the array name as a pointer.

Submit
51. You can change the address that an array name points to.

Explanation

In C++, the name of an array is a constant pointer to the first element of the array. This means that we cannot change the address that an array name points to. The array name always points to the same memory location, which is the address of the first element of the array. Therefore, the correct answer is False.

Submit
52. Constructors may not be overloaded.

Explanation

Constructors can be overloaded in programming languages such as Java. Overloading a constructor means having multiple constructors with different parameters in the same class. This allows for creating objects with different initial states or behaviors. Overloading constructors can be useful when there are different ways to initialize an object or when default values need to be provided for certain parameters. Therefore, the statement "Constructors may not be overloaded" is false.

Submit
53. The * operator is used to get the address of a variable

Explanation

The * operator is actually used to dereference a pointer and access the value stored at the address it points to, not to get the address of a variable. Therefore, the given statement is false.

Submit
54. _________ is an object s ability to contain and manipulate its own data.

Explanation

Encapsulation refers to an object's ability to contain and manipulate its own data. It allows for the bundling of data and methods within a single unit, providing privacy and protection. By encapsulating data, an object can control its access and ensure that it is manipulated in a controlled manner. This helps in achieving data integrity, security, and code reusability. Encapsulation also promotes modular programming and reduces dependencies between different parts of a system.

Submit
55.  A(n) _________ is a key word inside a class declaration that establishes a member.

Explanation

An access specifier is a key word inside a class declaration that establishes a member. It is used to determine the visibility and accessibility of the member within the class and from outside the class. The access specifier can be public, private, or protected, and it controls the level of access that other parts of the program have to the member.

Submit
56. The address 0 is generally considered unusable.

Explanation

The address 0 is generally considered unusable because it is often reserved for the operating system or used as a null pointer. In many programming languages, attempting to access or write to address 0 can result in a segmentation fault or other errors. Therefore, it is best practice to avoid using address 0 in order to prevent these issues.

Submit
57. Constructors do not have to have the same name as the class.

Explanation

Constructors must have the same name as the class they belong to. This is because constructors are special methods that are used to initialize objects of a class. They are automatically called when an object is created, and their purpose is to set the initial values of the object's attributes. If a constructor has a different name than the class, it will not be recognized as a constructor and will not be automatically called when creating objects. Therefore, the given statement is false.

Submit
58. The two common programming methods in practice today are _________ and _________.

Explanation

The two common programming methods in practice today are procedural programming and object-oriented programming. Procedural programming focuses on a step-by-step approach to solve a problem, using procedures or functions to break down the problem into smaller tasks. Object-oriented programming, on the other hand, organizes the code around objects, which are instances of classes that encapsulate data and behavior. This allows for the reusability and modularity of code. Both methods have their own advantages and are widely used in the software development industry.

Submit
59. Array names cannot be dereferenced with the indirection operator.

Explanation

Array names can be dereferenced with the indirection operator. When an array name is dereferenced, it evaluates to the address of the first element in the array. This allows us to access and manipulate the elements of the array using pointer arithmetic. Therefore, the correct answer is False.

Submit
60. A class may not have a constructor with no parameter list, and a constructor whose arguments all have default values.

Explanation

This statement is true because a constructor with no parameter list is called a default constructor, and it is automatically generated by the compiler if no constructor is explicitly defined in the class. However, if a class has a constructor with arguments that all have default values, it is not considered a default constructor. Therefore, a class cannot have both a default constructor and a constructor with arguments that have default values.

Submit
61. All public members of a class must be declared together.

Explanation

This statement is false. In object-oriented programming, the members of a class can be declared in different sections, such as public, private, or protected. The public members of a class can be declared separately from the private or protected members. This allows for better organization and encapsulation of the class's functionality.

Submit
62. Destructors may return a value.

Explanation

Destructors in programming languages such as C++ do not have a return type, including void. They are used to clean up resources and memory allocated by the object and are automatically called when the object goes out of scope or is explicitly deleted. Therefore, destructors do not return a value.

Submit
63. A class may have more than one constructor, as long as each has a different _________.

Explanation

A class may have more than one constructor, as long as each has a different parameter list. This means that each constructor must have a unique combination of parameters, either in terms of the number of parameters or the types of parameters. Having multiple constructors allows for different ways to initialize objects of the class, providing flexibility and accommodating different scenarios or requirements.

Submit
64. The & operator dereferences a pointer.

Explanation

The & operator in C++ is used to obtain the address of a variable, not to dereference a pointer. To dereference a pointer and access the value it points to, the * operator is used. Therefore, the given statement is incorrect.

Submit
65. Private members must be declared before public members.

Explanation

Private members do not necessarily have to be declared before public members. The order of declaration does not affect the accessibility of members. The access modifiers, such as private and public, determine the visibility of members, not their order of declaration. Therefore, the given statement is false.

Submit
66. Members of a struct are private by default.

Explanation

The members of a struct are public by default, not private. This means that they can be accessed and modified directly from outside the struct. If the members were private, they would only be accessible from within the struct itself or through friend functions or classes. Therefore, the correct answer is False.

Submit
67. Defining a class object is often called the _________ of a class.

Explanation

When we define a class object, it means that we are creating an instance of that class. This process is known as instantiation. It involves allocating memory for the object and initializing its attributes and methods. The instantiated object can then be used to access and manipulate the data and behavior defined in the class. Therefore, the correct answer is "instantiation".

Submit
68. In using a pointer with the delete operator, it is not necessary for the pointer to have been previously used with the new operator.

Explanation

The delete operator is used to deallocate the memory that was previously allocated using the new operator. If a pointer has not been previously used with the new operator to allocate memory, trying to delete it will result in undefined behavior. Therefore, it is necessary for the pointer to have been previously used with the new operator in order to safely use the delete operator.

Submit
69. A class may only have one default _________ and one _________.

Explanation

In object-oriented programming, a constructor is a special method that is automatically called when an object of a class is created. It is used to initialize the object's state. A class can have only one default constructor, which is a constructor with no parameters.

Similarly, a destructor is a special method that is automatically called when an object is destroyed or goes out of scope. It is used to release any resources or memory allocated by the object. A class can also have only one destructor.

Therefore, the correct answer is that a class may only have one default constructor and one destructor.

Submit
70. 59. A private member function may be called from a statement outside the class, as long as the statement is in the same program as the class declaration.  

Explanation

A private member function is only accessible within the class itself. It cannot be called from outside the class, even if it is in the same program. Only public member functions can be called from outside the class. Therefore, the statement is false.

Submit
71. When an array of objects is defined, the constructor is only called for the first element.

Explanation

When an array of objects is defined, the constructor is called for each element in the array. This means that the constructor will be invoked for every object in the array, not just the first element. Therefore, the correct answer is False.

Submit
72. To find the classes needed for an object-oriented application, you identify all of the verbs in a description of the problem domain.

Explanation

The statement is false because to find the classes needed for an object-oriented application, you actually identify all of the nouns (objects) in a description of the problem domain. Classes represent objects in object-oriented programming, so identifying the nouns helps determine the appropriate classes to create. Verbs, on the other hand, represent the behavior or actions that the objects can perform, which can be implemented as methods within the classes.

Submit
73. A(n) _________ may be used to pass arguments to the constructors of elements in an  object array.

Explanation

An initialization list is a feature in programming that allows passing arguments to the constructors of elements in an object array. It is a convenient way to initialize objects in an array by specifying the arguments directly in the array declaration. This helps in setting up the initial state of the objects in the array without the need for separate initialization statements.

Submit
74. Members of a class object may be accessed through a pointer to the object by using the _________ operator.

Explanation

The arrow operator (->) is used to access members of a class object through a pointer to the object. It is used when we have a pointer to an object and want to access its members like variables or functions. The arrow operator is used instead of the dot operator (.) which is used to access members of an object directly without using a pointer.

Submit
75. All private members of a class must be declared together.

Explanation

Private members of a class do not need to be declared together. In object-oriented programming, private members are declared within the class and can be scattered throughout the class definition. They are only accessible within the class and cannot be accessed by other classes or objects. Therefore, there is no requirement for private members to be declared together.

Submit
76. A pointer variable that has not been initialized is called a null pointer.

Explanation

A pointer variable that has not been initialized is not called a null pointer. It is called an uninitialized pointer. A null pointer is a specific value assigned to a pointer variable that indicates that it is not pointing to any memory location.

Submit
View My Results

Quiz Review Timeline (Updated): Feb 17, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Feb 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 25, 2013
    Quiz Created by
    Clilfellac
Cancel
  • All
    All (76)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
A class is very similar to a(n) _________.
The default access specification of class members is _________.
The default access specification of a struct in C++ is _________.
A pointer that contains the address 0 is called a(n) __________...
You should only use pointers with delete that were previously used...
When the indirection operator is used with a pointer variable, you are...
A(n) _________ constructor is one that requires no arguments.
A(n) _________ is a member function that is automatically called when...
Like constructors, destructors cannot have a(n) _________ type.
Classes and structures in C++ are very similar.
You can use the new operator to dynamically allocate an instance of a...
Member functions may be overloaded.
A constructor whose arguments all have default values is a(n)...
When a program is finished with a chunk of dynamically allocated...
When used as function parameters, reference variables are much easier...
The new operator dynamically allocates memory.
Each byte of memory is assigned a unique address.
It is legal to define a pointer to a class object.
Constructors may have default arguments.
A(n) _________ is automatically called when an object is created.
 _________ programming is centered around functions or...
Each byte in memory is assigned a unique __________.
 A destructor has the same name as the class but is preceded...
Constructors cannot have a(n) _________ type.
Pointers may be compared using the relational operators.
_________ are useful for performing initialization or setup routines...
When you add value to a pointer, you are actually adding that...
If you were writing the external definitions of the Canine class s...
Pointer variables are designed to hold addresses.
_____________ variables are designed to hold addresses.
If you were writing the declaration of a class named Canine, what...
A(n) _________ is a member function with the same name as the class.
Class members are private by default.
Constructors may not have a return type.
Destructors cannot take arguments.
The __________ operator can be used to determine a variable's...
 _________ programming is centered around objects.
The __________ operator is used to dynamically allocate memory.
When a member function s body is written inside a class declaration,...
A classes responsibilities are the things the class is responsible for...
In C++ the _________ is the construct primarily used to create...
The ____________ operator can be used to work with the variable a...
Under older compilers, if the new operator cannot allocate the amount...
A class may only have one destructor.
Creating variables while a program is running is called __________.
Constructors cannot take arguments.
The & symbol is called the indirection operator.
The address operator is not needed to assign the address an array to a...
Any mathematical operation, including multiplication and division, may...
Array names can be used as _____________, and vice versa.
You can change the address that an array name points to.
Constructors may not be overloaded.
The * operator is used to get the address of a variable
_________ is an object s ability to contain and manipulate its own...
 A(n) _________ is a key word inside a class declaration that...
The address 0 is generally considered unusable.
Constructors do not have to have the same name as the class.
The two common programming methods in practice today are _________ and...
Array names cannot be dereferenced with the indirection operator.
A class may not have a constructor with no parameter list, and a...
All public members of a class must be declared together.
Destructors may return a value.
A class may have more than one constructor, as long as each has a...
The & operator dereferences a pointer.
Private members must be declared before public members.
Members of a struct are private by default.
Defining a class object is often called the _________ of a class.
In using a pointer with the delete operator, it is not necessary for...
A class may only have one default _________ and one _________.
59. A private member function may be called from a statement outside...
When an array of objects is defined, the constructor is only called...
To find the classes needed for an object-oriented application, you...
A(n) _________ may be used to pass arguments to the constructors of...
Members of a class object may be accessed through a pointer to the...
All private members of a class must be declared together.
A pointer variable that has not been initialized is called a null...
Alert!

Advertisement