ExamVeda
Login
Home
1
You can use C++ as a procedural, as well as an object-oriented, language
Discuss
Answer & Solution
Answer: Option A
Solution:
A. True.

C++ is a multi-paradigm programming language, which means it supports multiple programming paradigms, including procedural and object-oriented programming.

Procedural programming is a programming paradigm that emphasizes the use of procedures or functions to organize the program into small, reusable blocks of code. C++ supports procedural programming through the use of functions, structures, and arrays.

Object-oriented programming, on the other hand, is a programming paradigm that emphasizes the use of objects, which are instances of classes, to organize the program. C++ supports object-oriented programming through the use of classes, inheritance, polymorphism, and other object-oriented concepts.

Thus, C++ can be used as both a procedural and an object-oriented language, depending on the needs of the programmer and the requirements of the problem being solved.
2
A default catch block catches
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
3
Adding a derived class to a base class requires fundamental changes to the base class
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
4
Format flags may be combined using
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
5
The use of the break statement in a switch statement is
Discuss
Answer & Solution
Answer: Option A
Solution:
Correct Answer: A: optional

Here's why:

In a `switch` statement, the `break` statement is optional.

How a `switch` works (Simplified):
A `switch` statement checks a variable against different `case` values.
If a `case` matches, the code under that `case` starts executing.

`break`'s role:
The `break` statement tells the program to immediately exit the `switch` statement.

What happens without `break`?
If you *don't* include a `break` after a `case`, the program will "fall through" to the next `case` and continue executing code there, even if that next `case` doesn't match the original variable's value.
This "fall-through" behavior can be useful in some situations, but often you want to execute only the code associated with a single `case`.

Example:
Imagine a traffic light.
`switch (trafficLightColor)` {
`case "red":`
    `Stop();`
    `break;` // Without this, it might also execute the "yellow" code!
`case "yellow":`
    `SlowDown();`
    `break;`
`case "green":`
    `Go();`
    `break;`
`}`

So, while `break` is very common and important for controlling the flow of execution in a `switch`, it's not required by the C++ language. The program will still compile and run (though perhaps not as intended) without it.
6
To expose a data member to the program, you must declare the data member in the _____ section of the class
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
7
Evaluate the following expression: 3 >6&&7>4
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
8
Which of the following are valid characters for a numeric literal constant?
Discuss
Answer & Solution
Answer: Option E
No explanation is given for this question. Let's Discuss on Board
9
A function that changes the state of the cout object is called a(n) _____
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
10
A C++ program contains a function with the header int function(double d, char c). Which of the following function headers could be used within the same program?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board