AP Computer Science Principles Mid Term Review

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

Which of the following is an example of selection? (Choose all that apply.) a. If,then,else b. Repeat n times c. IF condition block of statements ELSE block of statements d. for each number from 1 to 5 by 1 do

a. If,then,else c. IF condition block of statements ELSE block of statements

Which of the following is an example of assignment? (Choose all that apply.) a. Initializing global a to... b. Assigning an expression to a variable c. Greater than/Less than/Equal/Not Equal

a. Initializing global a to... b. Assigning an expression to a variable

Which of the following are types of data abstraction? (Choose all that apply.) a. Lists b. Loops c. Procedures d. Variables

a. Lists d. Variables

Which of the following would NOT be considered an event on your smart phone or tablet? a. The app plays a sound clip b. The phone receives a text message c. The user taps on the screen d. The phone's location changes

a. The app plays a sound clip

True or False? Moore's law is a principle that states that the number of transistors per square inch on integrated circuits has tripled every year since the integrated circuit was invented.

False. Moore's law is a principle that states that the number of transistors per square inch on integrated circuits has doubled every year since the integrated circuit was invented.

True or False? One of the main characteristics of an abstraction is that it simplifies a complex phenomenon leaving out the relevant aspects.

False. One of the main characteristics of an abstraction is that it simplifies a complex phenomenon leaving out the irrelevant aspects.

True or False? Random events are deterministic since they are completely unpredictable.

False. Random events are not deterministic since they are completely unpredictable.

True or False? The Internet is a network of networks based on the HTTP.

False. The Internet is network of networks based on the TCP/IP.

True or False? The symbol for an OR gate is less abstract than the circuit diagram that defines its behavior.

False. The symbol for an OR gate is more abstract than the circuit diagram that defines its behavior.

True or False? Persistent data is data that is stored in RAM.

False. Volatile data is data that is stored in the RAM.

True or False? When using the clock component, the unit of time is in microseconds, where 1 second is equivalent to 1000.

False. When using the clock component, the unit of time is in milliseconds, where 1 second is equivalent to 1000.

True or False? A statement that joins two strings or two pieces of data together to make a new string is known as Joining.

False. A statement that joins two strings or two pieces of data together to make a new string is known as Concatenation.

True or False? ASCII is a character set that uses 8 bits.

False. ASCII is a character set that uses 7 bits.

True or False? Parity errors can be corrected by using only 1 parity bit.

False. Parity errors can be corrected using two parity bits.

A _________ is a basic memory circuit that stores a single bit -- either a 0 or 1.

Flip-Flop

_________ is the process of translating the entire source code into a single binary file.

Compilation

A(n) _________ _________ is something created by a human using a computer.

Computational Artifact

True or False? A setter block returns the value stored in a variable while a getter block assigns the value to a variable.

False. A getter block returns the value stored in a variable while a setter block assigns the value to a variable.

True or False? A model is a concrete representation of some complex object or phenomenon.

False. A model is a abstract/simple representation of some complex object or phenomenon.

True or False? Fix It is one feature in MIT App Inventor used to debug code.

False. Do IT is one feature in MIT App Inventor used to debug code.

True or False? Hamming Coding is an example of an error detection code.

False. Hamming Coding is an example of an error correction code.

True or False? LEGO is a computer language to implement drawing algorithms.

False. Logo is a computer language to implement drawing algorithms.

True or False? Lossless compression typically results in smaller file sizes than lossy compression.

False. Lossless compression typically results in larger file sizes than lossy compression.

As you are reviewing your code, you find that you have several blocks of redundant (repeated) code. You realize that you can create _________ to reduce the complexity of your code, which will make it easier to read and edit. a. A procedure b. An algorithm c. A local variable d. A global variable

a. A procedure

Parity is an example of the implementation of a/an: a. Algorithm b. Encryption c. Procedural Abstraction d. Sequencing

a. Algorithm

Select all of the below that are software. a. Chrome b. Microsoft Word c. RAM d. Operating System

a. Chrome b. Microsoft Word d. Operating System

The number 5 in the code below is called a ________ by programmers because it never changed. (Choose all that apply.) When Canvas1. Touched do call Canvas1. DrawCircle centerX -> get x center Y -> get y radius -> 5 fill -> true a. Constant b. Event c. Global Variable d. Literal Value e. Local Variable

a. Constant d. Literal Value

A global variable can be thought of as: a. A component of the user interface b. A container that can store any value and be used throughout the app c. A container that can store any value and be used only within a specific area d. Something that cannot change throughout the program

b. A container that can store any value and be used throughout the app

What is a sequence of instructions to solve a problem? a. Abstraction b. Algorithm c. Flowchart d. Pseudocode

b. Algorithm

What would be the best way to describe the World Wide Web (WWW)? a. Another name for the Internet b. An Internet application c. A browser d. An Internet Protocol Suite (TCP/IP)

b. An Internet application

Number the following languages (1-3) in order from least to most abstract. Assembly Language Machine Language High Level Language

(2) Assembly Language (1) Machine Language (3) High Level Language

The decimal number 567 to a binary value is _________.

10 0011 0111

In an odd parity scheme, what would the parity bit be for the binary string 1110011 ?

0

What is the binary representation of the decimal number 520?

0010 0000 1000

A(n) _________ is a sequence of precise instructions that solves some problem or performs some computation and can be expressed graphically by a(n) _________

1. Algorithm 2. Flowchart

A ________ is a valuable non-executable block of text that is added to a program to provide documentation. To add this in MIT App Inventor, one must click on this symbol ________.

1. Comment 2. The symbol is a circle with a question mark inside.

HTTP stands for _________. It is the set of rules that governs the _________.

1. Hypertext Transfer Protocol 2. The WWW

IC stands for _________ and is commonly called a(n) _________.

1. Integrated Circuit 2. Chip

If a "do loop" is an example of a(n) _________ type of control structure and an "if statement" is an example of a(n) _________ type of control structure, what is the third type of control structure called?

1. Repetition 2. Selection 3. Sequence

In _________ - _________programming, the program is activated by actions such as ________.

1. event-driven 2. button clicks

The hexadecimal number CB14 to a binary value is _________.

1100 1011 0001 0100

Suppose your PRNG uses the following formula: X = X * 3 - 2 And suppose that X is 5. What are the next three numbers that would be generated?

13, 37, 109

What is the decimal value of the hexadecimal number 8A?

138

The hexadecimal number 7F3 to a decimal value is _________.

2035

What is the decimal value of the binary number 1000 0010 1101 ?

2093

How many binary digits are used to represent a color using an RGB value?

24

What value does b hold after the execution of the code segment? a <-- 2 b <-- 3 a <-- a + b b <-- a * a

25

Supposed your PRNG uses the following formula X = (X * 3 + 1) mod 11 And suppose that X is 8. What are the next three numbers that would be generated?

3, 10, 9

What is the length of the list color below? colors <-- orange, red, blue, green

4

How many hexadecimal digits are used to represent a color using an RGB value?

6 (FF FF FF)

According to the video "Will YouTube ever run out of Video IDs?", YouTube uses base _________ number system.

64

The binary number 10 1101 1001 to a decimal value is _________.

729

Machine Language vs. Low-level programming language vs. High-level programming language

A machine language is a programming language that is directly readable by the computer's CPU. It consists entirely of 0s and 1s. A low-level language would be something like assembly language, that uses symbolic names, rather than binary sequences of 0s and 1s, to represent the machine language instructions. A high-level language is a programming language that is closer to human languages and further from machine languages.

A pseudo-random event: (Choose all that apply.) a. Is completely predictable if you know how it was programmed b. Is the result of a mathematical algorithm c. Models true randomness d. Looks random if you don't know how it was programmed

ALL OF THEM ARE CORRECT!

Which of the following are pieces of metadata associated with a file? (Choose all that apply.) a. Name of the file b. Name associated with the computer it was created on c. The date the file was created d. The date the file was last modified

ALL OF THEM ARE CORRECT! a. Name of the file b. Name associated with the computer it was created on c. The date the file was created d. The date the file was last modified

Consider these three things: The AND gate (i.e., the physical circuit), the Boolean AND function (as defined by its truth table), and the AND symbol. How would you arrange them from most abstract to least abstract?

AND symbol, AND function, AND gate

List the names of three character sets and the number of bits that are used to represent one character.

ASCII (7) Extended ASCII (8) Unicode (16)

Sequence va. Selection vs. Repitititon/Iteration in algorithms

Algorithms are constructed out of basic building blocks called control structures. There are three control structures: Sequence- a sequence of instructions or statements that are executed in order Selection- a conditional instruction that lets the program branch between two or more alternatives Repetition (or Iteration)- a structure that repeats (loops) one or more instructions

Low-level abstractions vs. Higj-level (most abstract) abstractions

An abstraction is a simplified and general representation of some complex object or process. High-level abstractions are more abstract than low-level abstractions. The higher the level of abstraction, the less detail or I formation about the actual object is contained in the abstraction.

An algorithm vs. A program

An algorithm is a sequence of precise instructions that solves some problem or performs some computation. A program is an algorithm that is written in a programming language that runs on a computer.

Events vs. Event-Driven Programming

An event is something that the program can detect and respond to. Events can be divided into 2 different types: user-initiated and automatic. Clicking a button, touching or dragging the screen, and tilting the phone and user-initiated events. Sprites colliding with each other or with canvas edges are automatic events. Event driven-programming is an approach whereby the program's behavior is controlled by writing code that responds to various events that occur.

Give two examples of everyday abstractions _________ and _________.

Answer may vary. Words Symbols Models Maps

Give on example of an image format the uses lossless compression.

Answers may vary. GIF

Give an example of an image format that uses lossy compression.

Answers may vary. JPEG

Give an example of a procedural abstraction.

Answers may vary. Square Root (sqrt (x))

Which computer component completes the mathematical calculations of a computation?

Arithmetic Logic Unit (ALU)

"Getters" and "Setters" are blocks of code that are used in every language. The "Setter" is equivalent to a(n) ________ statement.

Assignment

Give a real life example of check sum usage.

Barcode (ISBN)

All functions of a computer are based upon the use and manipulation of numbers. Which number system is most native to a computer?

Binary Number System

Refactoring code vs. Debugging code vs. Revising code

Code refactoring is the process of restructuring existing computer code without changing how the program behaves. Debugging is the process of dining and fixing errors in how the program behaves. Revising is the process of changing and/or improving how the program behaves.

The _________ is part of the computer's hardware that interprets and runs the computer program.

Central Processing Unit (CPU)

What causes the ImageSprite to move to a new random location?

ClockInterval

A variable is the simplest type of ________ abstraction.

Data

The other type, _________ abstraction provides a general way to access a collection of facts and statistics.

Data

There are various ways to debug code. MIT App Inventor has two built-in ways to do this. Name the block of the drag-down option.

Do It, Notifier

When working in App Inventor with the canvas and a sprite image, if you increase the y value of the sprite's location the sprite moves _________.

Down

The decimal number 224 to a hexadecimal value is _________.

E0

The binary number 1110 0010 to a hexadecimal value is _________.

E2

The _________ was the first digital computer.

ENIAC

An abstraction is a _________ _________of something -- of some person or place or event or process.

General Representation

In the "LightsOff" app, what component is used for the lightbulb?

ImageSprite

An _________ otherwise known as IDE, is software that provides comprehensive tools for programming such as UI design, code editing, and a way to interpret and run the program.

Integrated Development Environment

The Application Programming _________ (API) for a program or web service defines how other programs can communicate with it and use it.

Interface

_________ is the process of translating source code into machine language one instruction at a time and immediately executing instruction.

Interpretation

What is the major advantage of using lossy compression?

It significantly reduces the file size.

When using a 4-bit computer simulator, the 4-bit string 0001 can represent the binary number 1 and the decimal value 1. What else can it represent?

Load into accumulator

A _________ gate is an elementary building block of a digital circuit. Examples would be AND, OR, NOT gates that perform basic digital operations.

Logic

RLE is a _________ compression technique.

Lossless

JPEG is a _________ compression technique.

Lossy

Lossless Compressions vs. Lossy Compression

Lossy data compression results in some amount of data bring lost because these techniques attempts to find and eliminate redundant information.

_________ is a programming language that is directly readable by the computer's CPU.

Machine Language

What type of standard is not owned or controlled by a private entity?

Open Standard

Pixel is derived from what two words?

Picture and Element

We discussed two types of abstractions: _________ abstraction in computer science is the practice of organizing and encapsulating algorithms that can then be invoked by name.

Procedural

One advantage of using a ________ in your program is that it reduces repetition of code.

Procedure

PRNG is an abbreviation for _________.

Pseudo Random Numbef Generator

_________ is a blend of English and code used to write down an algorithm for a program.

Pseudocode

Pseudocode vs. a Programming language

Pseudocode is an artificial and informal language that helps programmers develop algorithms. It is NOT a programming language.

_________ is also called main memory.

Random Access Memory (RAM)

________ means to revise the code without changing its behavior.

Refactoring

The modulo/modulus operation uses the _________ as its result.

Remainder

When working in App Inventor with the canvas and a sprite image, if you increase the x value of the sprite's location the sprite moves _________.

Right

RLE otherwise known as ________ ________ ________ is a type of lossless compression.

Run Length Encoding

Rather than flipping an actual coin, you and your partner run the coin flip app for a total of 20,000 flips. This is an example of a computer model or computer _________.

Simulation

What is the major disadvantage of using lossy compression?

Some data is lost during compression.

TCP/IP vs. HTTP

TCP/IP is a low-level transmission protocol for the Internet. HTTP is a higher-level protocol used for handling multimedia resources on the web.

The Internet vs. The World Wide Web vs. Cloud Computing

The Internet is a network of networks. The World Wide Web (WWW) is an application that runs on the Internet. Cloud computing is a type of computing that uses remote servers hosted on the Internet to store, manage, and process data, rather than having the applications and data on a local server or personal computer.

The code shown here is designed to assign the variable max the largest value. When will the code not work as intended? x <-- ? y <-- ? IF x > y max <-- x ELSE max <-- y

The code will not work as intended if the value of x equals y (x=y). In other words, if the value for x and y is the same the code will not work as intended.

Black and white images can be represented using bits and numbers. What character is represented by the following set of numbers, using the run-length encoding technique? 0,6 0,1,5 0,4,2 0,1,5 0,1,5 0,6

The letter E

Random Integer vs. Random Fraction in App Inventor

The possible output from Random Integer includes both the integers specified for the range. The possible output from Random Fraction includes 0, but doesn't include 1.

A _________ is a semiconductor device used to amplify or switch electronic signals and electrical power. It is the fundamental building blocks of electronic devices.

Transistor

TCP/IP stands for _________.

Transmission Control Protocol/Internet Protocol

True or False? Cloud applications and internet applications are the same thing.

True.

True or False? RLE helps decrease the size of a monochrome image.

True.

True or False? The first computer programmers were women.

True.

UI is an abbreviation in computer science which stands for _________ (hint: not United Illuminating)

User Interface

Tim Berners-Lee invented _________.

World Wide Web (WWW)

Your friend is helping you troubleshoot your app and tells you that you have a problem with one of your variables. Which of these could be the problem? (Choose all that apply.) a. The variable name begins with a number b. The variable name ends with a number c. The variable name includes a % sign d. The variable name starts with a capital letter

a. The variable name begins with a numbers c. The variable name includes a % sign

Select the best variable name for a variable that holds an accumulated value. a. total b. accumulatedvalue c. "sum" d. X

a. total

Consider the following code segment: IF onTime DISPLAY "Hello" ELSE IF absent DISPLAY "Is anyone there?" ELSE DISPLAY "Better late than never." If the variables 'onTime' and 'absent' both have the value 'false', what is displayed as a result of running the code segment? a. Is anyone there? b. Better late than never. c. Hello. Is anyone there? d. Hello. Better late than never.

b. Better late than never.

Select the correct sequence of steps for execution of a program by the CPU. a. Decided in the CPU Execute operation in the CPU Fetch needed data from RAM Fetch instruction from RAM b. Fetch instruction from RAM Decoded in the CPU Fetch needed data from RAM Execute operation in the CPU c. Fetch needed data from RAM Execute operation in the CPU Fetch instruction from RAM Decoded in the CPU d. Fetch instruction from RAM Decoded in the CPU Execute operation in the CPU Fetch needed data from RAM

b. Fetch instruction from RAM Decoded in the CPU Fetch needed data from RAM Execute operation in the CPU

Which of these is an example of a conditional? (Choose all that apply.) a. DISPLAY expression b. Greater than/Less than/Equal/Not Equal c. Not,=,and,or

b. Greater than/Less than/Equal/Not Equal c. Not,=,and,or

Before you use global variable in App Inventor 2, it must be a. Abstracted b. Initialized c. Defined d. Incremented

b. Initialized

An algorithm consists of control structures. Which of the following is NOT a control structure that makes up an algorithm? a. Sequence b. Method c. Selection d. Repetition

b. Method

Code segments are repeated and the programmer chooses to change the repeated code into a named block that can be called in place of the code segment. This is known as: (Choose all that apply.) a. Code Compression b. Procedural abstraction c. Refactoring d. Simplified versions

b. Procedural abstraction c. Refactoring

You have a fair 4-sided die. You set a random number generator to simulate rolling the die. What numbers could you assign to represent rolling the die? (Choose all that apply.) a. RANDOM (0,4) b. RANDOM (1,4) c. RANDOM (1,5) d. RANDOM (2,5)

b. RANDOM (1,4) d. RANDOM (2,5)

Which of the following is an example of repetition? (Choose all that apply.) a. If, then, else b. Repeat n times c. IF condition block of statements ELSE block of statements d. for each number from 1 to 5 by 1 do

