# Bhs Junior Quiz - C++ Conditional Statement -if

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Missyoung
M
Missyoung
Community Contributor
Quizzes Created: 2 | Total Attempts: 2,975
Questions: 5 | Attempts: 1,179  Settings  Welcome Juniors to using Proprofs on-line assessment. This is the first of many on-line assessments that will be done this semester. This is a timed quiz so work efficiently.

• 1.

• 2.

### The programming language of C++ was written by Bjarne Stroustrup.

• A.

True

• B.

False

A. True
Explanation
Bjarne Stroustrup is the creator of the C++ programming language. He developed C++ as an extension of the C programming language, adding object-oriented programming features. Therefore, the statement that the programming language of C++ was written by Bjarne Stroustrup is true.

Rate this question:

• 3.

### In a conditional statement to determine if the sum of x and y is equal to z, then a = x+y, what is the actual condition in C++?

• A.

If(sum=z) { a=x+y; }

• B.

Sum = z

• C.

If (x+y=z)

• D.

X+y=z

D. X+y=z
Explanation
The actual condition in C++ is "x+y=z". This condition checks if the sum of x and y is equal to z. If it is true, then the code block inside the if statement will be executed, which assigns the value of x+y to the variable a.

Rate this question:

• 4.

### To determine whether or not a person is an adult based on their current age, the most appropriate conditional statement to use is the _______________________ statement.

if
if-else
if-else
loop
Explanation
The most appropriate conditional statement to use when determining whether or not a person is an adult based on their current age is the "if" statement. This statement allows for a single condition to be checked and a corresponding action to be taken if the condition is true. However, if additional conditions need to be checked and different actions need to be taken based on those conditions, the "if-else" statement or the "if-else if-else" statement can be used. A loop statement, on the other hand, is used for repeating a block of code multiple times.

Rate this question:

• 5.

### Select the correct code for the following statement: If the name of a person is definitely Joe, say hello.

• A.

If(nam=Joe) {cout

• B.

If(nam!='Joe') {cout

• C.

If(nam=="Joe") {cout

• D.

If(nam=="Joe") {cout>>"hello"}

C. If(nam=="Joe") {cout
Explanation
The correct code for the given statement is "if(nam=="Joe") {cout". This code checks if the value of the variable "nam" is equal to the string "Joe". If it is, then it will execute the code inside the curly braces, which in this case is printing "hello".

Rate this question:

Related Topics Back to top