Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(100 points available) Your name here (always put your name on your assignments- not just in this class!) This is to be done in pseudocode,

(100 points available)

Your name here (always put your name on your assignments- not just in this class!)

This is to be done in pseudocode, not Python. In these pseudocode problems, you will be asked to write or fix the coding statements. You do not have to write the entire program.

Demonstrate your understanding of the concepts as thoroughly as you can. You've got this!

When applicable, use these variable names: myInteger, myReal, myString, myBoolean, myIntegerArray

(2 points)

#1a In pseudocode, write a call to a function that passes 1 Integer variable and 1 Integer array, and saves a Boolean value in return.

(4 points)

#1b In pseudocode, write the function that accepts 1 Integer and 1 Integer array and returns a Boolean.

In the function, search the Integer array with a for-loop, and if the Integer parameter is found in the array, return false. If the Integer parameter is not found, return true.

(2 points)

#2a In pseudocode, write a call to a module that passes 1 Integer variable, 1 Real variable, 1 String constant, and 1 String literal as arguments.

(2 points)

#2b In pseudocode, write the module header that accepts 1 Integer, 1 Real, and 2 Strings as parameters.

(4 points)

#3 This pseudocode has multiple problems. Fix the calling statement and the definition below so that the routine accepts 3 grades as parameters and returns the average into a variable.

Call calcPercentageof(Boolean Number)

Module calcPercentageOf (numerator, num2)

Set percentage = num / num2 * 100

End Module

Write the correct call statement and module definition below:

(4 points)

#4 In pseudocode, write a for-loop that decreases from 100 to 2 by 2s. Inside the loop, print the value of the loop variable unless the value is from 60 to 80 (inclusive). Use only 1

if-statement. Do NOT write Python code!

Write your answer below:

(2 points each; 10 total)

#5 Review the decision structure given below.

If myAnswer > 20 Then

myAnswer = myAnswer - 25

Else If myAnswer <= 5 Then

If myAnswer < 0 Then

myAnswer = 10

If myAnswer < 3 Then myAnswer += 10

Else

myAnswer += 1

Else

myAnswer = 9

If myAnswer < 10 Then

myAnswer += 1

Display myAnswer

What are the results displayed when the decision structure above executes for each given value below:

If myAnswer = 6 then myAnswer =

myAnswer = 15 then myAnswer =

myAnswer = 30 then myAnswer =

myAnswer = 2 then myAnswer =

myAnswer = -1 then myAnswer =

(4 points)

#6 2-dimensional arrays can be thought of as containing rows and columns. What are the subscript values for a 2-dimensional array?

Enter them in the array below (first set given)

[0,0] [ ] [ ]

[ ] [ ] [ ]

[ ] [ ] [ ]

[ ] [ ] [ ]

[ ] [ ] [ ]

(4 points)

#7 List 4 main data types we used in this course and describe the data that is stored in each one. List examples of variable names that make sense for each data type.

(10 points)

#8 Debug this input validation function and fix it. There is a lot wrong with it!

Function Integer getNumberGreaterThanX(msg, x)

myInteger = getInteger(msg)

While myInteger < x

Display "The number must be < , myInteger , . Try again."

Input x

End While

End Function

Write the corrected function below:

(10 points)

#9 Write a validation function based on the provided variables and call statement below. The validation function should return an Integer value greater than zero or print an error message until an acceptable value is entered.

Declare Integer positiveValue = 0

Declare String message = "Enter the year you were born (no negative numbers!)"

positiveValue = getNumberGreaterThanZero(message)

Write the function definition below:

(10 points)

#10 Write the pseudocode statements that will take the given array, multiply each value by 2, and save the results into a new array. Then, display every value in the new array using a loop.

Constant Integer SIZE = 5

Declare Real myRealArray [SIZE] = 12.5, 13, 13.5, 14, 14.5

Write the pseudocode below:

(2 points each; 20 total)

#11 Do these statements evaluate to be true or false?

NOT true evaluates to:

true AND true evaluates to:

false OR NOT false evaluates to:

true OR false evaluates to:

false AND false evaluates to:

false OR true evaluates to:

NOT false AND true evaluates to:

(NOT (true OR false)) AND true evaluates to:

(NOT true) OR (NOT false) evaluates to:

NOT (false OR (NOT true)) evaluates to:

(NOT ((false AND false) AND (true OR false)) OR (true OR NOT false)) evaluates to:

(2 points)

#12a - Define what source code refers to:

What is the file extension used for Python source code?

(2 points)

#12b - Define what executable code refers to:

What is a file extension used for executable code?

(4 points)

#12c -Fill in the definitions below and provide examples for each:

Logic error:

An example of a pseudocode logic error would be (explain why):

Syntax error:

An example of a pseudocode syntax error would be (explain why):

(2 points)

#13a In OOP, explain what encapsulation means:

(2 points)

#13b In OOP, explain what a constructor is and what its purpose is:

(2 points)

#13c Complete this common phrase used in OOP:

Private ______________; Public _________________

(2 bonus points)

What is the meaning of the above phrase? Give an example.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

How can an entity avoid having a court pierce the veil?

Answered: 1 week ago