C960 Discrete Math II Exam Questions & Answers
| Latest Already Graded A+ |Questions with
Correct Answers 2026 latest update!
Terms in this set (694)
1.3.1: Algorithm to compute the smallest 5
of three numbers.
Input: a = 7, b = 5, c =9
min := a
If ( b < min ), min :=
b If ( c < min ), min
:= c Return ( min )
What's min?
,1.4.2: If-else-statement. min = 3, max = 6
x := 3
y := 6
If ( x < y
) min :=
x max :=
y Else
min := y
max :=
x End-if
What is min & max?
1.4.2: If-else-statement. min = 2, max = 7
x = :7
y =: 2
If ( x < y
) min :=
x max :=
y Else
min := y
max :=
x End-if
What is min & max?
Lesson 1.4.3 2
What is the value of abs after the The condition ( x > 0 ) evaluates to true because the
following lines of code are run? value of x is 2. The line abs := x is executed and the
line x := 2 abs := -x is skipped. Therefore the final value of abs is
2. If ( x > 0 )
abs := x
Else
abs := -x
End-if
Lesson 1.4.3 2
What is the value of abs after the The condition ( x > 0 ) evaluates to false because the
following lines of code are run? value of x is -2. The line abs := x is skipped and the
line x := -2 abs := -x is executed. Therefore the final value of abs
is
If ( x > 0 ) -x, which is -(-2) = 2.
abs := x
Else
abs := -x
End-if
1.5.2: For-loops. 5
What is the value of sum after the second In the first iteration, i = 2. In the second iteration, i = 3.
2 iteration? + 3 = 5.
sum := 0
For i = 2 to 5
sum := sum +
i End-for
,Lesson 1.5.2 For-loops 4
How many iterations will the for-loop i = 2, 3, 4, 5. Four
iterations. execute?
sum := 0
For i = 2 to 5
sum := sum +
i End-for
Lesson 1.5.2 For-loop[s 14
What is the final value for sum after i = 2, 3, 4, 5. sum = 2 + 3 + 4 +
5. executing the for-loop?
sum := 0
For i = 2 to 5
sum := sum +
i End-for
Lesson 1.6.2: While-loops 15
product := 1 In the first iteration, count = 5. In the second iteration,
count := 5 count = 3. 5⋅3 = 15.
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
What is the value of product after the
second iteration?
Lesson 1.6.2: While-loops 3
product := 1 count = 5, 3, 1. Three iterations.
count := 5
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
How many iterations will the while-
loop execute?
Lesson 1.6.2: While-loops 15
product := 1 product = 5⋅3⋅1 = 15.
count := 5
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
What is the final value for product?
, Lesson 1.7.2: Nested loops - example 1 12
count := 0 For each iteration of the outer loop, the inner loop
For i = 1 to 3 iterates 4 times. The outer loop iterates 3 times. 3 × 4 =
For j = 1 to 4 12.
count := count + i ⋅
j End-for
End-for
How many times is the variable count
increased?
Lesson 1.7.2: Nested loops - example 1 60
count := 0 1·(1 + 2 + 3 + 4) + 2(1 + 2 + 3 + 4) + 3(1 + 2 + 3 + 4)
For i = 1 to 3 = 60.
For j = 1 to 4
count := count + i ⋅
j End-for
End-for
What is the final value of count?
1.7.3: Nested loops - example 2. 2
count := 0 The initial value of j is i+1. The final value of j is 4. j = 3,
For i = 1 to 3 4. 2 iterations.
For j = i+1 to 4
count := count + i ⋅
j End-for
End-for
When i = 2, how many times does the
inner loop iterate?
1.7.3: Nested loops - example 2. 6
count := 0 When i = 1, j = 2, 3, 4. When i = 2, j = 3, 4. When i = 3, j
For i = 1 to 3 = 4. A total of 6 iterations.
For j = i+1 to 4
count := count + i ⋅
j End-for
End-for
How many times is the variable count
increased?
1.7.3: Nested loops - example 2. 35
count := 0 1·(2 + 3 + 4) + 2·(3 + 4) + 3·(4) = 35.
For i = 1 to 3
For j = i+1 to
4
count := count + i ⋅
j End-for
End-for
What is the final value of count?
1.13.1: Asymptotic growth n
Find the asymptotic behavior Drop the term 12 and the constant multiplier
5. f(n) = 5n+12
| Latest Already Graded A+ |Questions with
Correct Answers 2026 latest update!
Terms in this set (694)
1.3.1: Algorithm to compute the smallest 5
of three numbers.
Input: a = 7, b = 5, c =9
min := a
If ( b < min ), min :=
b If ( c < min ), min
:= c Return ( min )
What's min?
,1.4.2: If-else-statement. min = 3, max = 6
x := 3
y := 6
If ( x < y
) min :=
x max :=
y Else
min := y
max :=
x End-if
What is min & max?
1.4.2: If-else-statement. min = 2, max = 7
x = :7
y =: 2
If ( x < y
) min :=
x max :=
y Else
min := y
max :=
x End-if
What is min & max?
Lesson 1.4.3 2
What is the value of abs after the The condition ( x > 0 ) evaluates to true because the
following lines of code are run? value of x is 2. The line abs := x is executed and the
line x := 2 abs := -x is skipped. Therefore the final value of abs is
2. If ( x > 0 )
abs := x
Else
abs := -x
End-if
Lesson 1.4.3 2
What is the value of abs after the The condition ( x > 0 ) evaluates to false because the
following lines of code are run? value of x is -2. The line abs := x is skipped and the
line x := -2 abs := -x is executed. Therefore the final value of abs
is
If ( x > 0 ) -x, which is -(-2) = 2.
abs := x
Else
abs := -x
End-if
1.5.2: For-loops. 5
What is the value of sum after the second In the first iteration, i = 2. In the second iteration, i = 3.
2 iteration? + 3 = 5.
sum := 0
For i = 2 to 5
sum := sum +
i End-for
,Lesson 1.5.2 For-loops 4
How many iterations will the for-loop i = 2, 3, 4, 5. Four
iterations. execute?
sum := 0
For i = 2 to 5
sum := sum +
i End-for
Lesson 1.5.2 For-loop[s 14
What is the final value for sum after i = 2, 3, 4, 5. sum = 2 + 3 + 4 +
5. executing the for-loop?
sum := 0
For i = 2 to 5
sum := sum +
i End-for
Lesson 1.6.2: While-loops 15
product := 1 In the first iteration, count = 5. In the second iteration,
count := 5 count = 3. 5⋅3 = 15.
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
What is the value of product after the
second iteration?
Lesson 1.6.2: While-loops 3
product := 1 count = 5, 3, 1. Three iterations.
count := 5
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
How many iterations will the while-
loop execute?
Lesson 1.6.2: While-loops 15
product := 1 product = 5⋅3⋅1 = 15.
count := 5
While ( count > 0 )
product :=
product⋅count count :=
count - 2
End-while
What is the final value for product?
, Lesson 1.7.2: Nested loops - example 1 12
count := 0 For each iteration of the outer loop, the inner loop
For i = 1 to 3 iterates 4 times. The outer loop iterates 3 times. 3 × 4 =
For j = 1 to 4 12.
count := count + i ⋅
j End-for
End-for
How many times is the variable count
increased?
Lesson 1.7.2: Nested loops - example 1 60
count := 0 1·(1 + 2 + 3 + 4) + 2(1 + 2 + 3 + 4) + 3(1 + 2 + 3 + 4)
For i = 1 to 3 = 60.
For j = 1 to 4
count := count + i ⋅
j End-for
End-for
What is the final value of count?
1.7.3: Nested loops - example 2. 2
count := 0 The initial value of j is i+1. The final value of j is 4. j = 3,
For i = 1 to 3 4. 2 iterations.
For j = i+1 to 4
count := count + i ⋅
j End-for
End-for
When i = 2, how many times does the
inner loop iterate?
1.7.3: Nested loops - example 2. 6
count := 0 When i = 1, j = 2, 3, 4. When i = 2, j = 3, 4. When i = 3, j
For i = 1 to 3 = 4. A total of 6 iterations.
For j = i+1 to 4
count := count + i ⋅
j End-for
End-for
How many times is the variable count
increased?
1.7.3: Nested loops - example 2. 35
count := 0 1·(2 + 3 + 4) + 2·(3 + 4) + 3·(4) = 35.
For i = 1 to 3
For j = i+1 to
4
count := count + i ⋅
j End-for
End-for
What is the final value of count?
1.13.1: Asymptotic growth n
Find the asymptotic behavior Drop the term 12 and the constant multiplier
5. f(n) = 5n+12