Pseudocode and/or flowcharts are used in which of the following steps in program development?
Question 1 (CO 1) A web application runs
through a browser
via a command prompt
with a GUI
through another application
Question 2 (CO 3) Pseudocode and/or flowcharts are used in which of the following steps in program development?
Understand the problem
Plan and design the logic
Develop the logical solution
Desk-check the solution
Question 3 (CO 1) The following is an example of __________.
#!/usr/bin/env python 3
executable code
byte code
source code
a shebang line
Question 4 (CO 8) When an exception occurs while a program is running, __________.
the program crashes
an error message is displayed on the console
the program crashes and an error message is displayed
an error message is displayed but the program continues
Question 5 (CO 1) Given: x = 7 , y = 2 , z = 1.5
What is the value of new_num after the following statement executes?
new_num = x / y + z
2
4.5
5.0
3
Question 6 (CO 1) What will display after the following print() function is executed?
print(“Welcome!nNow that you have learned about”,
“inputnand output, you may be wondering,”Whatnis”,
“next?””)
Welcome!
Now that you have learned about
input
and output, you may be wondering,
“What
is next?”
Welcome! Now that you have learned about
input and output, you may be wondering, “What is
next?”
Welcome!nNow that you have learned about”,
“inputnand output, you may be wondering,”Whatnis”,
“next?”
Welcome!
Now that you have learned about input
and output, you may be wondering, “What
is next?”
Question 7 (CO 1) What is the value of my_num after the following statement executes?
my_num = (50 + 2 * 10 – 4) / 2
258
33
156
29
Question 8 (CO 1) What, if anything, is wrong with this code?
student_score = int(input(“Enter this student’s score: “))
score = student_score + 5
print(“With the 5-point curve, the student’s score is “, scores, “.”)
nothing is wrong with this code
a string variable is used in an arithmetic expression
an undeclared variable name is used in the print() function
the input() function is chained with the int() function
Question 9 (CO 4) Which of the following is an example of a Boolean variable?
flag = True or False
if flag == True:
flag == “true”
flag = False
Question 10 (CO 4) A for loop that uses a range() function is executed
once for each integer in the collection returned by the range() function
until the for condition is equal to the value returned by the range() function
while the for condition is less than the value returned by the range() function
until the range() function returns a false value
Question 11 (CO 4) Which of the following begins by testing a condition defined by a Boolean expression and then executes a block of statements if the condition is true?
a for statement
a switch statement
a while statement
a continue statement
Question 12 (CO 4) To jump to the end of the current loop, you can use the
end statement
continue statement
break statement
switch statement
Question 13 (CO 4) What will the output of the following code be if the user enters 3 at the prompt?
your_num = int(input(“Enter a number:”))
while (your_num > 0):
product = your_num * 5
print(your_num, ” * 5 = “, product)
your_num -= 1
3 * 5 = 15
3 * 5 = 15
2 * 5 = 10
1 * 5 = 5
3 * 5 = 15
3 * 5 = 15
3 * 5 = 15
3 * 5 = 15
2 * 5 = 10
1 * 5 = 5
0 * 5 = 0
Question 14 (CO 4)
num_widgets = 0
while True:
choice = input(“Would you like to buy a widget? (y/n): “)
if choice.lower() == “y”:
num_widgets += 1
else:
break
print(“You bought”, num_widgets , “widget(s).”)
Based on the above code example, which of the following could be a pseudocode plan for the program?
Define widget count variable
IF user buys widgets
add 1 to widget count
ELSE
end loop
Display results
Define widget count variable
Begin infinite loop
Get user input
IF user buys widget
add 1 to widget count
ELSE
end loop
Display results
Get user input
Loop WHILE user wants to continue
IF user buys widget
add 1 to widget count
Get user input
Display results
Get user input
Loop while input != “y”
IF user buys widget
add 1 to widget count
ELSE
end loop
Display results
Question 15 (CO 7) Which of the following is not a common type of syntax error?
forgetting a colon
forgetting to close a parentheses
invalid variable names
improper indentation
Question 16 (COs 1 and 8) Create a program that calculates the total for a purchase at a bookstore. Put the lines of code in order to create the following program.
SAMPLE OUTPUT:
Bookstore Calculator
Price of Book 29.99
Tax percent 8.75
Tax amount 2.63
Total amount 32.61
Question 17 (CO 4 and 8) Create a program that prompt the user to enter five positive numbers and calculate the average. When a negative number is entered, program will be terminated. Put the lines of code in order to create the following program.
SAMPLE OUTPUT:
Please provide five nonnegative numbers when prompted
Enter number: 23
Enter number: 12
Enter number: 14
Enter number: 10
Enter number: 11
Average = 14.0
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
