Computer Science6

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

422) (Multiple Answers) 1 - 2 * 5 = 10 2 - 4 ** 3 = 64 3 - 7 / 2 = 3.5 4 - 17 % 3 = 2

1 - 10 2 - 64 3 - 3.5 4 - 2

423) (Multiple Answers) Select the data type for each example below. 1 - 2.5 2 - '2.5' 3 - 3 a - int b - float c - string

1 - b - float 2 - c - string 3 - a - int

436) (Multiple Answers; /) Identify the type of data for each value below (string/ float/ int). 1 - 12.023 2 - 'Hello World' 3 - 52

1 - float 2 - string 3 - int

425) (Multiple Answers; /) Choose the correct data type (string/int/float). 1 - type(3) tells you the type is 2 - type("35") tells you the type is 3 - type(3.5) tells you the type is

1 - int 2 - string 3 - float

438) (Multiple Answers; /) What type of data is the result of each of the following lines of code (int/ float/ string)? 1 - str(2.34) 2 - int('2') 3 - float(2)

1 - string 2 - int 3 - float

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

10

456) What is the value of the variable result after these lines of code are executed? >>> a = 6 >>> b = 2 >>> c = 3 >>> result = a * b - a / c The value of the variable is

10.0

450) What is the value of the variable result after this code is executed? >>> a = 7 >>> b = 2 >>> c = 0 >>> result = a * b - b / (c + b) >>> result Output:

13

453) What is the value of the variable result after these lines of code are executed? >>> a = 10 >>> b = 2 >>> c = 5 >>> result = a * b - a / c The value of the variable is

18.0

455) What is the value of the variable result after these lines of code are executed? >>> a = 2 >>> b = -3 >>> c = 4 >>> result = (a - b) * c The value of result is

20

427) What is the result of the arithmetic operation? 5**2 =

25

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

3

448) What is the value of the variable moneyDue after these lines of code are executed? >>> numSodas = 2 >> costSodas = 1.50 >>> moneyDue = numSodas * costSodas The value of moneyDue is

3

440) What will you see after on the next line? >>> round(3.9)

4

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

5

479) What is the value of numX when this program is executed? conditionA = False conditionB = True if conditionA or conditionB: numX = 5 else: numX = 10 numX is

5

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

6

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

6

454) What is the value of the variable result after these lines of code are executed? >>> a = 3 >>> b = 2 >>> c = 0 >>> result = a * b - c * b The value of result is

6

429) What is the result of the arithmetic operation? 3**4 =

81

424) Which number is equivalent to 72.5e-2? A - 0.725 B - 7.25 C - 7250 D - 72.5

A - 0.725

464) What will be the output of the following program? Assume the user responds with a 2. answer = input ("How many books would you like? ") priceBook = 3.20 intNumberBooks = float(answer) moneyDue = intNumberBooks * priceBook print ("You owe $", moneyDue) A - You owe $ 6.40 B - You owe $6.40 C - An error occurs. D - You owe $moneyDue

A - You owe $ 6.40

430) Which data type is 2.5? A - float B - single C - string D - int

A - float

426) What is the result for the following line of code? >>> print("one" + "day") A - oneday B - one day C - one + day D - one day

A - oneday

465) What can you change, if anything, in this line so that there will not be a space between the dollar sign and the amount of money due? print("You owe $", moneyDue) A - print("You owe $" + str(moneyDue)) B - The space cannot be removed. C - print("You owe $" , str(moneyDue)) D - You do not need to change anything. There is no space.

A - print("You owe $" + str(moneyDue))

414) (/) (Refinement/ Abstraction) is a technique where the general characteristics are kept and the details are hidden.

Abstraction

437) What is the output for the following line of code? >>>int(2.8) A - 2.8 B - 2 C - 3 D - '2.8'

B - 2

480) What is the output of the following program? Assume numA is 4, numB is 2, and numC is 6. if numA < numB and numB < numC: print(numA)elif numB < numA and numB < numC: print(numB) else: print(numC) A - numA B - 2.0 C - numB D - 4.0

B - 2.0

