MakeCode Unit 3 Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

In the following code segment, score and penalty are initially positive integers. The code segment is intended to reduce the value of score by penalty. However, if doing so would cause score to be negative, score should be assigned the value 0. For example, if score is 20 and penalty is 5, the code segment should set score to 15. If score is 20 and penalty is 30, score should be set to 0. The code segment does not work as intended. Line 1: IF(score - penalty < 0) Line 2: { Line 3: score ← score - penalty Line 4: } Line 5: ELSE Line 6: { Line 7: score ← 0 Line 8: } Which of the following changes can be made so that the code segment works as intended? Changing line 1 to IF(score < 0), Changing line 1 to IF(score + penalty < 0), Changing line 7 to score ← score + penalty, Interchanging lines 3 and 7

Interchanging lines 3 and 7

Which answer below is not a benefit of an iteration? Less efficient, Easier to read, Easier to edit, Shorter code

Less efficient

In the following procedure, the parameter age represents a person's age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended. Line 1: PROCEDURE ageGroup(age) Line 2: { Line 3: result ← "adult" Line 4: IF(age ≥ 65) Line 5: { Line 6: result ← "senior citizen" Line 7: } Line 8: RETURN(result) Line 9: Line 10: result ← "adult" Line 11: IF(age < 18) Line 12: { Line 13: result ← "minor" Line 14: } Line 15: RETURN(result) Line 16: } Removing which two lines of code will cause the procedure to work as intended? Select two answers.

Lines 8 and 10

A Boolean value is either true or false

True

Abstraction can be experienced by the design of a product which allows you to use it without understanding the complexity of the product, or the complex process that happens every time you press a button or turn a key.

True

Camel case is frequently used in programming languages to name different files and functions without spaces.

True

Comments on your code are a form of program documentation written into the program to be read by people and do not affect how the program runs.

True

String variable can have text or numbers and require the stored information to be in " " (quotes)

True

The following code represents a Sequencing algorithm: (look at screenshot)

True

The purpose of computing innovations is to solve problems or to pursue interests through creative expression.

True

The three different constructs used in algorithms are: Sequencing - the application of each step of an algorithm in the order in which the code statements are given. Iteration - a repeating portion of an algorithm; it repeats a specified number of times or until a given condition is met. Selection - determines which part of an algorithm is executed based on a condition being true or false.

True

You can use // to comment a single line of code in JavaScript and /* */ to comment multiple lines of text.

True

Considering the robot code below, which direction will the front of the robot be facing after the code is complete? Move_Forward () Rotate_Left () Move_Forward () Repeat 3 Times: { Rotate_Left () Move_Forward () Move_Forward () }

facing up

This flowchart symbol is a. data b. decision c. process d. flow line

A

Constant data types (choose all the correct answers): a. Stay the same every time a program is executed. b. Are "hard coded" c. Are an abstraction inside a program that can hold a value d. Can change.

A and B

Proper variable names (choose all the correct answers): a. personName, b. carModel, c. pet Name, d. stateName

A, B, D

A flowchart is (choose all the correct answers): a. Diagram of steps in a process. b. Visualize an algorithm. c. Helpful for writing programs. d. Not useful for explaining the program to others.

A,B,C

Event Handlers in MakeCode include (choose all the correct answers): Overlap events and Lifecycle events 🡪 Sprites, Button presses and connected players 🡪 Controller, Game update and time passing 🡪 Game, Hits wall and overlap events 🡪 Scene, If, then and If, else 🡪 Logic

All of the above

Select the different types of loops in MakeCode. Forever - will repeat forever, Repeat - repeats for the designated number of times, For loop - similar to repeat, but uses an index variable, While loop - repeats until a certain condition is met

All of the above

Which of the answers below is not a text coding tip within MakeCode? Intellisense, Autotype, Toolbox, Help

Autotype

A student is creating an application that allows customers to order food for delivery from a local restaurant. Which of the following is LEAST likely to be an input provided by a customer using the application? a. The address where the order should be delivered. b. The cost of a food item currently available for order. c. The credit card or payment information for the purchaser. d. The name of a food item to be included in the delivery.

B

Considering the Modulus Operator (modulo), select all the answers below that are correct. a. 27 mod 5 = 3, b. 40 mod 2 = 0, c. 25 mod 3 = 0, d. 29 mod 3 = 2

B

This flowchart symbol is a. data b. decision c. process d. flow line

B

What is an algorithm? a. Specialized computer programming language. b. Set of instructions for solving some problems, step by step c. A microchip with billions of electronic switches that turn zeros and ones on and off. d. Block chain NFTs sold for lots of money.

B

What is the substring text in the variable answer Is? a. t like taki b. taking test c. aking tests d. king test.

B

What is the correct order of the programming environments below when thinking of highest to lowest abstraction? Machine Code, Text Code, Block Code; Block Code, Machine Code, Text Code; Text Code, Block Code, Machine Code; Block Code, Text Code, Machine Code

Block Code, Text Code, Machine Code

Consider the two programs below. Which of the following best compares the values displayed by programs A and B? a. Program A and program B display identical values in the same order. b. Program A and program B display the same values in different orders. c. Program A and program B display the same number of values, but the values differ. d. Program B displays one more value than program A.

C

In a certain computer program, two positive integers are added together, resulting in an overflow error. Which of the following best explains why the error occurs? a. The program attempted to perform an operation that is considered an undecidable problem. b. The precision of the result is limited due to the constraints of using a floating-point representation. c. The program can only use a fixed number of bits to represent integers; the computed sum is greater than the maximum representable value. d. The program cannot represent integers; the integers are converted into decimal approximations, leading to rounding errors.

C

Which statement is false when considering what computers are better at than humans? a. Computers can perform these tasks because a programmer provided the detailed instructions and rules for the computer to follow. b. Computers only do exactly what they are told to do and nothing else. c. Computers can tell good jokes. d. Computers are good at math.

C

Variable data types (choose all the correct answers): a. Stay the same every time a program is executed. b. Are "hard coded" c. Are an abstraction inside a program that can hold a value d. Can change.

C and D

Consider the code segment below. A computer code in 8 lines are as follows. Line 1: IF (a = 0) Line 2: { Line 3: b ← a + 10 Line 4: } Line 5: ELSE Line 6: { Line 7: b ← a + 20 Line 8: } Which of the following changes will not affect the results when the code segment is executed? Changing line 3 to b ← 10, Changing line 3 to a ← b + 10, Changing line 7 to b ← 20, Changing line 7 to a ← b + 20

Changing line 3 to b ← 10

Integers can be text and numbers

False

Pseudo-random numbers are generated from physical phenomena that take place outside of the computer.

False

The following code represents an Iteration algorithm: (look at screenshot)

False

The following code represents an Selection algorithm: (look at screenshot)

False


Kaugnay na mga set ng pag-aaral

Human Nutrition (preparing for the final) Chapter 13, DHN 101 Final 2, DHN 101 EXAM 4

View Set

Unit 19 Identifying and selecting aims

View Set

CT Life and Health State Exam Simulator

View Set