Ap Comp Sci Final (Full)

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

Process for evaluating the correctness or effectiveness of a piece of software while examining its algorithmic structure.

Glass Box Testing

A variable with a scope that is limited; inPython, a local scope is created by the def and class keywords, and the scope is the block of code they create.

Local Scope

Zeros and ones that represent simple instructions executed by a processor.

Machine Code

A metal fabricating company owns a variety of machines that are used to cut and shape metal products. The company stores the status of each of its eight machines as a sequence of bits. A bit value of 1 means that the machine is in service and a bit value of 0 means that the machine is out of service. Each machine is given a number from 0-7. The status of machine 0 is represented by the rightmost bit, machine 1's status is represented by the bit left of the rightmost bit, and machine 7's status is represented by the leftmost bit, etc. The company communicates the status of its machines to its supervisors by using the decimal equivalent of these series of bits. If the company communicates its machine statuses as the decimal number 52, which machines are currently in service?

Machines 2,4,5

What is the hexcode for the RGB value in the list clr = (21,60,46)? (Note: hexcodes are formatted with a # in front)

#153c2e

To determine the result of an expression.

Evaluate

Releases memory that was used for a variable's value once the variable is no longer to be used by a program.

Garbage Collection

If I added 0010 1001(binary) and 21(decimal) what is the result?

0011 1110

There are 10 types of people in this world those who understand binary and those who don't. Why do computer scientists find this funny?

10 in binary is 2 in decimal

An escape room was designed so that the last puzzle to solve in order to exit the room was determining the code to unlock the door. The participants found the following sequence of numbers taped on the back of a picture: 71, 9 and a separate clue which indicated that these two numbers are in decimal format and may not be in the correct sequence. However, the door's lock requires one to be entered as hexadecimal and the other as binary. Which of the following is a possible code? 10001118, 91000110, 461010, 100147

100147 (the 1001 is binary for 9)(47 is hexadecimal for 71)

Binary can be used to represent anything, what could 0100 0001 NOT represent?

1011 1110, because this is a completely different set of data

Consider the following: REPEAT UNTIL (quotient = 0) { remainder = quotient MOD baseNUM; quotient = quotient / baseNUM: DISPLAY (remainder) }

1101

What are the minimum number of bits necessary to represent both the length (an integer number from 0-20 with no decimal places) and its unit of measure (represented by two ASCII characters such as "FT" or "IN")?

21

What best describes the difference between a 64-bit and 32-bit system?

2^32 times as many values can be represented

A computer uses a byte math engine. It follows the pattern of number (in byte form), operation (in byte form), number (in byte form) etc. These are the operation bytes: 0000 0000 = addition 0000 0001 = subtraction 0000 0010 = multiplication 0000 0011 = division What is the output of this string of bits? (does not output in byte form, outputs in decimal form) 0001 0000 0000 0010 0000 0011

48

Translate JPEG into hexadecimal. (remember that ASCII starts in decimal) ASCII standard: 65 = A, 66 = B, 67 = C, 97 = a, 98 = b, 99 = c

4a 50 45 47

Doris wants to represent the alphabet using the least amount of bits possible, how many does she need?

5 bits can represent 2^5 or 32 different digits

The following is taken from the ASCII standard: 65 = A, 66 = B, 67 = C, 97 = a, 98 = b, 99 = c. What is the ASCII value of the letter Q in hexadecimal?

51

The binary number system is used to represent numbers and other data used by computers. However, many times it is preferable to represent the information in hexadecimal format instead of binary. How would the binary number 1001 1111 1011 0010 be represented in hexadecimal format?

9FB2

A --> OR <-- B | \/ C -> AND ---> True What are the possible values for ABC for the diagram to be correct?

A <-- True B <-- False C <-- True or A <-- False B <-- True C <-- True

Which of the following can be represented by a single binary digit(bit) there are two

A boolean(passing or failing) and a remainder of 2(either 0 or 1)

When performing 0.3 - 0.1 the computer gave .1999999999, why?

A fixed number of bits representing floating point values

square(size) row(tiles, size) grid(tiles, size) square is used in row and row in grid, which is the correct for the row function? A: row(tiles, size) { REPEAT tiles TIMES { square(size) Repeat size TIMES { MOVE_FORWARD() } } } B: row(tiles, size) { REPEAT size TIMES { square(tiles) Repeat tiles TIMES { MOVE_FORWARD() } } } C: row(tiles, size) { REPEAT tiles TIMES { square(size) MOVE_FORWARD() } } D: row(tiles, size) { REPEAT tiles TIMES { square(size) } }

A: row(tiles, size) { REPEAT tiles TIMES { square(size) Repeat size TIMES { MOVE_FORWARD() } } }

Machine code to Python, Python to C/C++, C/C++ to Alice (visual language). Which is the highest level programming language?

Alice

The values that the programmer provides in the function call.

Arguments

The '=' character causes the compiler or interpreter to evaluate to the expression on its right and store the result in the variable(s) on its left.

Assignment Operator

true -> AND <- B | \/ EXCLUSIVE OR <- true | \/ false - > AND -> false what is true about B?

B can be either true or false, the output will always be false

Which is a proper power function? (NOTE: n^p) A: Repeat p Times { n = n*n } B: newNum = 1 Repeat p Times { n = newNum*n } C: Repeat p Times { newNum = 1 newNum = newNum*n }

B, since it multiplies the previous power by the current power to get the proper power

A group of program statements that are grouped together, denoted by indentation in Python.

Block of Code

Evaluates to either true or false; used in the conditional of an if-structure.

Boolean Expression

Consider the following procedures below: PROCEDURE shape1() { REPEAT 4 TIMES { MOVE_FORWARD() MOVE_FORWARD() ROTATE_RIGHT() } } PROCEDURE shape2 (size) { REPEAT 4 TIMES { REPEAT size TIMES { MOVE_FORWARD() } ROTATE_RIGHT() } } Describe the results of both procedures.

Both will produce a square if called properly (NOTE: shape1 is larger due to the fact that MOVE_FORWARD is ran twice before rortation)

The set of functions available to the programmer without the need to use any "import" or "include" statements.

Built-in Function

Code telling the interpreter or compiler to execute a function or method defined elsewhere, replacing the call with a return value if applicable.

Call

An exception (or error) caught by lines of code if it is handled instead of being passed to parent programs. If an exception is not caught, the operating system catches it.

Catch

Which of the following is NOT a physical component of a computing system that has two states? Transistors, Magnets, Switches, Chips

Chips, CPU and RAM have multiple states because of the multiple groups of bits

What can be represented by two binary digits: Compass directions(NESW), whether student is passing and has good attendance, first letter of last name, person's height

Compass directions(NESW), whether student is passing and has good attendance

A computer program created to read an entire program and convert it into a lower-level language and ultimately assembly language used by the processor.

Compiler

A conditional with one or more logical operators used to incorporate several logical expressions.

Compound Conditional

Attaching two things side-by-side, frequently strings of text.

Concatenation

The Boolean expression in an if-structure that is evaluated to determine which branch of code to execute

Conditional

A native type representing rational numbers to limited precision.

Float

A graphic organizer that can be used to show the procedural pathways within a program.

Flow Chart

The results are shown with 5 bits, the rightmost 3 are the judges(who are weighted twice as much as the audience) and the left 2 are the audience's votes. Who out of these 4 won? A = 11001 B = 10110 C = 01101 D = 00111

D because the three rightmost bits are worth twice as much as the leftmost 2, meaning that he got a score a 6.

A special comment located at the beginning of a program or the beginning of a function that is used to automatically create help documentation.

Docstring

Which number system uses symbols A-F

Hexadecimal

Which of the following is NOT the same number: decimal 17, roman numeral XVII, hexadecimal 16, binary 0001 0001

Hexadecimal: 16

Which is NOT true about high and low level programming languages: High level must be translated into low level before a computer can use it It is easier to debug in a high level programming language Low level provides fewer abstractions High level is is more difficult to understand

High level is is more difficult to understand IS FALSE. High level uses easy to understand syntax and logic, along with a text based engine

Rachel is writing a program that deals with large numbers, she should check...

How many bits are assigned to certain types

Not able to be changed after creation.

Immutable

In Python import is a key word for using one module of code from inside another module.

Import

A native type representing the integers, which are positive whole numbers and their opposites.

Int

Converts a program written in a higher level language into a lower level language and executes it, beginning execution before converting the entire program.

Interpreter

0110 1011 0010 1011 represents

It depends on the context of the computer and program

A reason computers use hexadecimal

It is a base 2^n system like binary

Jerry and Ron are each working on programs with different purposes and implementations. They each use the following binary sequence in their programs: 0110 1100 0100 0111 Is the data used for the same purpose?

It might represent the same thing, but without further information it is impossible to tell

The word vim can be represented a number of ways. They include hexadecimal: 76 69 6D decimal: 118 105 109 and binary: 01110110 01101001 01101101. Why is hexadecimal preferred?

It uses fewer digits than binary, and it is easier to remember

A property of collections that are used to provide elements one at a time and in sequence.

Iterable

Which is an example of abstraction: Jimmy teaching his daughter how to drive a car without explain how the car works. Mrs. Higgins giving a hint by crossing out a choice on a test. Steve explains you to drive to New York with precise instructions. Miles explains multiplication by using hands-on materials like blocks.

Jimmy teaching his daughter how to drive a car without explain how the car works.

The bits that contribute the smallest amount to the overall value of a binary number, including the 1s place value.

Least Significant Bits

A collection of modules.

Library

A constant is well, constant. When is a constant best applicable: To represent score To represent the amount of times code is executed First place on the leaderboard Maximum number of lives in a video game

Maximum number of lives in a video game

An encapsulated collection of one or more related classes, each with its own methods and attributes.

Module

Denoted by ''',these can generate docstrings and allow the programmer to leave notes in code that span several lines without having to type '#' at the beginning of each line.

Multi-line comment

Python allows a programmer to assign values to several variables at once. This may be used to store a group of values returned by a function.

Multiple Assignment

An object that is able to be changed after its creation. In Python includes lists and dictionaries. Strings, for example, are immutable, and a variable can only be assigned to a new value rather than changed in the same memory location.

Mutable

The set of variable and function names that have been reserved by the compiler/interpreter.

Namespace

The types of data built into a programming language, often faster and more efficient with resources.

Native Type

A string that contains no characters

Null string

The digital representation of an instruction that will be fetched, decoded, retrieved, and executed by the CPU.

OP Code

Which is NOT a level of abstraction in computer hardware? Transistors Memory Operating Systems Motherboards

Operating System, its software

Numbers that are difficult to predict and created by a computer.

Pseudorandom

A very tiny part of the processor microchip that stores bits of data, typically 32 or 64 bits in modern computers.

Register

Which of the following are desired properties of procedural abstraction (select two): Minimally specified Trivial Simple Specific

Simple Minimally specified

Selecting a portion of a collection.

Slicing

Data that describes everything about how a program exists at a given time; a snapshot of a program.

State

Consider the following: pi <-- 3.14159 r <-- INPUT() a <-- pi * r * r DISPLAY(a) Is line 3 a statement or expression?

Statement a statement is a line or more of code, an expression can be evaluated to a single value

High level computer programming languages such as Python, C++, and Java, provide which features?

Statements, procedures, constants, expressions, and libraries

Precise rules defining how the letters, words, and punctuation of a programming language are required to be used together.

Syntax

The grammar of a programming language, defining what specific sequences of characters are allowed, what they mean, and how they can be put together.

Syntax

A software package designed to evaluate the correctness or effectiveness of another software solution.

Test Suite

A software development process in which developers first create a test suite and then create the code to satisfy the test suite, e.g., Xtreme Programming.

Test-Driven Design

The Open Systems Interconnection (OSI) is a conceptual model whose purpose is to make networks more manageable. Its objectives include allowing for more portable hardware and software integration, the creation of standard interfaces that would allow manufacturers of different systems to interconnect their equipment and the creation of a model that would be used world-wide. There are seven layers to the OSI. The lowest - or first - layer allows a contiguous sequence of bits to be transmitted through the network. Which is the first layer: data-link layer, physical layer, network layer, transport layer

The data-link layer

What does NOT describe procedural abstraction? A named sequence of instructions that has a specific and limited function A mental model of what a program does The reduction of a particular body of data to a more simplified version In concept, each method should either have its functions encapsulated or be widely usable

The reduction of a particular body of data to a more simplified version - THAT IS DATA ABSTRACTION

=SUM(A1:E1) Why is this abstraction?

The user can use this without knowing how the SUM function works

A native type in Python that can store a collection but cannot assign new values to individual elements.

Tuple

A specific meaning for data, such as a character, an integer, or a true or false value, usually limiting the values allowed for the data.

Type

Converting data from one type to another, e.g., from string to int, potentially losing information.

Type Casting

Which is true of procedures (select TWO): They must return a variable Updating code is easier Must be called more than once Makes programs less complex

Updating code is easier Makes programs less complex

Ensure that the values stored in variables are of the correct type and/or within appropriate value ranges.

Validate

The directory in the file system you are currently "in".

Working Directory

mov eax, A add eax, 3 mov ebx, 7 imul ebx mov B, eax Is this a low level language?

Yes, it is from the x86 assembly language

A node in an HTML document; for example, Hello is a paragraph element, indicated by the opening and closing p tags.

element

square(size) row(tiles, size) grid(tiles, size) square is used in row and row in grid, which is the highest level of abstraction? square(size) row(tiles, size) grid(tiles, size) None of these are abstractions

grid(tiles, size) It uses both square and row in the definition

Using the ASCII standard, what is the character represented by 6D(hexadecimal)? ASCII standard: 65 = A, 66 = B, 67 = C, 97 = a, 98 = b, 99 = c

m(lowercase is purposeful)

Consider the following: pi <-- 3.14159 r <-- INPUT() a <-- pi * r * r DISPLAY(a) What is constant (NOTE: a constant is a data value not an expression or statement)?

pi, because it has a constant definition

Take the hexadecimal code for CPU and add it to 2f 11 18, then convert back to ASCII. (remember that ASCII starts in decimal) ASCII standard: 65 = A, 66 = B, 67 = C, 97 = a, 98 = b, 99 = c

ram


Conjuntos de estudio relacionados

Statistics final exam from professor

View Set

Modul 1 - Lektion 1 Hallo, ich bin Nicole

View Set

Marketing Multiple Choice Practice Questions

View Set

Nacionalidades masculino - femenino

View Set

Letter 'M' : Prefixes, Combining Forms, and Suffixes

View Set

EU - cycle 8 - Free movement of Persons

View Set

Domain 4 - Incident Management 30%

View Set