M06 Evaluate: Quiz Computer Logic Sdev120

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The following random generator code Floor(Random()*6) produces the numbers_________ through__________ . (Note, this question has 2 parts; you must answer each part correctly to receive full marks. Enter only the numbers in the space provided

0 5

If Num = 4.22, what value would be displayed as a result of the following assignment? Set Num = Ceiling(Num) Write Num

5

If Number is an integer value, what would be value displayed as a result of the following assignment? (Note: if there are any spaces, it is assumed to be one space.) Set Number = Length_Of("Hello") Write Number

5

What will be displayed after code corresponding to the following pseudocode is run? Declare A As Integer Declare B As Integer Declare C As Integer Set A = 3 While A <= 6 Set B = (2 * A) - 1 Write B Set C = A While C <= (A+1) Write C Set C = C + 1 End While(C) Set A = A + 2 End While(A) 3, 5, 4, 5, 9, 5 5, 3, 3, 9, 5, 5 5, 3, 9, 5 5, 3, 4, 9, 5, 6

5, 3, 4, 9, 5, 6

What is the output of code corresponding to the following pseudocode? (In the answer options, new lines are separated by commas.) Declare A As Integer Declare B As Float Set A = 2 While A <= 3 Set B = 2.5 * A Write B Set B = Int(B) Write B Set A = A + 1 End While 5, 7 5, 5, 7.5, 7 5, 5, 7, 7 2, 3, 5, 7

5, 5, 7.5, 7

Complete the random generator code for the following pseudocode that simulates rolling a die 10 times by generating and displaying 10 random integers, with a range of 1 to 6. (Note, this question has 2 parts; you must answer each part correctly to receive full marks. Enter only the numbers in the space provided.) Declare Die, X As Integer For (X = 1; X <= 10; X++) Set Die = Floor(Random()* )+ Write "Die face: " + Die End For

6 1

If Num1 = 5.6 and Num2 = 3, what value would be displayed as a result of the following assignment? Set Number = Floor(Num1 + Num2) Write Number

8

If Number is an integer value, what would be displayed as a result of the following assignment? (Note: if there are any spaces, it is assumed to be one space.) Set Number = Length_Of("Good-bye!") Write Number

9

Which of the following loops cannot be nested in a For loop? All of these can be nested in a For loop While Do ... While For Repeat ... Until

All of these can be nested in a For loop

What does the following program segment do? Declare Count As Integer Declare Sum As Integer Set Sum = 0 For (Count = 1; Count < 50; Count++) Set Sum = Sum + Count End For It sums all the integers from 1 through 49 It sums all the integers from 0 through 50 It sums all the integers from 1 through 50 It does nothing since there is no Write statement

It sums all the integers from 1 through 49

If Number is an integer value, what would be displayed as a result of the following assignment? (Note: if there are any spaces, it is assumed to be one space.) Set Number = Length_Of(" ") Write Number

1

What is the output of the code corresponding to the pseudocode shown? Declare G As Integer Declare H As Integer Set G = 7 While G <= 8 Set H = 6 While H <= 7 Write G + H Set H = H + 1 End While(H) Set G = G + 1 End While(G) 13, 14, 14, 15 13, 14, 15 7, 6, 7, 7, 8, 6, 8, 7 7, 6, 7, 8

13, 14, 14, 15

What is the output of the code corresponding to the following pseudocode? (In the answer options, new lines are separated by commas.) Declare X As Integer Declare Y As Integer For (X = 1; X <=2; X++) For (Y = 3; Y <= 4; Y++) Write X * Y End For(Y) End For(X) 3, 4, 6, 8 1, 3, 2, 4 4, 5, 5, 6 None of these are correct output

3, 4, 6, 8

If MyNumber = 7.82, what is the value of Int(MyNumber/2)+ 0.5? 3.5 4.41 4.5 3.91

3.5

If Number = 3.5, what would be the result of the following conditional statement? True or false? Floor(Number*Number) == Number*Number True False

False

If Number = 3.5, what would be the result of the following conditional statement? True or false? Floor(Number/2) == Number/2 True False

False

The _____________ function takes a string or a string variable inside the parentheses and returns the number of characters in that string.

Length_Of()

If a counter named MyCount in a For loop has the value of 5 on the first pass, 10 on the second pass, 15 on the third pass, and so on, the increment would be written as __________. (Do not include spaces in your answer).

MyCount + 5

The starting value of an algorithm used to generate a range of numbers is called the _________.

Seed

What is wrong with the following pseudocode? Declare Count As Integer Declare TheNumber As Integer Set TheNumber = 12 For (Count = 10; Count>TheNumber; Count--) Write TheNumber + Count End For The loop will never be entered since the initial value of Count is less than the test condition The limit condition in a For loop cannot be a variable A counter must start at 0 or 1 The loop will never end since the test condition will never be met

The loop will never end since the test condition will never be met

If one For loop is nested within another, then the counter variables for the two loops should be _________.

different

The statement If Int(Number) != Number Then... checks to see if the value of Number is a(n) _________.

integer

Numbers that form an unpredictable sequence in which each number is equally likely to occur are called __________ numbers.

random numbers

The __________ statement indicates output to the screen with the assumption that each new statement would begin on a new line.

write


Kaugnay na mga set ng pag-aaral

Exam 2 1063 bio quiz questions/iclicker questions

View Set

ECON 4 Microeconomics Final Chaffey

View Set

Prep U Chapter 34: Assessment and Management of Patients with Inflammatory Rheumatic Disorders

View Set

Chapter 4?: Strategic Human Resource Management Job Design and Competencies

View Set

Macroeconomics Final Study Guide

View Set

HIPAA Guidelines for Clinical Practice

View Set