b. Repeat n times d. for each number from 1 to 5 by 1 do

Which of the following is an assignment statement? a. m + n b. m <-- 4 c. m < m * 3 d. DISPLAY m

b. m <-- 4

Which of the following values of m and n will cause the variable m to be displayed? IF m < 10 AND n > 5 DISPLAY m ELSE DISPLAY n a. m = 5, n = 5 b. m = 5, n = 6 c. m = 12, n = 6 d. m = 12, n = 5

b. m = 5, n = 6

Given the list color below, what element is reference by list(3)? colors <-- orange, red, blue, green

blue

Which of the following is NOT an example of a computational artifact? a. A PowerPoint presentation b. An audio file c. A digital projector d. A mobile app

c. A digital projector

You realize that you can use a variable to make your code more functional. This is an example of: a. An algorithm b. Compiling c. Data abstraction d. Procedural abstraction

c. Data abstraction

Which of the following elements would be considered part of the user interface (UI) for an app? I. A button that appears on the screen II. The color of the app's background screen III. The app's memory usage a. I only b. II only c. I & II d. I, II, and III

c. I & II

Which of the following is NOT true about a computer's main memory? a. Any data stored in main memory disappears when the computer loses power b. It is called RAM, short for random access memory c. It is the same thing as long term memory d. It stores data

c. It is the same thing as long term memory

One process for finding errors in digital data is known as: a. Compression b. Encryption c. Parity checking d. Sequencing

c. Parity checking

An algorithm that will choose to execute a particular code fragment based on a boolean would use which control structure? a. Procedure b. Repetition c. Selection d. Sequencing

c. Selection

Which described the primary function of the CPU? a. To convert electrical power from alternating to direct current b. To store the data used by the computer's software c. To carry out, or process, the instructions in a computer program d. To serve as the interface between the user and the computer

c. To carry out, or process, the instructions in a computer program

Given the below code what is the output? a <-- 4 b <-- 1 REPEAT UNTIL (b > 5) { a <-- a * b b <-- b + 2 } PRINT a a. 6 b. 4 c. 12 d. 60

d. 60

You have found that you have repeated a segment of code in several different locations of your app. What could you use to make your code more sufficient? a. An algorithm b. A button c. A loop d. A procedure

d. A procedure

The main difference between low-level and high-level programming languages is: a. High level languages are easier for computers to understand b. Low level languages cannot be understood by computers c. High level languages provide abstractions that closely match the machine's architecture d. High level languages must be translated by software programs into low level machine languages before they can be run on a computer.

d. High level languages must be translated by software programs into low level machine languages before they can be run on a computer.

Which of the following is NOT true about pseudocode? a. It is easy to read. b. It is a mixture between a natural language and a programming language. c. It is not a programming language. d. It is an executable program.

d. It is an executable program.

Which is true about refactored code? a. It is less efficient b. It is redundant c. It is encapsulated outside the procedure d. It is less complex

d. It is less complex

Refactoring means a. Restructuring a program to make it behave differently b. Changing the way a program behaves c. Revisiting a program to remove bugs d. Restructuring a program without changing its behavior

d. Restructuring a program without changing its behavior

The practice of concealing a message within a file is called: a. Compression b. Cryptography c. Sequencing d. Steganography

d. Steganography

Which of the following is a true statement about data compression? a. Data compression is only useful for files being shared on the Internet. b. No matter what data compression method is used, once a data file is compressed, it can not be restored to its original state. c. Sending a compressed version of the file ensured that the file can not be intercepted by an unauthorized user. d. There are trade-offs involved in choosing a compression technique for storing and transmitting data.

d. There are trade-offs involved in choosing a compression technique for storing and transmitting data.

A limitation of computer models and simulation is: a. They allow too many manipulations of variables to explore the different possible outcomes b. They are too costly to create c. They can only be run on very powerful computers not available to the general public d. They make assumptions and leave out some data

d. They make assumptions and leave out some data

What is the value of the variable sum after executing the below code? sum <-- 0 num <-- 5 REPEAT UNTIL num > 10 sum <-- sum + num num <-- num + 1 a. 10 b. 11 c. 26 d. 35 e. 45

e. 45

Adding binary 1 to binary 11111111 gives a(n) _________ error.

overflow


Ensembles d'études connexes

BUL 3310 Exam 2, BUL3310 FSU Exam 2 Bailey

View Set

Texas Statutes and Rules Pertinent to Property and Casualty Insurance

View Set

Play with These Cool Movies! THEME!!!!!!!!!

View Set

Respiratory: Saunders NCLEX Review

View Set