Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
44 views

Quiz - Week 1 - Lab - Algorithms

CSIS 101 Quiz

Uploaded by

mikeschallra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Quiz - Week 1 - Lab - Algorithms

CSIS 101 Quiz

Uploaded by

mikeschallra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Quiz: Lab – Algorithm

 Due Mar 25 at 11:59pm

 Points 50

 Questions 15

 Time Limit None

 Allowed Attempts 2

Instructions
The quiz:

 Covers the Learn material from Module 1: Week 1.


 Contains 15 multiple-choice, matching, and short-answer questions.
 Has no time limit.
 Allows 1 attempt.
 Is worth 50 points.

This lab is open book and it is encouraged that you learn through
researching. The final question in this lab is a question where you will write
an algorithm (in pseudocode) to solve a given scenario.
Submit this assignment by 11:59 p.m. (ET) on Monday of Module 1: Week 1.
TAKE THE QUIZ AGAIN
Attempt History

Attempt Time Score

LATEST Attempt 1 20 minutes 27.75 out of 50 *

* Some questions not yet graded


Correct answers are hidden.
Score for this attempt: 27.75 out of 50 *
Submitted Mar 25 at 10:07am
This attempt took 20 minutes.

Question 1
1.5 / 1.5 pts
____ operations provide the computing agent with data values from the outside world that it may use in
later instructions.

Ingoing

Outgoing

Input

Output

IncorrectQuestion 2
0 / 1.5 pts
Examples of control operations would be _______ and _______.

conditional and iterative

dynamic and static

hierarchal and control

iterative and sequential

Question 3
1.5 / 1.5 pts
____ statements are the “question-asking” operations of an algorithm.

Primitive

Iterative

Sequential

Conditional

Question 4
1.5 / 1.5 pts
The ____ loop is an example of a posttest loop.

do/while

do

while

if/then/else

Question 5
1.5 / 1.5 pts
A ____ is a collection of useful, prewritten algorithms.

primitive

binary

set

library

Question 6
1.5 / 1.5 pts
____ is an example of a natural language.
C

Java

English

Perl

Question 7
1.5 / 1.5 pts
A purely ____ algorithm is sometimes termed a straight-line algorithm.

sequential

conditional

iterative

control

Question 8
1.5 / 1.5 pts
In a posttest loop, the continuation condition is tested at the ____ through the loop.

beginning of each pass

beginning of only the first pass

end of each pass

end of only the last pass

PartialQuestion 9
2.25 / 3 pts
Run through the following algorithm and determine if 1996 was a leap year

YEAR = 1996
Get YEAR
STEP 1 If YEAR is equally divisible by 4; Result: True
Then Go To STEP 2;
Else Go To STEP 5
STEP 2 If YEAR is equally divisible by 100; Result: False
Then Go To STEP 3;
Else Go To STEP 4
STEP 3 If YEAR is equally divisible by 400; Result: True
Then Go To STEP 4;
Else Go To STEP 5
STEP 4 Print “The year is a Leap Year.” And Go To STEP 6
STEP 5 Print “The year is not a Leap Year.” And Go To STEP 6
STEP 6 Stop
The final output of this run is : This is a Leap
Answer 1:
True

Answer 2:
False

Answer 3:
True

Answer 4:
This is a Leap

Question 10
3 / 3 pts
Run through the following algorithm and determine if 2000 was a leap year

YEAR = 2000
Get YEAR
STEP 1 If YEAR is equally divisible by 4; Result: True
Then Go To STEP 2;
Else Go To STEP 5
STEP 2 If YEAR is equally divisible by 100; Result: True
Then Go To STEP 3;
Else Go To STEP 4
STEP 3 If YEAR is equally divisible by 400; Result: True
Then Go To STEP 4;
Else Go To STEP 5
STEP 4 Print “The year is a Leap Year.” And Go To STEP 6
STEP 5 Print “The year is not a Leap Year.” And Go To STEP 6
STEP 6 Stop
The final output of this run is : This is a Leap
Answer 1:
True

Answer 2:
True

Answer 3:
True

Answer 4:
This is a Leap

Question 11
3 / 3 pts
This algorithm will multiple a number by repeatedly adding the value of A the
number of times stated in the value of B.
For example, if A = 10 and B = 3, This algorithm will perform the following :
10 + 10 + 10 = 30
Tip: Notice that this only added the value of A 3 times but in your response,
you will see it shows up to 4 iterations.
If this happens in any of these exercises, the proper answer would be
"Loop Ended" for both Count and Product.

A=4 B=4
Get A
Get B
STEP 1 If A or B = 0
Then Set Product to = 0 and Go To STEP 3
Else Set Count to 0 and Set Product to 0 and Go To STEP 2
STEP 2 While Count <B
Set Product to (Product + A)
Set Count to (Count + 1)
End of Loop;
STEP 3 Print the value of Product
STEP 4 Stop
After Iteration 1:
Count equals 1
Product equals 4
After Iteration 2:
Count equals 2
Product equals 8
After Iteration 3:
Count equals 3
Product equals 12
After Iteration 4:
Count equals 4
Product equals 16
Answer 1:
1