463) What will be the output of the following program? Assume the user responds with a 5 for the first number and a 4 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) A - The result is4.5 B - The result is 7.0 C - The result is7.0 D - The result is 4.5

B - The result is 7.0

467) What will be the output of the following program? Assume the user responds with a 5. answer = input ("How many hamburgers would you like? ") priceBurger = 3.00 intNumberBurgers = float(answer) moneyDue = intNumberBurgers * priceBurger print ("You owe $", moneyDue) A - An error occurs. B - You owe $ 15.0 C - You owe $ moneyDue D - You owe $15.0

B - You owe $ 15.0

469) What will be the output of the following program? Assume the user responds with a 3. answer = input ("How many shirts would you like? ") priceShirt = 4.00 intNumberShirt = float(answer) moneyDue = intNumberShirt * priceShirt print ("You owe $" + str(moneyDue)) A - An error occurs. B - You owe $ moneyDue C - You owe $12.0 D - You owe $ 12.0

C - You owe $12.0

441) What will you see after on the next line? >>> int("3.9") A - 4 B - 3 C - an error statement D - 3.9

C - an error statement

449) The formula to convert Fahrenheit (F) temperature to Celsius (C) is C=F−321.8 Which line of code will accomplish this conversion? A - celsius = Fahrenheit - 32 * 1.8 B - celsius = Fahrenheit - 32 /* 1.8 C - celsius = (fahrenheit - 32) / 1.8 D - celsius = (Fahrenheit - 32) * 1.8

C - celsius = (fahrenheit - 32) / 1.8

428) Which data type is -7? A - float B - string C - int D - single

C - int

411) (/) (Programming/ Computational thinking) allows you to break down a complex problem into understandable parts so that step-by-step solutions can be found. It includes four techniques.

Computational thinking

412) (/) (Pattern recognition/ Decomposition) is a technique for breaking a problem down into smaller, less complex parts.

Decomposition

413) (/) (Pattern recognition/ Decomposition) involves looking for similarities.

Pattern recognition

406) (Multiple Answers) Which of the following statements about computational thinking are true? Select 3 options. a - Computational thinking involves the techniques of decomposition, pattern recognition, abstraction, and algorithm development. b - Understanding all of the minor details about a problem is critical in computational thinking. c - The result of computational thinking is a problem broken down into its parts to create a generalized model and possible solutions. d - Computational thinking is a set of techniques used to help solve complex problems or understand complex systems. e - Computational thinking is basically synonymous with programming.

a - Computational thinking involves the techniques of decomposition, pattern recognition, abstraction, and algorithm development. c - The result of computational thinking is a problem broken down into its parts to create a generalized model and possible solutions. d - Computational thinking is a set of techniques used to help solve complex problems or understand complex systems.

408) (Multiple Answers) Which of the following statements are true regarding abstraction? Select 3 options. a - Refinement is the opposite of abstraction. b - Abstraction is a process where details are added to further define the problem. c - Abstraction provides a way to see a complex situation more clearly. d - Creating a model must occur before abstraction. e - The level of abstraction needed depends on the situation and your goals.

a - Refinement is the opposite of abstraction. c - Abstraction provides a way to see a complex situation more clearly. e - The level of abstraction needed depends on the situation and your goals.

409) Taking a group of recipes and identifying the similarities is an example of _____. a - pattern recognition b - decomposition c - abstraction d - refinement

a - pattern recognition

452) (Multiple Answers) Which of the following are valid variable names? Select 3 options. a - player_score b - 2nd_num c - playerScore d - num1 e - player@

a - player_score c - playerScore d - num1

400) (Vocab) technique where important general characteristics are kept, while details are ignored

abstraction

470) (Vocab) a boolean operator that returns true only when both conditions are true

and

446) (Vocab) A statement that assigns a value to a variable

assignment statement

407) Which of the following statements are true regarding models? Select 3 options. a - Models help you understand a complex situation by including all of the details. b - In a model, the general characteristics are separated from the details. c - Models help predict how a specific solution will respond. d - Models help communicate a design. e - Models represent the system or problem at a detailed implementation level.

b - In a model, the general characteristics are separated from the details. c - Models help predict how a specific solution will respond. d - Models help communicate a design.

472) (Vocab) converts data to boolean

bool()

471) (Vocab) a data type that is used to represent true and false

boolean

461) (Multiple Answers) Which statements will ask the user for a number? Select 2 options. a - answer = in("How many sodas do you want? ") b - answer = input(How many sodas do you want? ) c - answer = input('How many sodas do you want? ') d - answer = in(How many sodas do you want? ) e - answer = input("How many sodas do you want? ")

c - answer = input('How many sodas do you want? ') e - answer = input("How many sodas do you want? ")

410) Taking a recipe and breaking it down into its individual sections, like ingredients, preparation, cooking instructions, and nutritional information, is an example of _____. a - pattern recognition b - refinement c - decomposition d - abstraction

c - decomposition

431) (Vocab) complex(real, imaginary) creates a complex number with the specified real and imaginary parts

complex()

416) (Vocab) the process of connecting two or more strings together using the + sign

concatenation

451) (Multiple Answers) Assume you previously entered these lines of code. >>> a = 3 >>> b = 2 >>> c = 0 Which lines of code below generate errors? Select 2 options. a - result = a * b - b / (c + b) b - result = a * b - c / (a + c) c - result = a * b - c / b d - result = a * b - b / c e - result = ab + bc

d - result = a * b - b / c e - result = ab + bc

401) (Vocab) removes the details of data and keeps its general characteristics, as with a data type

data abstraction

402) (Vocab) technique where a problem is broken down into smaller, less complex parts

decomposition

417) (Vocab) a number with decimal places such as 2.3 and -8.78

float

433) (Vocab) a function that converts a number or a string of digits into a float

float()

458) Asking the user for four numbers is an example of

input

457) (Vocab) pauses the program until the user enters a response, which can be saved in a variable

input()

466) (/) The (input()/ display()/ print()) function is used to acquire data from the user.

input()

418) (Vocab) integers such as 3, -2400, and 0

int

462) Fill in the blank in order to convert the user's response to a number without a decimal point. >>> answer = input("How many sodas do you want? ") How many sodas do you want? 5 >>> numberAnswer = _____(answer)

int

432) (Vocab) a function that converts a number or a string of digits into an int by truncating the decimal part

int()

478) What is the output of this program? age = 4 if age > 5: print("more") else: print("less") Output:

less

415) (/) Through the use of computational thinking techniques, models and algorithms can be created. A(n) (algorithm/ model) can be created that represents the generalized problem. A(n) (algorithm/ model), or set of step-by-step instructions, can be developed to solve the problem.

model, algorithm

476) (/) You can join the Army if you are over 17 and healthy. Have you met those requirements if you are 16 and healthy (yes/no)?

no

473) (Vocab) a boolean operator that returns the opposite of the condition's truth value

not

419) (Vocab) a data type consisting of integers or decimal numbers

numeric

474) (Vocab) a boolean operator that returns false only when both conditions are false

or

460) Telling the user the average is an example of

output

403) (Vocab) technique of looking for similarities between problems or objects

pattern recognition

468) (/) The (print()/ display()/ input()) function is used to display the program's output.

print()

404) (Vocab) removes the details of a process, as with a function

procedural abstraction

459) Finding the average of the four numbers is an example of

processing

405) (Vocab) adding details to a model to make it less abstract, the inverse process to abstraction

refinement

475) (Vocab) an operator used to compare two values

relational operator

434) (Vocab) rounds a float to an integer to the nearest integer; when the decimal part is 0.5, it rounds even; round(number, places) rounds to the specified number of decimal places

round()

435) (Vocab) converts numeric data to string

str()

420) (Vocab) a data type consisting of characters

string

421) (Vocab) a function used to determine the data type

type()

447) (Vocab) Identifier used to store a value

variable

477) (/) You can earn a scholarship if you have an ACT over 30 or you are valedictorian of your high school. Have you earned a scholarship if you have an ACT of 34 but are not the valedictorian (yes/no)?

yes


Ensembles d'études connexes

NRSG 1500 Final (EAQ Remediation Questions)

View Set

Honan-Chapter 42: Nursing Management: Patients With Musculoskeletal Trauma

View Set