Computer Science Essentials EOC Review

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

Global Variable

A variable type that is declared outside any function and is accessible to all functions. A global variable can be accessed and referenced by any part of the program, which means it has a global scope.

"White Hat" hacking

A white hat hacker -- or ethical hacker -- is an individual who uses hacking skills to identify security vulnerabilities in hardware, software or networks.

37. What should project teams do to produce a better software product? a) Break down the problem into manageable units. b) Code while requirements are being finalized. c) Reduce the testing step to the more complicated condition only. d) Not allowed any changes from the user.

A

40. Use the code below to answer questions 38 through 40. count = 1 pets = ['dog','dogfood', 'cat','catfood','fish'] for animal in pets: if animal == 'fish' print (animal) pets[count:count] = pets['fishfood'] count +=1 What is the value of pets[3] after the following code is run? pets[1:1] = pets['horse'] pets[2:2] = pets['carrots'] del pets[3] a) It is an empty field b) dog c) dogfood d) cat

A

15. How has cloud computing helped with communication? Select two answers. a) By allowing asynchronous communication with email and text messaging b) By allowing synchronous methods of communication such as video conferencing c) By reducing the need for translation services since data can be quickly accessed from anywhere d) By providing cloud-based presentation tools to use with local data

A + C

Boolean Data Type

A data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra.

Local Variable

A variable with local scope is one that can only be used by code within the same scope. Declared inside the function. Stored data that is only used within a small scope of a project and cannot be used by other parts of the program.

13. What is the value of y after the following statements? x = 10 x = x+4 y = x % 3 a) 0 b) 2 c) 3 d) 4

B

18. What is displayed after the following code runs? line_1 = "Good luck" line_2 = "on the EOC!" print (line_1 + line_2) a) Error message, cannot concatenate strings b) Good luck on the EOC! c) Good luck on the EOC! d) 24, which is the number of characters in the strings

B

2. Your boss has been less talkative and friendly lately. Do you... a) Avoid her b) Ask her feedback on your work performance c) Ask others if she has personal problems. d) Look for another job. You would rather quit than be fired.

B

1. Which of the following statements is NOT a benefit of using computers to process data? a) People can use computers to find patterns in data and make predictions b) Computers help people visualize data so that it is easy to extract useful information. c) Websites can spy on people and gather large amounts of personal data without the user knowing. d) Computers are able to easily process, manipulate, and display large amounts of data in a short amount of time.

C

12. What is the value of x after the code below runs? def calc_temp(temp): new_temp = (temp - 32) *5/9 return (new_temp) x = calc_temp(50) a) -10 b) 10 c) 4 d) -4

C

29. A high school has two rows of lockers. Even numbered lockers are on the top row and odd numbered lockers are on the bottom. Do the following two algorithms correctly calculate which lockers should be counted as even numbered ones for the top row and which should be counted as odd numbered lockers for the bottom row? Block 1 if count % 2 == 1: top_locker += 1 Block 2 if count % 2 != 1: Bottom_locker += 1 a) Block 1 works correctly b) Block 2 works correctly c) Both blocks work correctly d) Neither blocks work correctly

C

3. You have to change a program written a year ago by someone else. A sample selection of code is below. How could the original program author have helped someone make changes at a later date? def a(x,y,z) if x<y: x=z a) Provided the original program requirements b) Added a video describing the program design and functionality c) Used function and variable names that described their purpose and content d) Provided written documentation of the application development process

C

31. Each of the following can make an algorithm more readable EXCEPT: a) Well-named variables and procedures b) Consistent formatting within the code c) Procedures that have one purpose d) Minimizing the use of loops so the program flow will be clearer

C

33. What is the value of car_check after the code below runs? def car_maint (miles): check_up = False if miles >= 4999 check_up = True return check_up car_check = car_maint(4999) a) False b) True c) check up d) 4999

C

43. If two people need to collaborate on a document but are in two different locations, what is the best solution? Select two answers. a) One person needs to travel to the other person's location. b) Assign a different person to work on the document that is located in the same place as one of the others. c) Use a cloud-based service for the document so both can edit it. d) Hold video conferences for them to speak face to face to discuss the document.

C + D

1. A colleague is very negative about your idea in front of your boss. Do you... a) Remind your colleague of their last flawed idea. b) Say nothing. You'll see your colleague later. c) Get angry and ask why they are being so pessimistic. d) Thank your colleague and promise to consider their feedback.

