Question -quiz New Year

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Question -quiz New Year as PDF for free.

More details

  • Words: 1,056
  • Pages: 5
Name: ________________________ Class: ___________________ Date: __________

ID: A

Quiz New Year True/False Indicate whether the statement is true or false. ____

1. Examples of output devices are the mouse and secondary storage.

____

2. ASCII is a seven-bit code.

____

3. The operands of the modulus operator can be decimal numbers, but the modulus operator works better with integers.

____

4. The value of the expression 8 * 5 % 3 is 16.

____

5. In an interactive program, when reading data, prompt lines are used to inform the user what kind of input is required.

____

6. It is a good idea to redefine cin and cout in your programs.

____

7. The get function does not skip blanks, but skips the new line character.

____

8. The expression !(x < 0) is true only if x is a positive number.

____

9. In C++, relational operators are evaluated before logical operators.

____ 10. The number of iterations of a counter-controlled loop is known in advance. ____ 11. The body of a do...while loop may not execute at all. ____ 12. A function definition consists of the function heading and the body of the function. ____ 13. Because function prototypes end with a semicolon, the heading of the function definition must also end with a semicolon. ____ 14. The function heading int funcAlpha(float u, char v, int g) in a C++ program will cause a syntax error because the function return type is int and so the first parameter, u, must be of the type int. Multiple Choice Identify the choice that best completes the statement or answers the question. ____ 15. A program that loads an executable program into main memory is called a(n) _____. a. compiler c. linker b. loader d. assembler ____ 16. The value of the expression 46 + 15.0 / 2 - 1 is _____. a. 51.0 c. 52.5 b. 51.5 d. 61.0 ____ 17. The value of the C++ expression 3 + 16 / 7 % 2 is _____. a. 1 c. 19 b. 3 d. 3.0 ____ 18. Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes _____. a. alpha = 5 c. alpha = 50 b. alpha = 10 d. alpha = 50.0 1

Name: ________________________

ID: A

____ 19. Suppose that x is an int variable and y is a double variable and the input is: 10 20.7. Choose the values after the following statement executes: cin>>x>>y;. a. x = 10, y = 20 c. x = 10, y = 20.7 b. x = 10, y = 20.0 d. x = 10, y = 21.0 ____ 20. Suppose that ch1, ch2, and ch3 are variables of the type char and the input is: AB C Choose the value of ch3 after the following statement executes: cin>>ch1>>ch2>>ch3;. a. ‘A’ c. ‘C’ b. ‘B’ d. '\n' ____ 21. Which of the following is the “not equal to” relational operator? a. ! c. != b. | d. &

____ 22. After the execution of the code above, what will be the value of num if the input value is 5? a. 0 c. 15 b. 5 d. 25 ____ 23. To develop a program, you can use an informal mixture of C++ and ordinary language, called _____. a. assert code c. cppcode b. pseudocode d. source code

____ 24. What is the value of counter after the statements above execute? a. 48 c. 51 b. 50 d. 52 ____ 25. Which of the following is true about a while loop? a. The body of the loop is executed at least once. b. The logical expression controlling the loop is evaluated before the loop is entered and after the loop exits. c. The body of the loop may not execute at all. d. It cannot contain if statement. ____ 26. Which of the following is true about a do...while loop? a. The body of the loop is executed at least once. b. The logical expression controlling the loop is evaluated before the loop is entered. c. The body of the loop may not execute at all. d. It cannot contain break.

2

Name: ________________________

____ 27. What is the output of the C++ code above? a. 1 b. 1 0

ID: A

c. d.

1 0 -1 1 0 -1 -2

____ 28. What is the output of the C++ code above? a. 7 c. 7 2 b. 2 7 d. 7 7 ____ 29. The heading of the function is also called the _____. a. title c. function head b. function signature d. function header ____ 30. Assume you have the following declaration int beta[50];. Which of the following is a valid element of beta? a. beta[0] c. beta[‘1’] b. beta[‘0’] d. beta[50]

3

Name: ________________________

ID: A

____ 31. Consider the declaration above. Which of the following codes correctly outputs all the elements of list? a. for(j = 1; j < 10; j++) cout<<list[j]<<" "; cout<<endl; b.

for(j = 0; j <= 9; j++) cout<<list[j]<<" "; cout<<endl;

c.

for(j = 1; j < 11; j++) cout<<list[j]<<" "; cout<<endl;

d.

for(j = 1; j <= 10; j++) cout<<list[j]<<" "; cout<<endl;

____ 32. What is the value of alpha[3] after the code above executes? a. 5 c. 9 b. 8 d. 10 ____ 33. Consider the following statement: double alpha[10][5];. The number of components of alpha is _____. a. 15 c. 100 b. 50 d. 150 ____ 34. Consider the statement int list[10][8];. Which of the following about list is true? a. list has 10 rows and 8 columns. b. list has 8 rows and 10 columns. c. list has a total of 18 components. d. list has a total of 108 components.

4

Name: ________________________

ID: A

____ 35. Given the declaration above, which of the following correctly finds the sum of the elements of the fifth row of sale? a. sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[5][j]; b. sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[4][j]; c. sum = 0; for(j = 0; j < 10; j++) sum = sum + sale[5][j]; d. sum = 0; for(j = 0; j < 10; j++) sum = sum + sale[4][j];

5

Related Documents

Question New
July 2020 1
New Year
April 2020 10
New Year
June 2020 11
New Year
November 2019 26
New Year
November 2019 24