Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ questions; I need answer for these questions. 1. True/False: Before a comput

ID: 3689852 • Letter: C

Question

C++ questions;

I need answer for these questions.

1. True/False: Before a computer can execute a program written in a high level language, such as C++, it must be translated into object code.

2. Characters or symbols that perform operations on one or more operands are

op codes.

operators.

program ops.

syntax.

none of the above.

3. Creating a program requires many steps. Three of these are ?

program design, writing source code, and testing.

input, processing, and output

keywords, operators, and punctuation  

syntax, logic, and error handling.

none of the above.

4.Memory locations that can hold data are called ?

operands.

operators.

syntax.

variables.

none of the above.

5. Which of the following statements doubles the value stored in answer?

answer += 2;

answer *= 2;

answer = answer * 2;

All three of the above

Both B and C, but not A

6.

When the final value of an expression is assigned to a variable, it will be converted to

the largest possible data type.

the data type of the expression.

the smallest possible data type.

the data type of the variable.

none of the above.

7.

True/False: The following two statements will assign the same value toresult.
result = a + b * c;
result = b * c + a;

True

False

8.

True/False: The cin object can be used to input more than one value in a single statement.

True

False

9.

True/False: A pair of characters or a pair of string objects can be compared with any of the relational operators.

True

False

10.

The ________ statement causes other program statements to execute only under certain conditions.

cout

if

logical

relational

cin

11.

True/False: The three logical operators, AND, OR, and NOT, all have the same precedence.

True

False

12.

The C++ ________ operator represents logical AND.

||

++

&

&&

|

13.

True/False: The following C++ test checks if the variable child is in the range 3-12.
if (child >= 3 || child <= 12)

True

False

14. A trailing else placed at the end of an if/else if statement provides a default action when ________ of the if conditions is/are true.

any one

none

at least two

all

only the last one

15. True/False: If number has been defined as an int variable, both of the following statements will print out its value:
cout << number;
cout << "number";

True

False

16. True/False: A variable of the char data type can hold a set of characters like "January".

True

False

17. True/False: C++ is a case-sensitive language.   

True

False

18.

Which of the following is/are valid C++ identifiers?

June.2010

June-2010

June_2010

2010June

Both C and D are valid identifiers, but A and B are not.

19.

What value will be assigned to the variable number by the following statement?
int number = 7.8;

7

7.8

8

None of the above.

It's unpredictable. That's the problem.

20. The expression 5 % 2 evaluates to

1

2

2.5

5.2

10

Explanation / Answer

1. True/False: Before a computer can execute a program written in a high level language, such as C++, it must be translated into object code.

Sol: True, that is the reason compiler is used.

2. Characters or symbols that perform operations on one or more operands are

op codes.

operators.

program ops.

syntax.

none of the above.

Sol: operators

3. Creating a program requires many steps. Three of these are ?

program design, writing source code, and testing.

input, processing, and output

keywords, operators, and punctuation  

syntax, logic, and error handling.

none of the above.

Sol: program design, writin source code, testing

4.Memory locations that can hold data are called ?

operands.

operators.

syntax.

variables.

none of the above.

Sol: variables

5. Which of the following statements doubles the value stored in answer?

answer += 2;

answer *= 2;

answer = answer * 2;

All three of the above

Both B and C, but not A

Sol: Both B and C, but not A

6. When the final value of an expression is assigned to a variable, it will be converted to

the largest possible data type.

the data type of the expression.

the smallest possible data type.

the data type of the variable.

none of the above.

Sol: the data type of the variable.

7. True/False: The following two statements will assign the same value toresult.

result = a + b * c;
result = b * c + a;

True

False

Sol: True

8. True/False: The cin object can be used to input more than one value in a single statement.

True

False

Sol: True

9. True/False: A pair of characters or a pair of string objects can be compared with any of the relational operators.

True

False

Sol: False

10. The ________ statement causes other program statements to execute only under certain conditions.

cout

if

logical

relational

cin

Sol: if

11. True/False: The three logical operators, AND, OR, and NOT, all have the same precedence.

True

False

Sol: True

12. The C++ ________ operator represents logical AND.

||

++

&

&&

|

Sol: &&

13. True/False: The following C++ test checks if the variable child is in the range 3-12.

if (child >= 3 || child <= 12)

True

False

Sol: True

14. A trailing else placed at the end of an if/else if statement provides a default action when ________ of the if conditions is/are true.

any one

none

at least two

all

only the last one

Sol: none

15. True/False: If number has been defined as an int variable, both of the following statements will print out its value:
cout << number;
cout << "number";

True

False

Sol: False

16. True/False: A variable of the char data type can hold a set of characters like "January".

True

False

Sol: False, Simple char cannot hold a string value as it must be array of char. example: char month[]="January";

17. True/False: C++ is a case-sensitive language.   

True

False

Sol: True

18. Which of the following is/are valid C++ identifiers?

June.2010

June-2010

June_2010

2010June

Both C and D are valid identifiers, but A and B are not.

Sol: June_2010.

19. What value will be assigned to the variable number by the following statement?

int number = 7.8;

7

7.8

8

None of the above.

It's unpredictable. That's the problem.

Sol: 7

20. The expression 5 % 2 evaluates to

1

2

2.5

5.2

10

Sol: 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote