unit 1 comp sci

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

Which of the following describes algorithmic solutions to problems: I. A set of step by step instructions for assembling a piece of furniture.II. A flowchart used to make important decisions on which actions to take in an emergency situationIII. A recipe for baking a cake with detailed numbered steps to follow

I, II, and III

sprite

an object in Scratch that performs functions through scripting.

looks blocks

purple-colored blocks of code in Scratch that are used to control a sprite's appearance.

Which of the following statements about low-level languages are true?

-They are generally less readable by humans than other languages -They are very rarely ambiguous

Consider the following actions which might be performed by a developer when creating a new piece of software to solve a problem. 1. Thoroughly testing code with a variety of inputs2. Designing an algorithm to tackle the central problem the program hopes to solve3. Considering what outputs a program solving the problem might produce and what inputs it may require to do this4. Writing code in a high-level programming language to implement an algorithm In which order in the development cycle would these actions first appear?

3, 2, 4, 1

Which of the following best describes how abstraction makes code written in higher-level programming languages easier for humans to parse?

Abstractions used in higher-level languages mean what a command does is easier to understand without needing to parse all the individual operations performed by the CPU.

A statistics teacher wishes to create a program on her calculator that generates a random even integer. The command built in the calculator to generate a random positive integer is RANDOM(a,b). This command generates a random integer between integers a and b (and including a and b). Which of the following lines of code will ensure that the random integer generated will be even?

RANDOM(a,b) * 2

A program that Thomas has written is complete. It has been tested thoroughly, and some outputs were not as expected. Thomas is now going through the code carefully attempting to establish the cause of these errors and change the code to remove them. What is this procedure called?

debugging

Jama is creating a program which calculates the square roots of whole numbers. The program will store the results of each square-root as a variable. Which of the following data-types would be best used for this variable?

float

code statement

is a part of program code that expresses an action to be carried out

sensing blocks

light-blue colored Boolean blocks that are used to detect different factors of a project such as touching.

Sensing Blocks

light-blue colored Boolean blocks that are used to detect different factors or a project such as touching.

operator blocks

light-green colored blocks of code used to handle strings and math equations in Scratch.

binary

machine code that is a direct, low-level translation from the high-level source code, and is a pattern of 0s and 1s.

machine code

machine-level instructions that are uniquely read by computer processors using patterns of 1s and 0s.

Which of the following is an example of code written in a high-level programming language?

num1 = 8 - 3 num2 = 2 * num1 + 1 print(num2)

array

lists of other variables.

source code

programs written in high-level languages.

Which of the following is a valid reason for giving variables meaningful names in a program?

A programmer will find it easier to read and understand the code since they will know what the variables represent.

Boolean values

a variable to represent true or false.

bit

binary digit - a 0 or 1.

character

a single letter, digit, or symbol that can be a type of variable.

Jeremiah is part of a group planning a summer fair at which local businesses can run stalls and events. He wants to use his programming skills to develop an app for the fair which businesses will be able to use to communicate information about their activities at the fair with visitors. Which of the following would be the best first step for Jeremiah to take?

Find out from the businesses and potential visitors what information and format they think should be used for the app

The following algorithm is proposed for the task of baking a cake, and is presented along with a list of ingredients. Add some ingredients from the list to a bowl Stir Add other ingredients to a bowl Stir Put in a tin in the oven Take out tin from oven Which of the following correctly describes an issue with the way the instructions in this algorithm is presented?

The instructions lack descriptive qualifiers

algorithm

a finite set of instructions that accomplish a specific task.

Which of the following best describes why the development process by which computer programs are created is described as "iterative"?

The process is a cycle, with results from one run of the cycle feeding into the next.

Which of the following are benefits of well-named variables? Select two answers.

The program will be easier to read. & The program will be easier for others to debug.

Which of the following best describes high-level computing languages?

They are not very ambiguous

broadcast

When blocks of code are executed at a given time by communicating (or broadcasting) a message.

The following algorithm is presented for assembling a piece of furniture from 12 individually numbered parts. Parts 1, 5, and 11Parts 2 and 10Part 12Parts 6 to 9 inclusiveParts 3 and 4 Which of the following correctly describe issues with the way these instructions are presented? I. There instructions lack the required descriptive qualifiersII. The instructions lack the required imperative statementsIII. The order in which the instructions should be performed is unclear

II only

Which of the following is NOT an advantage of giving variables meaningful names in a program?

It is easier for a computer to understand the program, meaning compile-times and run-times are reduced

Which of the following measures can a programmer take to help ensure that a program produces correct output?

Test multiple inputs on the program & Develop the program in smaller steps, ensuring each step is correct

Chad has written the majority of his code in Scratch and is ready to start running his program using a variety of carefully chosen conditions to see if it functions properly in all these cases. Which of the following software development terms best describes this process?

testing

costume

the appearance of a sprite.

output

the physical display of the newly calculated information

stage

The background of a project in Scratch which can have scripts, backdrops, sound, etc.

Which of the following describes good practice when naming variables in code?

Use concise names to avoid typos and keep code tidier & Use names which describe what each variable represents to make code easier to understand

integer

a whole number; a number that is not a fraction that is used in programs.

Which of the following best describe examples of abstraction

A developer writing a program for calculating properties of shapes uses a variable pi to store a decimal approximation of the number π (~3.14159). They use this variable whenever they need to use the number π to calculate an area or volume. & A sheet of music for guitar is written as a series of chords (e.g C, Am, G7). Each of these represents multiple notes which are played simultaneously on different strings of a guitar.

Which of the following statements comparing low-level programming languages (such as assembly language) and high-level programming languages (such as python or java) are correct? Select two answers.

A program written in a high-level language will usually be easier for a person reading the code to understand than one written in a low-level programming language. & A program written in a low-level language is closer in syntax to the binary code understood by computers than a program written in a high-level language.

Tamara is writing code as part of a large project. She has just compiled her code and run it, but the result is not exactly as expected. Which of the following strategies would be efficient ways to "debug" her code so that it works as intended? Select two answers.

Add statements to display the state of the program at various points to try and identify where the error might have occurred. & Try changing some of the inputs to see under what circumstances the program is not working and what type of error may be occurring.

Which of the below options would be the best set of instructions to give for a program designed in Scratch?

Click on the GREEN flag. Once the game starts, use the arrow keys to navigate your way through the maze. In your travels, collect the "hearts" for more lives and avoid being eaten by zombies.

Understanding of the life cycle of a program is an essential component to becoming an effective programmer. Which of the following is the best example of how the life cycle of a program should work?

Idea→algorithm→write code→execute code→debug→maintain

Language A:Calculate the average daily rainfall for the week (averageRainfall) by adding together the rainfall totals for each of the 7 days of the week (sun, mon, tue, wed, thu, fri, and sat) and dividing the sum by 7. Language B:Take the total amount of rain from each day of the week (sunday, monday, tuesday, wednesday, thursday, friday and saturday) and then average them together to get the average daily rainfall for the week (averageRainfall). Which of the following statements about these two implementations is true?

Language B is ambiguous because the process of "average" is not explained well

Which of the following describes the part of a computer which stores instructions and information which has been input to the computer?

RAM

Consider constructing an algorithm for a robot that can only perform the following three predefined operations. MOVE_FORWARD ( ): The robot moves one square forward in the direction it is facing.ROTATE_LEFT ( ): The robot rotates in place 90 degrees counterclockwise (i.e., makes an in-place left turn).ROTATE_RIGHT ( ): The robot rotates in place 90 degrees clockwise (i.e., makes an in-place right turn). Which of the following algorithms could successfully cause the robot to trace out a "T"-shaped path as drawn above?

Step 1: MOVE_FORWARD ( ) Step 2: MOVE_FORWARD ( ) Step 3: ROTATE_LEFT ( ) Step 4: ROTATE_LEFT ( ) Step 5: MOVE_FORWARD ( ) Step 6: ROTATE_RIGHT ( ) Step 7: MOVE_FORWARD ( ) Step 8: MOVE_FORWARD ( )

Which of the following is the MOST important reason computers use artificial languages over natural language?

