When using default arguments in overloaded functions, care should be taken to ensure that there isn't any ________ among function signatures.

  • ambiguity
  • duplication
  • inconsistency
  • redundancy
In C#, if overloaded functions have default arguments that could lead to ambiguity in function calls, it's important to avoid such situations. Ambiguity arises when the compiler cannot determine which overloaded function to call because the arguments provided match multiple overloaded versions.

For a function to accept a variable number of arguments, it should use the keyword ______.

  • extern
  • static
  • varargs
  • virtual
For a function to accept a variable number of arguments, it should use the keyword "varargs" (short for variable-length argument list). Varargs is used in C and some C++ code to create functions that can accept a variable number of arguments. This is often used in functions like printf(), scanf(), and other cases where the number of arguments can vary.

In terms of precedence, the operator ______ has higher precedence than the && operator.

  • !
  • %
  • *
  • +
In C++, the "*" (multiplication) operator has higher precedence than the "&&" (logical AND) operator. This means that when evaluating expressions, the multiplication operator will be evaluated before the logical AND operator. Understanding operator precedence is crucial for writing correct and efficient C++ code.

Global variables, when declared outside all functions, have ______ storage duration by default.

  • auto
  • extern
  • static
  • volatile
When global variables are declared outside all functions, they have static storage duration by default. Static storage duration means they exist for the entire program's lifetime.

The data type used for storing raw memory addresses is ______.

  • address_t
  • char
  • intptr_t
  • pointer
The data type used for storing raw memory addresses is intptr_t, which is an integer type designed to hold a memory address. It ensures that memory addresses are correctly represented, allowing you to work with pointers and addresses in a portable way.

The actual body of a function, where the detailed processing statements are written, is termed as function ______.

  • Prototype
  • Definition
  • Signature
  • Implementation
The term for the actual body of a function where detailed processing statements are written is "Implementation." It's in the implementation that you provide the logic and functionality for the function. The other options have different meanings: Prototype is a declaration of the function, Definition is a broader term encompassing various aspects of a function, and Signature refers to the function's name and parameter list.

Chris has a complex expression with multiple operators. He is unsure about the order of operations. Which principle should he revisit to clarify the order?

  • BODMAS
  • FIFO
  • LIFO
  • PEMDAS
Chris should revisit the PEMDAS principle, which stands for Parentheses, Exponents, Multiplication and Division (from left to right), and Addition and Subtraction (from left to right). It helps clarify the order of operations in complex mathematical expressions.

In C++, which operator is right-to-left associative?

  • Addition Operator (+)
  • Assignment Operator (=)
  • Multiplication Operator (*)
  • Ternary Conditional Operator (?)
The ternary conditional operator (a ? b : c) in C++ is right-to-left associative. This means that it evaluates from right to left, making it different from most other operators in the language.

Lisa wants to check the day of the week and execute different code for each day. Which control structure would be the most appropriate for her use?

  • For Loop
  • If-Else Statements
  • Switch Statement
  • While Loop
For Lisa's scenario, the most appropriate control structure is the "Switch Statement." A switch statement allows you to evaluate a single expression against multiple possible constant values, making it ideal for executing different code blocks based on the day of the week.

When using a switch statement, if a case doesn't contain a break, it will cause a behavior known as ______.

  • exception
  • fall-through
  • overflow
  • recursion
In C++, when a case within a switch statement doesn't contain a break statement, it leads to fall-through behavior. This means that execution will continue from the matched case statement to the subsequent case(s) until a break is encountered or the switch block ends. It's a powerful feature for handling multiple cases with the same code, but it should be used intentionally.