What keyword is used to declare a function without any return type?

  • function
  • int
  • none
  • void
In C# and many other programming languages, the keyword void is used to declare a function that doesn't return any value. Functions declared with void indicate that they perform a task but don't produce a result that needs to be returned.

Lily is receiving an error that says a particular header file is missing. What part of her program structure might she have forgotten to include?

  • #include Directives
  • Function Prototypes
  • Header Guards
  • using namespace std;
Lily might have forgotten to include the necessary #include directives in her program. These directives are used to include header files, and missing them can result in compilation errors due to undefined references.

Alice is developing a program that should run uniformly across multiple platforms. She is concerned about the size of data types. Which feature of C++ should she explore?

  • Data Type Modifiers
  • Preprocessor Directives
  • Standard Library Features
  • Standard Template Library (STL)
Alice should explore the Data Type Modifiers in C++. Data Type Modifiers like int32_t and int64_t are part of the header and ensure consistent data size across platforms, addressing her concern about data type size and platform uniformity.

Sarah wants to create a menu-driven program where the menu is displayed repeatedly until the user selects the "Exit" option. What control structure can assist her in achieving this?

  • Do-While Loop
  • For Loop
  • If-Else Statements
  • Switch Statement
To create a menu-driven program like Sarah's, the "Do-While Loop" is the most appropriate. It ensures that the menu is displayed at least once and then repeatedly as long as the user doesn't choose the "Exit" option, providing the desired functionality.

If a function parameter has a default argument, must all subsequent parameters also have default arguments?

  • It depends
  • No, never
  • Yes, always
  • Yes, in some cases
No, never. In C++, if a function parameter has a default argument, subsequent parameters are not required to have default arguments. Default arguments allow calling a function with fewer arguments, and the missing arguments will take on their default values.

Which of the following changes will NOT result in a different overloaded function in C++?

  • Changing the data type of parameters
  • Changing the number of parameters
  • Changing the order of parameters
  • Changing the return type of a function
In C++, changing only the return type of a function does not result in a different overloaded function. Overloaded functions are distinguished based on the number or type of parameters, not the return type.

Which data type is most suitable for storing a character in C++?

  • Char
  • Float
  • Int
  • String
The 'char' data type is most suitable for storing a single character in C++. It can hold characters like 'A', 'B', '1', '$', etc.

What do you call the process of calling a function in your program?

  • Function Declaration
  • Function Definition
  • Function Invocation
  • Function Prototype
The process of calling a function in your program is known as "Function Invocation" or simply "Calling a Function." This is where you use the function name followed by parentheses to execute the code within the function.

Tom is creating a game where the player's health decreases over time until it reaches zero. To implement this, which loop structure is best suited?

  • Do-While Loop
  • For Loop
  • Foreach Loop
  • While Loop
For Tom's game, a "While Loop" is the best choice. This loop continuously executes a block of code as long as a specified condition is true, making it suitable for decrementing the player's health until it reaches zero.

If no cases match in a switch statement and there's no default clause, then none of the switch blocks will execute.

  • catch
  • final
  • else
  • default
In a switch statement, if no cases match and there's no default clause, none of the switch blocks will execute. The default clause provides a fallback option to handle cases where none of the defined cases match the switch expression.