The syntax of artificial languages is explicit and unambiguous

Which of the following could NOT be represented by a boolean variable?

Whether a traffic light is green, yellow or red

memory (RAM)

a memory storage space

floating point number

a number that may have digits after the decimal place. Can be a type of variable.

low-level language

a programming language that has little or no abstraction and communicates closely to the hardware using machine language. Less natural for humans.

visual programming language

a programming language that lets users drag and drop icons into organized blocks of code to create programs rather than typing text.

event

blocks of code that trigger corresponding behavior (example: Green Flag - starts program)

Which of the following variable types is characterized by allowing only two possible values to be stored?

boolean

declaring variables

creating variables in a programming language

Rhys is creating a program which stores customer records. One variable used in the program stores the first initial of a customer's name. Which of the following data-types could be used to store this data? Select two answers.

string & character

programming

the action or process of writing computer programs.

storage

what the computer "stores" or needs to remember to execute a program.

Which of the following is a reason for the importance of variables in programming?

Variables allow you to store values calculated by the program and access them at a later point in the program. & Variables allow you to change a value used in multiple places in a program easily. & Variables assist in making code more readable.

Consider the following statement which refers to the block (move 10 steps) When you execute this block in Scratch, your computer is actually doing several things: retrieving values from memory representing the direction and position of the sprite, performing an algorithm to update these values, and changing the display in the window to match the updated state of the program. All of these actions are represented by just one single block. Which of the following terms names the phenomenon which is best described by this statement?

abstraction

Which of the following terms best describes the process of suppressing complex details of a system and presenting a simplified version with just the relevant details?

abstraction

iteration

repetition - one complete step of a loop, repeated until a certain condition is met.

ambiguity

uncertainty or being open to more than one interpretation.

computational thinking

understanding the logic and processes computers use to solve problems and run programs.

input

user interaction with a program via clicking, mouse movement, or keyboard entry.

selection

uses "if...then" to tell a computer how to select a step or to tell the sequence that it should be executed.

string

a series of characters at any length. Can be a type of variable.

Information Age

a shift in human history from traditional industry to an economy based on information computerization using analysis and thinking - AKA: Digital Age

descriptive qualifier

a specific adverb or adjective that further qualifies or limits the meaning of a word (example: left shoe)

program

a systematic plan or sequence of instructions for a computer to solve a problem.

Imagination Age

a theoretical period beyond the information age where creativity and imagination will become the primary creators of economic value.

placeholder

a variable for a particular value or attribute.

computer science

the study of the ideas, ways of thinking, languages, software, and hardware needed to solve problems with computers.

position

the x and y coordinates on the stage in Scratch.

debug

to identify and remove errors from a computer program

Which of the following is a simplified but equivalent Boolean expression to the following: (X > 0 AND X ≤ 20) OR (X > -5 AND X < 15)

(X > -5) AND (X ≤ 20)

Which of the following statements about variables in programming are true? I. Variables allow a value to be stored for future useII. Once the value of a variable is set it cannot be changedIII. The name given to a variable is important for human comprehension, but not for the computer.

I and III only

Which of the following should be true of any algorithm? I. The order in which the steps making up the algorithm are followed is logically determinedII. Following the instructions in the algorithm will always result in the same outputs, regardless of any inputsIII. The instructions in the algorithm contain all necessary information to be implemented

I and III only

Which of the following best describes "compilation" in reference to computer science?

Code in a high-level language is converted to low-level instructions which can be interpreted and run by the CPU.

Which of the following statements are NOT true about high level programming languages? Select two answers:

Code written using high level languages is guaranteed to be ambiguous & Any particular algorithm will be written in the same way regardless of which high level programming language is used

A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of goats to sheep and all occurrences of sheep to goats. The programmer will use the fact that the word foxes does not appear anywhere in the original text.

First, change all occurrences of goats to foxes, then change all occurrences of sheep to goats, and then change all occurrences of foxes to sheep.