Answer 2:
4

Answer 3:
2

Answer 4:
8

Answer 5:
3

Answer 6:
12

Answer 7:
4

Answer 8:
16

Question 12
3 / 3 pts
This algorithm will multiple a number by repeatedly adding the value of A the
number of times stated in the value of B.
For example, if A = 10 and B = 3, This algorithm will perform the following :
10 + 10 + 10 = 30

Tip: Notice that this only added the value of A 3 times but in your response,
you will see it shows up to 4 iterations.
If this happens in any of these exercises, the proper answer would be
"Loop Ended" for both Count and Product.
A=5 B=4
Get A
Get B
STEP 1 If A or B = 0
Then Set Product to = 0 and Go To STEP 3
Else Set Count to 0 and Set Product to 0 and Go To STEP 2
STEP 2 While Count < B
Set Product to (Product + A)
Set Count to (Count + 1)
End of Loop;
STEP 3 Print the value of Product
STEP 4 Stop
After Iteration 1:
Count equals 1
Product equals 5
After Iteration 2:
Count equals 2
Product equals 10
After Iteration 3:
Count equals 3
Product equals 15
After Iteration 4:
Count equals 4
Product equals 20

Answer 1:
1

Answer 2:
5

Answer 3:
2

Answer 4:
10

Answer 5:
3

Answer 6:
15

Answer 7:
4

Answer 8:
20

Question 13
3 / 3 pts
Run through the following sorting algorithm and determine the largest
number.
Assume at the start of this sequence the variables are set as follows:

 List_Size = 5
o Num-1 = 12
o Num-2 = 8
o Num-3 = 5
o Num-4 = 16
o Num-5 = 1

STEP 1 Set Largest# to Num-1


STEP 2 If Largest# < Num-2
Then Set Largest# to Num-2 and Go To Step 3 Largest# after
Step 2 = 12
Else Go To Step 3
STEP 3 If Largest# < Num-3
Then Set Largest# to Num-3 and Go To Step 4 Largest# after
Step 3 = 12
Else Go To Step 4
STEP 4 If Largest# < Num-4
Then Set Largest# to Num-4 and Go To Step 5 Largest# after
Step 4 = 16
Else Go To Step 5
STEP 5 If Largest# < Num-5
Then Set Largest# to Num-5 and Go To Step 6 Largest# after
Step 5 = 16
Else Go To Step 6
STEP 6 Print “The largest number is” Largest#
STEP 7 Stop Program

Answer 1:
12

Answer 2:
12

Answer 3:
16

Answer 4:
16

Question 14
3 / 3 pts
Run through the following sorting algorithm and determine the largest
number.
Assume at the start of this sequence the variables are set as follows:

 List_Size = 5
o Num-1 = 6
o Num-2 = 8
o Num-3 = 5
o Num-4 = 16
o Num-5 = 18

STEP 1 Set Largest# to Num-1


STEP 2 If Largest# < Num-2
Then Set Largest# to Num-2 and Go To Step 3 Largest# after
Step 2 = 8
Else Go To Step 3
STEP 3 If Largest# < Num-3
Then Set Largest# to Num-3 and Go To Step 4 Largest# after
Step 3 = 8
Else Go To Step 4
STEP 4 If Largest# < Num-4
Then Set Largest# to Num-4 and Go To Step 5 Largest# after
Step 4 = 16
Else Go To Step 5
STEP 5 If Largest# < Num-5
Then Set Largest# to Num-5 and Go To Step 6 Largest# after
Step 5 = 18
Else Go To Step 6
STEP 6 Print “The largest number is” Largest#

Answer 1:
8

Answer 2:
8

Answer 3:
16

Answer 4:
18

Question 15
Not yet graded / 20 pts
Write an algorithm (in pseudocode) for the following Scenario.
You will need to build a program that provides retirement estimates based
on user inputs. Your algorithm will ask the user to provide the following
information:

 Full Name
 Current Age
 Desired Retirement Age
 Current Retirement Savings
 Amount You Need to Retire

The program will need to determine the years remaining until retirement and
how much is needed to reach the investment goal.
Finally, it will print a message to the screen that says:

 The name,
 How long until you reach retirement age and
 How much is needed to be saved between now and then

This is not to be written in any programming language--it must be written in


pseudocode .

Your Answer:
Get Full Name, Current Age, Desired Retirement Age, Current Retirement
Savings, Amount You Need to Retire
IF Current Age < Desired Retirement Age, THEN set Length to Retirement
Age = Desired Retirement Age-Current Age, ELSE Print 'Congratulations, you
are old enough to retire!'
IF Amount You Need to Retire < Current Retirement Savings, THEN set
Savings Needed to Retire = Amount You Need to Retire-Current Retirement
Savings, ELSE Print 'Congratulations, you have enough to retire!'
Print 'Full Name, Length to Retirement Age, Savings Needed to Retire'

Quiz Score: 27.75 out of 50

You might also like