D

23. Which of these is NOT a Boolean expression? a) if eyes == brown and height > 60 b) while song = fav_song c) if pet !=cat d) x += 42

D

25. In putting together a team, the project manager wants to have members with different backgrounds, even if they are in non-related fields. What is the best reason for this idea? a) Different experiences will help develop leaders on the team. b) There will be support for the project from all areas that have team members involved. c) The team members will ensure the project excels in their area of expertise. d) Different perspectives will help develop a better product.

D

26. Which code segment will correctly add a name to a team roster? Assume all variables and lists are appropriately initialized. Block 1 while x>0: roster.append(name) x +=1 Block 2 for name in roster: roster.append(name) printer (name) a) Block 1 b) Block 2 c) Both Block 1 and Block 2 d) Neither Block 1 nor Block 2

D

5. Your pay raise was much less than expected this year. Do you... a) Take a few extra sick days to even the score. b) Ask your colleague how much they got to see if yours was fair c) Go to your bosses' boss with your disappointment. d) Ask your boss what actions would warrant a reassessment in six months.

D

4. Describe a procedure or function and how you would call one in MIT App Inventor and Python.

Moving Forward in MIT app inventor is the block forward and in Python it is Forward=function move.

Argument (Parameter)

The actual value of a variable that gets passed to function

8. How do you convert data types in Python?

Use implicit or explicit type conversions. Implicit automatically converts data types without user involvement, and explicit needs the user to manually convert data types.

9. In Python, how do you obtain string data from the user? Data of any type?

You use input data with int or float for numbers

Nested Conditional

a conditional statement where the then-part and/or the else-part contains another conditional statement.

For Loop

a control flow statement for specifying iteration, which allows code to be executed repeatedly.

Pseudocode

a notation resembling a simplified programming language, used in program design.

Object-Oriented Programming

a programming paradigm based on the concept of "objects", which may contain data and code.

Logical Operators

a programming-language symbol that denotes a logical operation.

Decrement

a reduction or diminution

Concatenation

a series of interconnected things or events

API

a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other service.

Chained Conditional

alternative way to write nested selection such as the one shown in the previous section.

2. Describe the Scrum process for completing a project

describes a set of meetings, tools, and roles that work in concert to help teams structure and manage their work.

Cloud Computing

on-demand availability of computer science resources, especially data storage and computing power, without direct active management by the use.

While Loop

only loops as long as it receives a "true" value.

Conditionals

programming language commands for handling decisions

Iteration

repetition of a mathematical or computational procedure applied to the result of a previous application, typically as a means of obtaining successively closer approximations to the solution of a problem.

3. Describe the Agile Design process.

the stages run in parallel. You divide the functionality into small parts that can be delivered independently and start working on them.

Broadcasting

the transmission of radio waves or TV signals to a broad public audience

44. Which of the following are benefits resulting from technological innovations in education. Select two answers. a) Online courses are available if a school cannot teach a specific course. b) Online textbook are available during the school day c) Classes can participate in virtual field trips d) The digital divide is minimizing the gap of educational opportunities available to all.

A + D

Integer Data Type

A datum of integral data type, a data type that represents some range of mathematical integers; commonly represented as a group of binary digits.

10. If a list named snacks contains the values: snacks = ["chocolate", "peanuts", "granola", "chips", "grapes"] #A variable place is assigned the value: place = len (snacks) What will the value snacks[place] contain? a) 5, the number of items in the list b) 6, the number of letters in the word "grapes" c) grapes, which is the value in the 5th position of the list d) error, the list index is out of range

A

14. What is displayed after the following code runs? x = 10 y = 15 z = 20 if x<y or y>z: print (x) else: print (x + y) a) 10 b) 15 c) 20 d) 25

A

16. Use the code below to answer questions 16 and 17. snacks = ['popcorn','candy','grapes','apples'] for item in snacks: if item != 'banana': snacks.append('banana') print snacks What will the code display? a) ['popcorn','candy','grapes','apples','banana'] b) ['popcorn','candy','grapes','apples','banana','banana'] c) ['popcorn','candy','grapes','apples','banana','banana','banana] d)['popcorn','candy','grapes','apples','banana','banana','banana','banana']

A

17. Use the code below to answer questions 16 and 17. snacks = ['popcorn','candy','grapes','apples'] for item in snacks: if item != 'banana': snacks.append('banana') print snacks What is the index position of apples? a) 3 b) 4 c) 5 d) 6

A

19. What is an iterative software development process designed to do? a) To produce better software with a proven process b) To shorten the time of developing software by beginning to code while the requirements are being determined c) To eliminate the testing step by using only APIs d) To develop it right the first time through the iterative process

A

20. A group of students is collaborating to design an app to let students reserve a study room in the library. They are trying to decide how to check a room's availability. Which suggestion below is the best and why? a) Using real-time processing to ensure the app has current information b) Creating a loop to prevent the student from over-writing another room reservation c) Creating a function named "checkroom" because it can be called for each room and time slot d) Directing students to the phone number to call the library to confirm their reservation

A

32. Which set of pseudocode will correctly cause an alarm clock to chime at the correct time? a) Compare alarm time to current time If the times are not equal, check am/pm indicator If am/pm is equal, turn on the alarm b) Compare alarm time to current time If the times are equal, check am/pm indicator If am/pm is equal, turn on alarm c) Compare alarm am/pm indicator to time am/pm If not equal, compare alarm time to current time If the times are equal, turn on alarm d) Compare alarm am/pm indicator to time am/pm If not equal, compare alarm time to current time If the times are not equal, turn on alarm

A

6. You made a mistake that will cost the company a lot of money. Do you... a) Tell your boss immediately and ask for advice on minimizing the damage. b) Resign as quickly as possible c) Try to cover up the error, hoping nobody finds out. d) Blame others for their part; you won't take the heat alone!

A

Float Data Type

A fundamental data type built into the compiler that's used to define numeric values with floating decimal points.

Pair Programming

A method of programming in which two programmers write code using a single computer. One programmer in the "driver" role uses the mouse and keyboard to actually write the code while a second acts as a "navigator", keeping track of the big picture, catching errors, and making suggestions. Programmers switch roles frequently and communicate throughout the process.

Wavefront Navigation

A path planning algorithm that generates a global trajectory for an autonomous mobile robot.

Element

A single part of a larger part

24. In what order should the following functions be used in creating the app from the question above? 1) check_avail() - checks the availability of the time requested since multiple people can use the app at the same time 2) record_resv() - records the room reservation 3) request_time() - asks for a reservation time for the study room 4) times_avail() - displays the times the room is available 5) update_times() - updates the times available to be displayed a) 3, 2, 4, 1, 5 b) 3, 4, 2, 5 c) 4, 3, 1, 2, 5 d) 3, 2, 5

B

27. How many times do for item in list loops run? a) Once b) Until the index for the list is 0 c) For the LENGTH of the list d) Until the user types STOP

B

28. If a programmer tested the following code with the values indicated, would the program correctly calculate the average of the test scores? Assume all variables and lists have been appropriately initialized. for score in test_scores: if score > 0: total += score count +=1 print ("The average score on the test was: "+ str(total/count)) test1 = [100,90,80,80,85,50,0,85,90] test2 = [192,85,74,100,96,88] a) Yes, the code works as it should for both test cases. b) No, the code does not average the test scores correctly for either test. c) No, the code only works for the test1 scores. d) No, the code only works for the test2 scores.

B

3. You've found out that you are the target of a nasty rumor at work. Do you... a) Do nothing; rumors blow over eventually b) Find out who started the rumor and confront them. c) Start a rumor about someone else to take the spotlight off yourself. d) Become depressed and distracted

B

36. What is displayed after the following code runs? rate = 10 hours = 40 total_pay = 0 overtime_pay = 0 if hours > 40: print ("You earned overtime pay.") else: Print ("Regular Pay = $" + str(hours* rate)) a) You earned overtime pay. b) Regular Pay = $40 * 10 c) 400 d) Regular Pay = $400

B

39. Use the code below to answer questions 38 through 40. count = 1 pets = ['dog','dogfood', 'cat','catfood','fish'] for animal in pets: if animal == 'fish' print (animal) pets[count:count] = pets['fishfood'] count +=1 What is the length of the list "pets" after the code runs? a) 4 b) 5 c) 6 d) 7

B

7. own_it = False song = raw_input ("Which song would you like to hear?") for each song _name in play_list_1: if song_name= song: play(song) own_it= True else: play_list_1.append(song) In the code above, if "play" is a function, what does "song" represent in the line: play(song)? a) It is the name of the function for documentation purposes. b) It is an input value where the user requests the song to be played. c) It is a value being passed to the function via an argument that will be used as a parameter in the function. d) It is an expression that must be evaluated to be used in the function.

B

8. What does iteration with computer science loops mean? a) Executing code once b) Repeating a block of code until a condition is met c) Duplicating a section of code multiple times in a program d) Identifying the error condition

B

41. An alarm company records the number of times each door is opened and closed. The alarm cannot be set if a door is still open. How can the alarm company code this option in their software? Select two answers. a) If the door count multiplied by 2 gives an odd number, then the door is open. b) If door % 2 = 1, then the door is open c) If the number of times a door is opened does not equal the number of times it is closed, then the door is open. d) If the quotient of dividing the door count by two is an even number, then the door is open.

B + C

34. A simulation for a new app to allow students to place a lunch order by 11:00 am to speed up the lunch line is being tested. What information will the simulation provide? Select two answers. a) If a new line at the pick-up station will cause a slowdown b) If students will use the app often enough to make it worth cost of developing c) If the app will decrease the cost of wasted food d) If the app can speed up the lunch line

B + D

11. Will both of the two blocks below produce correct results? Assume all variables have been properly initialized. Block 1 - if (temp >= 80): hot_day = hot_day + 1 elif (temp >= 60): perfect_day = perfect_day + 1 else: cold_day = cold_day + 1 Block 2 - if (temp <= 80): perfect_day = perfect_day + 1 elif (temp <= 60): cold_day = cold_day + 1 else: hot_day = hot_day + 1 a) Only Block 1 is correct. b) Only Block 2 is correct. c) Both blocks are correct d) Neither block is correct

C

2. What is the purpose of using a for loop in code? a) To do something if a condition is true b) To do something while a condition is true c) To repeat something a fixed number of times d) To make programs run faster

C

21. Use the code below to answer questions 21 and 22. if top_songs [i] == song and song_times_played == 100: del i from top_songs else: play (song) song_times_played += 1 What is the above code doing? Assume the variables and list already have values. a) Playing a song from the top_song list b) If a song is in top_songs, playing it, then removing it c) Removing song from top_songs if it has been played 100 times, otherwise playing the song and increasing the number of times played d) This code will not run as written.

C

22. Use the code below to answer questions 21 and 22. if top_songs [i] == song and song_times_played == 100: del i from top_songs else: play (song) song_times_played += 1 In the above code, after a song has been deleted from the list once, it keeps being removed after the user adds it back to the list. What is the best way to fix this error? a) Change the program to allow songs to be played 1,000 times before being deleted b) Send the user a message to confirm they want to delete the song stating it can never be added back to the list. c) Write a new procedure to add a song back to the list if it had been on the list previously d) Set song_times_played back to 0 after removing a song.

C

