# String and T/f

Section 3.1 Numbers

1.

What is the correct statement when declaring and assigning the value of 100 to an Integer variable called numPeople?

(A)

(B)

(C)

(D)

Dim numPeople = 100

Dim numPeople = Int(100)

numPeople = 100

Dim numPeople As Integer = 100

D

2.

What is the value of Int(8.9)?

(A)

(B)

(C)

(D)

3.

The type of error that is normally spotted by the Code Editor is: (A)

(B)

(C)

(D)

4.

runtime

logic

syntax

user

C

Which of the following arithmetic operations has the highest level of precedence? (A)

(B)

(C)

(D)

5.

8

8.9

9

1

A

+*/

^

()

D

Which of the following statements removes all text from lstBox? (A)

(B)

(C)

(D)

lstBox.Clear()

lstBox.Items.Clear()

lstBox.Text.Clear()

lstBox.Items.Add("")

B

6.

What will be the contents of the variable x after the following statement is executed? x = Math.Sqrt(((9 + 7) / (4 * 2)) + 2)

(A)

(B)

(C)

(D)

(E)

7.

1

2

3

4

None of the above

B

Suppose the Double variable num has the value 123.4567. What value will the following statement assign to num?

num = Math.Round(num, 2)

(A)

(B)

(C)

(D)

8.

123.4567

123.457

123.45

123.46

D

What value will be assigned to the numeric variable x when the following statement is executed?

x = 2 + 3 * 4

(A)

(B)

(C)

(D)

9.

20

14

92

234

B

Which of the following statements declare the variables a and b as type Integer? (A)

(B)

(C)

(D)

a =

Dim

Dim

Dim

D

0: b = 0

a, b

a & b As Integer

a, b As Integer

10. Assume that x, y, and temp are Integer variables. Which of the following lines of code swaps the values of x and y?

(A) x = y

y = x

(B) x = temp

x = y

y = temp

(C) temp = x

x = y

y = temp

(D) x = y

temp = x

y = temp

C

11. Which of the following is a valid name for a variable?

(A)

(B)

(C)

(D)

Two_One

2One

Two One

Two.One

A

12. Given x = 3 and y = 1, what value will be assigned to the Double variable w when the following statement is executed?

w = (x + y) / (x – y)

(A)

(B)

(C)

(D)

1

2

3

None of the above

B

13. What will be displayed when the following lines are executed? Dim x As Double = 3, y As Double = 1

Dim z As Double

z = x + (y * x)

x = y

z = x + z

lstBox.Items.Add(x + y + z)

(A)

(B)

(C)

(D)

4

9

10

None of the above

B

14. Which of the following is the same as 2 ^ 3?

(A)

(B)

(C)

(D)

2*2*2

2*3

2+2+2

3*3

A

15. Which of the numbers below is equivalent to 0.000017489? (A)

(B)

(C)

(D)

1.7489E+05

17489E+06

1.7489E-06

1.7489E-05

D

16. Keywords in Visual Basic are words that

(A)

(B)

(C)

(D)

should be used when naming variables.

are used to name controls, such as TextBox1, Command2, etc.

have special meaning and should not be used when naming variables. are used as prefixes for control names (such as txt, btn, lbl, and lst). C

17. When declaring a variable that will refer to a submarine, a good name for the variable is sub. (T/F)

F

18. The function Math.Int will always round mixed numbers down to the next lowest integer. (T/F)

T

19. When using the equal sign to assign values, the variable on the left hand side of the equal sign will always receive the value. (T/F)

T

20. The variables firstName and firstNAME are identical. (T/F) T

21. The following statement assigns 6 times the value of y to x. (T/F) x = 6y

F

22. The following statement is valid. (T/F)

y = y + 72

T

23. A numeric variable that has not been assigned a value has the default value zero. (T/F) T

24. The following statement is valid. (T/F)

Dim x As Double = 3,542.36

F

25. The statement a + b = c assigns to c the sum of the values of a and b. (T/F) F

26. The exponential notation used in Visual Basic is exactly the same as standard mathematical notation. (T/F)

F

27. The lstBox.Items.Clear() statement is used to empty the contents of a list box. (T/F) T

28. Visual Basic always...

Please join StudyMode to read the full document