The algorithm below simulates rolling a regular 6-sided die twice. Consider the goal of determining if the sum of the values of the two rolls is odd or even. Step 1: Using a random number generator, get a value between 1 - 6 inclusively Step 2: Remember that number Step 3: Repeat steps 1 and 2 Step 4: Add the two remembered numbers together Step 5: Multiply that sum by 10 Step 6: Divide the result of that multiplication by 2 What conclusions can be made with regard to what we are trying to determine? Select two answers:

If the last digit of the value found in step 6 is 5, then the sum is odd & If the value found in step 6 is 10, 20, 30, 40, 50 or 60 then the sum is even

Rick is in charge of a team developing a program which will be used by businesses to control stock. The team has already consulted with potential clients and developed an idea of what inputs will be required and the likely outputs that will be produced from these inputs. Which of the following should Rick and his team do next?

Plan the structure of the program and determine how the major algorithms will work

Consider the following algorithm which uses an integer variable n. Double the value of n Add 34 to the answer Round the answer to the nearest ten Sum the digits of the answer Display the final answer Which of the following statements best describes the predictability of the results when this algorithm is run on a computer?

The answer displayed by the algorithm for any known value of n can always be predicted.

Microsoft Excel® is a spreadsheet program that can be used for computing the average of a list of values in cells A1 through A20 with a command such as =AVERAGE(A1:A20). After the user initiates this command, the command disappears and the average (or mean) of the list of numbers appears. Why is this an abstraction?

The average can be viewed without knowing the process of how the average was computed.

Which of the following best describes how a compiled program is run by a computer?

The binary instructions from the program are loaded into RAM. The CPU reads and executes instructions, storing and accessing data from RAM as needed.

reporter blocks

a block in Scratch with round edges that contains a value (numbers, sentences, etc.) and can be used inside other blocks.

imperative statement

a command statement with a verb phrase that indicates an operation to perform (example: move forward)

natural language

a complex, but structured language, both written and spoken, that has evolved naturally in humans through use, repetition, and adaptation.

attributes

a description of what the computer is doing or the values of variables at any given moment.

state

a description of what the computer is doing or the values of variables at any given moment.

artificial language

a limited size language, usually developed by a small group for specific purposes. Usually much simpler and structured.

variable

a placeholder to store a particular value or attribute such as x and y in an algebraic equation or calculation.

high-level language

a programming language that is easier for humans to read, write, and parse. Guaranteed to be unambiguous.

sequencing

executes statements one at a time - in order, one after another.

Marta is writing a program for a home-automation system. Three of the variables in her program are as follows: light - A variable which determines whether the lights in a room are switched on or offtemp - A variable which records the temperature of the room to the nearest whole degree Fahrenheitname - A variable which records the name the user has set for the room (e.g. "kitchen") Which of the following correctly describes the types which would be best used for each of these variables?

light - boolean, temp - integer, name - string

motion blocks

medium-blue colored blocks used to control a sprite's movement in Scratch.

Roxanne is writing a program which will be used to display information to passengers on a flight. Some of the variables she will use for her program are as follows. speed - the current speed of the airplane relative to the ground in meters per secondpassengers - the number of passengers on-board the planedestination - the name of the destination airport of the flight Which of the following correctly describes the types which would be best used for each of these variables?

speed - float, passengers - int, destination - string

The owner of a pet store wants to determine how many fish she can keep in a given aquarium before the population becomes too overcrowded for the fish to survive. Rather than risking the lives of actual fish, she decides to simulate an aquarium with a program in order to determine its maximum capacity. Which of the following would NOT be a useful factor to include when modeling the properties of the simulated tank and fish population?

the color of the fish

iterative development process

the process by which computer programs are designed, developed and tested in repeated cycles

innovating

the process of imagining something that does not yet exist, but that has potential value, and making it real through the application of design, implementation, and production

abstraction

the process of removing or suppressing details to create a manageable level of complexity.

compilation

the process of source code being translated into machine code.

the central processing unit (CPU)

the processor that calculates information

process

the program code and current activity that is being executed in a computer program.


Ensembles d'études connexes

Consumer Behavior Test 3 Practice

View Set

Chapter 6 - Chemical Composition

View Set

Western Civilization Ch. 12 - Spielvogel

View Set