30. Which code can replace the missing code to select the data that is less than the target_value and even? Assume all variables have been properly initialized. if /* missing code* /: print ("Found it!") a) num % 2 ==0 OR target_value < num b) target_value > num AND target_value % 2 == 0 c) num % 2 == 0 AND target_value > num d) target_value > num OR num % 2 !>0

C

35. Will the code run as expected to dispense items purchased in a vending machine? print ("Please insert money and make a selection.") amt_paid = input () while amt_paid <= cost: print ("Please enter $" + str(cost - amt_paid) + "to make your purchase.") if amt_paid > cost: print ("Your change is $" + str(cost - amt_paid) + "." dispense (item) dispense (change) else: dispense (item) print ("Enjoy your selection!") a) Yes, the code works as expected. b) The while loop is an infinite loop. c) The calculation of the amount of change to return is incorrect. d) The > sign should be < in the if statement.

C

38. Use the code below to answer questions 38 through 40. count = 1 pets = ['dog','dogfood', 'cat','catfood','fish'] for animal in pets: if animal == 'fish' print (animal) pets[count:count] = pets['fishfood'] count +=1 What will the code display? a) dog, dogfood, cat, catfood, fish b) dog, dogfood, cat, catfood, fish, fishfood c) fish, fishfood d) fish

C

4. A less-talented colleague is promoted to a position you hoped for. Do you... a) Start looking for another job - it's obvious you are not appreciated b) Make life difficult for your colleague c) Ask the manager how you could be a stronger candidate next time d) Pout, and hope someone notices your hurt feelings.

C

4. Which of these is a Boolean expression? a) x=57 b) y=temp* 120/100 c) (temp > 32) d) 72+12-(12*6)=z

C

5. Which statement's format is incorrect? a) if x>y: print ("message") b) else: print ("new message") c) list [i] = list [j] d) x = x+y

C

9. A simulation of conditions for a new sensor to be used with self-driving cars is being designed. The pseudocode for the test is below: When a car starts, turn sensor on and set incident_counter to 0 When detect object 3 feet away or closer, redirect steering wheel away from object Add one to incident_counter Which conditions should the simulation test about the sensor? a) If the incident_counter > 0, then the sensor is successful. b) If the incident_counter is 0, then the sensor is successful. c) Set up objects at 3 feet, less than 3 feet, and greater than 3 feet to determine the action taken. d) If the car avoids an accident, then the sensor is successful.

C

42. What is this block of code doing? price = p num_items = num tax_rate = food_tax amt_paid = 20.00 inv = curr_inv amt_owe = (price*num_items) * tax_rate if amt_paid >= amt_owe: change = amt_paid - amt_owe inv -= 1 else: print("Please pay an additional $" + str(amt_owe - amt_paid) + "." i. Calculates the tax for an item. ii. Calculates the current inventory numbers iii. Calculates the change owed the customer or if the customer needs to pay more for their purchase. a) i and ii b) i and iii c) ii and iii d) i, ii, and iii

D

6. own_it = False song = raw_input ("Which song would you like to hear?") for each song _name in play_list_1: if song_name= song: play(song) own_it= True else: play_list_1.append(song) What does the code above do? Assume all lists and variables have been properly initialized. a) Plays a song from the playlist b) If a song requested by the user is in the playlist, plays it; otherwise adds it to the end of the playlist and then plays it. c) Moves a song from its current position in the playlist to the end of it, then plays the next one on the list. d) Identifies songs that the user wants to hear, but does not own. Provides a way to purchase the song and appends it to their playlist.

D

7. A colleague often gossips about management, and it's hard not to listen! Do you... a) Listen eagerly, but never repeat what you hear. b) Tell her what you think of her lack of loyalty c) Let your boss know she is gossiping d) Tell her you are not interested, and change the subject quickly.

D

7. What are some of the careers available in the Computer Science field?

Data scientist, software engineer, web developer, systems analyst.

Abstraction

Key concept whose main goal is to handle complexity by hiding unnecessary details from the user.

5. Describe the difference between sequential and parallel processing orders.

Parallel processing takes care of the routine business with everybody doing stuff at once, while sequential processing is best for solving new problems that require our attention as everyone focuses on one thing.

6. What are some of the moral decisions faced by SDV programming? (MIT Moral Machine)

SDV have been placed in simulations where they have to choose whether to kill two or five pedestrians, just like a human does.

SDV

Switched video or switched digital video (SDV), sometimes referred to as switched broadcast (SWB), is a telecommunications industry term for a network scheme for distributing digital video via a cable.

Machine Vision

Technology and methods used to provide imaging-based automatic inspection and analysis

1. Describe the roles of a driver and navigator in pair programming.

The driver is the one in charge of the computer while the navigator is behind giving ideas and helping.

Relational Operators

is a programming language construct or operator that tests or defines some kind of relation between two entities.

Class

is an extensible program code template for creating objects, providing initial values for state.

String Data Type

is traditionally a sequence of characters, either as a literal constant or as some kind of variable.

Increment

The process of increasing or decreasing a numeric value by another value. For example, incrementing 2 to 10 by the number 2 would be 2, 4, 6, 8, 10. 2. An increment is also a programming operator to increase the value of a numerical value.

Algorithm

The set of rules used in calculations or problem solving.

Boolean Logic

values of the variables are the truth values true and false.

Nested Loops

a naïve algorithm that joins two sets by using two nested loops.

List

a simple series of of words or numerals.

Arithmetic Operators

are the symbols that represent arithmetic math operations.

Array

is a data structure consisting of a collection of elements, each identified by at least one array index or key. An array is stored such that the position of each element can be computed from its index tuple by a mathematical formula.


Conjuntos de estudio relacionados

English IV - Romanticism Period (1798-1832)

View Set

Chapter 61: Musculoskeletal System

View Set

Membre thoracique osteo et arthro

View Set

Nutrition Chapter 4: Carbohydrates

View Set

Unit 2: Sales Contracts and Purchase Agreements

View Set