Intro to Computer Science: Unit 3 Computational Thinking TEST

¡Supera tus tareas y exámenes ahora con Quizwiz!

You wrote a pseudocode outline of your program using comments. Which character do you use to indicate a line is a comment?

#

What will you see on the next line? >>> int(12.8)

12

Which number is equivalent to 17e3?

17000.0

What is the value of numX when this program is executed? if 3 < 5 and 8 != 3: numX = 3 else: numX = 7

3

You are writing a fun program to ask the user trivia questions using these steps: Define the problem precisely. Gather data. Perform any needed calculations or data manipulations. Communicate the results, along with an interpretation as needed. Check the accuracy of your calculations and data manipulations. Identify the number of the step associated with the task of determining whether the user's answer is correct

3

What is the value of numC when this program is executed? numA = 4 numB = 10 if numA == 2: numC = 10 elif numA > numB: numC = 20 else: numC = 30

30

Assume the user responds with a 3 for the first number and a 5 for the second number. answerA = input("Enter a number. ") answerB = input("Enter a second number. ") numberA = int(answerA) numberB = int(answerB) result = (numberA + numberB) / 2 print ("The result is" , result)

4.0

You can write a function to find Fibonacci numbers using recursion. What is the next number in the Fibonacci sequence? 1, 1, 2, 3, 5, 8, 13, 21, 34, _____

55

Which Python expression results in 49?

7 ** 2 is seven raised to the second power, which is 49.

Mathematics and computer science share many concepts, such as recursion.You used recursion to find the factorial of a number. Which expression equals the factorial of seven? 7! = ________

7 x 6 x 5 x 4 x 3 x 2 x 1

What will you see on the next line? >>> round(7.8)

8

What is the value of the variable result after these lines of code are executed? >>> a = 5 >>> b = 2 >>> c = 7 >>> result = ab - cb

An error occurred.

What will be the output of the following lines of code and the user's response? >>> answer = input("What does your dog weigh? ") What do you weigh? 85.7 >>> weight = int(answer) >>> print("The weight is" , weight)

An error occurs.

What is the value of grade after this program is executed? Assume the score is 71. if score >= 90: grade = "A" elif score >= 80: grade = "B" elif score >= 70: grade = "C" elif score >= 60: grade = "D" else: grade = "F"

C

________ abstraction hides the details about a specific piece of information.

Data

You designed a program to create a username using the first three letters from the first name and the first four letters of the last name. Usernames cannot have spaces. You are testing your program with a user whose name is Jo Wen. What step in the program plan do you need to revisit?

Define the problem precisely.

You designed a program to find the average of the user's numbers. Which step below corresponds to asking the user for the numbers?

Gather data.

What is the output? >>> phrase = "hello mom" >>> phrase.upper()

HELLO MOM

Which of the following statements are true concerning abstraction and refinement? Select 3 options There is one level of abstraction that is appropriate for all projects. Models may be abstracted and refined depending on the goals of the project. Refinement is the inverse of abstraction. Refinement leads to less detail and abstraction leads to more. Abstraction is a technique used in computational thinking.

Models may be abstracted and refined depending on the goals of the project. Refinement is the inverse of abstraction. Abstraction is a technique used in computational thinking.

________ abstraction hides the details about a specific process.

Procedural

_____ is a process of adding details to a model to make it less abstract.

Refinement

_____ allow(s) users with mobility issues to control the computer with their voice.

Speech input software

Which line of code converts 2.56 into a string data type?

The str() function converts a number to a string.

Assuming all the variables are non-zero. Which lines of code will assign the discriminant the value b2−4ac? Select 2 options. discriminant = b * b - 4 * a * c discriminant = b ** 2 - 4 * a * c discriminant = bb - 4ac discriminant = b ^ 2 - 4 * a * c discriminant = b ^ 2 - 4ac

discriminant = b * b - 4 * a * c discriminant = b ** 2 - 4 * a * c

Choose the correct function to convert the user's response to the number 3.5. >>> answer = input("How much does the sample weigh in grams? ") How much does the sample weigh in grams? 3.5

float

Which data type is 1.2e3?

float

A ________ is an example of an assistive technology that is used widely, and not just for computer use.

hearing aid

Assume that your body mass index (BMI) program calculated a BMI of 41.6. What would be the value of category after this portion of the program was executed? # Determine the weight category. if BMI < 18.5: category = "underweight"el if BMI > 39.9: category = "morbidly obese"el if BMI <= 24.9: category = "normal"el if BMI <= 39.9: category = "overweight"

morbidly obese

Complete the function to return the factorial of the parameter using recursion. def recursiveFactorial(number): if ________ return number * recursiveFactorial ________ else: return 1 stringNum = input("Enter a positive integer: ") num = int(stringNum) print(recursiveFactorial(num))

number > 1 number - 1

The following line of code returns the ASCII code for the given string. What is missing in the program below in order to have the output shown? >>> _____("c") 99

ord

Which part of the input-process-output model is line 3 in the program below? strWeight = input("Enter your weight in pounds: ") # Line 1 weight = float(strWeight) # Line 2 print (weight) # Line 3

output

What is the missing line of code? >>> phrase = "You are amazing!" >>> _____ 'u a'

phrase[2:5]

Which of the following are valid variable names? Select 3 options. 3rd_player player3 player# player_score playerScore

player3 player_score playerScore

A screen reader assists those with ________ issues.

vision


Conjuntos de estudio relacionados

Disability Income and Related Insurance

View Set

Chapter 28 - Head and Spine Injuries

View Set

Practice Problems: Praxis 5005 (Science)

View Set

Health Promotion and Maintenance (#1)

View Set

Combo with "AIS Chapter 8" and 8 others

View Set