Accounting | Business | Computer
Science | General
Studies | Math | Sciences | Civics Exam | Help/Support | Join/Cancel | Contact Us | Login/Log Out
Computer Programming: Final Exam 1 Exam 1 2 3 4 5 6 7 8 9 10 Midterm 1 2 Final Exam 1 2 Graded Program Assignment 1 2 3 4 5 6 7 8 9 Python Compiler
The following assignment statement instructs
the computer to initialize a variable with int data type.
howMany = 0; True False To center an output statement, the ^ (caret) symbol will be used in the format specifier of the format function. True False Which of the following statement is used to divide one number by another and gives the result as a floating-point number? / The colon at the end of the for loop condition is optional. True False Writing output to a text file can be accomplished using the following statement: outFile = open("lastname_firstname_ASSIGNMENT_Output_PY_.txt", "r"); infile = open("Parham_Prof_A9_Output_PY_REVISED.txt", "t"); outFile = open("lastname_firstname_ASSIGNMENT_Output_PY_.txt", "w"); outFile = open("lastname_firstname_ASSIGNMENT_Output_PY_.txt", "p"); The body of a function / procedure is always written __________ in parentheses in square brackets indented after the def statement aligned with the def statement Processing test averages for more than one student with more than one test grade can be implemented using: duplicate input statements nested assignment statements exclusively using nested if statements A nested for loop or while loop GUI stands for Graphical User Illustrations. True False To include comments in a Python program you use the ____________ symbol(s). # while (base < 5): print("base = ", base); base = base + 1; The above Python statements yields /outputs which of the following? base = 1 base = 2 base = 3 base = 4 The color command / function can change: the fill colors of a graphic drawing. only the pen of a graphic drawing. the pen and fill colors of a graphic drawing. only the line colors (outline) of a shape background color of the graphic drawing. Python is an example of a high level programming language. True False Comments are used in RAPTOR PROGRAMS TO: 1) provides executable statements to solve the problem 2) is an executable statement 3) limits syntax in a program 4) provide comments to describe the purpose of a program design. These are not executable statements. 5) cannot be used in RAPTOR flowcharts. A function is a collection of statements grouped together that performs an operation. True False The following statements are used to populate the values array / list. howMany = 5; for count in range(0, howMany, 1): values.append(float(input( "Please enter value #" + str(count + 1) + "==> "))); True False Which of the following symbols is used in a flowchart to represent a decision? rectangle square diamond parallelogram Question 17 What logical operator checks to see if both conditions are met? >= or < <> and As a standard rule for naming variables, arrays and other identifiers: only use uppercase letters, numbers and underscore only use lowercase letters, numbers and underscore use special characters and letters only use letters, numbers and underscore. Start each variable / identifier with lower case and only use uppercase to begin the first letter of the 2nd word, third word in a variable, i.e. grossPay, hoursWorked, firstName, unsortedGroceryList The ___________ library is imported to provide functions for drawing graphics on the screen. pen color turtle color math speed The \t and \n are examples of one of Python's escape characters. True False A value-returning function: will be drawn in three (3) windows is used in the RAPTOR flowchart program cannot pass arguments to a function. is not used in Python has a return statement that returns a value back to the part of the program that called it. Arrays and Lists are especially useful in conjunction with: None of the other options are correct. Output statements Loops. If statements. Input statements. grossPay = hours * rate; where hours = 40 and rate = 35 grossPay is equal to: 35 75 40 1400 The following Python statement instructs the program to open a file for input. inFile = open("grocerydataFinalPY.txt", "w"); True False You save files containing Python source code using the file extension .py Breaking a problem into smaller parts is called: syntax. implementation. logical design. structured design. recursion. What is the function of the passCount index / loop control variable (lcv) in the following code? for passCount in range(1, count - 1, 1): for swap in range(1, count - 1, 1): if values[swap] > values[swap + 1]: tempValue = values[swap]; values[swap] = values[swap + 1]; values[swap + 1] = tempValue; # end if # end for swap loop # end for passCount loop exchanges the values one time through the array value[swap] creates an infinite loop does nothing in the code causes the program to pass through the values list / array until the list is sorted creates a recursive effect to sort the values Which symbol can sometimes be used when inputting a numeric value? All of the other options are correct. Dollar ($) Percent (%) Decimal (.) Comma (,) The code below is an example of: # initialize Variables def initializeVariables(): global count, howMany, grandTotal, subTotal, tax, totalPrice; count = 1; howMany = 0; grandTotal = 0.00; subTotal = 0.00; tax = 0.00; # end initialize global variables a function / procedure batch a loop a bundle Named computer memory locations are called _____________. methods literals functions variables What is the output of the following code? count = 1; while (count < 5): print(count); count = count + 1; 1 2 3 4 The following is an example of a method used to get data from a line. line.getTheLine True False The symbols (<, <=, >, >=, ==, !=) used for comparing data in Python are called comparison or relational operators. True False What data type is this statement defined as in Python? testAvg = 0.00; real float str Exclusively as an int (integer) outFile.write("=" *90 + "\n"); will write the equal sign 90 times inside a designated file True False How many integers are in the following list scores [0] *11 11 0 10 12 The following statement is true and will display Found the number: if (10 > 17) and (10 < 11): print ("Found the number"); True False The RAPTOR program: maximizes the amount of syntax you must learn to write correct program instructions. increases more error messages in a flowchart. limits your experience in designing and outlining the logic of a program. minimizes the amount of syntax you must learn to write correct program instructions. increases the complexity of creating the logic used to solve a problem. print("-" *25); When executed, the computer displays the value 25 True False The symbols used in Python to refer to an individual list element is: ( ) { } < > [ ] In a bubble sort how many extra storage variables are needed to re-arrange the two target/adjacent numbers in a single array / list? 0 2 1 4 3 The following colors are used to represent comments in a Python program. GREEN and RED BLACK and RED PURPLE and GREEN RED and BLUE In RAPTOR, the Add ___________ option is used to create a procedure or function: procedure subtasks subfunctions loops widgets How are statements associated with a function / procedure? all statements indented after the def statement make up the body of the function / procedure all statements before the def statement make up the body of the function / procedure only those statements that start with # after the def statement make up the body of the function / procedure. only the print and format statements following the def statement make up the body of the function / procedure Python integrates: only color and videos in graphic design graphics, animation, sound, and text as part of the design only color in graphic designs only sound and color in graphic designs A compound Boolean expression created with the _____ operator is true only if both of its subexpressions are true. and A compound Boolean expression created with the ____ operator is true if either of its subexpressions is true. or The _____ operator takes a Boolean expression as its operand and reverses its logical value. not A _____ is a Boolean variable that signals when some condition exists in the program. flag You can write any program using only sequence structures. False A program can be made of only one type of control structure. You cannot combine structures. False one path if the condition is true, or another path if the condition is false. False A decision structure can be nested inside another decision structure. True A compound Boolean expression created with the "and" operator is true only when both subexpressions are true. True A(n) _____ section of a Select Case statement is branched to if none of the case values match the expression listed after the Select statement. default A _____ structure allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute. multiple alternative decision a set of instructions that a computer follows to perform a task program the physical devices that a computer is made of are referred to as hardware the part of a computer that runs programs the CPU today, CPUs are small chips known as microprocessors where the computer stores a program while the program is running as well as the data that the program is working with main memory a volatile type of memory that is used only for temporary storage while a program is running secondary memory a type of memory that can hold data for long periods of time secondary storage a component that collects data from people or other devices and sends it to the computer (ex: keyboard, camera) input device enough memory to store a letter of the alphabet or a small number byte a byte is made up of eight ________ bits a set of 128 numeric codes that represent the English letters, various punctuation marks, and other characters ASCII an extensive encoding scheme that can represent that characters of many of the languages of the world unicode negative numbers are encoded using the ________ technique two's complement real numbers are encoded using the ________ technique floating-point the tiny dots of color that digital images are composed of pixels if you were to look at a machine language program, you would see ________ a stream of binary numbers the CPU determines which operation it should perform in the ________ part of the fetch-decode cycle decode computers can only execute programs that are written in ________ machine language translates an assembly language program to a machine language program assembler the words that make up a high-level programming language keywords the rules that must be followed when writing a program syntax translates a high-level language program into a separate machine language program compiler today, CPUs are huge devices made of electrical and mechanical components such as vacuum tubes and switches. (T/F) False Main memory is also known as RAM. (T/F) True Any piece of data that is stored in a computer's memory must be stored as a binary number. (T/F) True Images, like the ones you make with your digital camera, cannot be stored as binary numbers. (T/F) False Machine language is the only language that a CPU understands. (T/F) True Assembly language is considered a high-level language. (T/F) False An interpreter is a program that both translates and executes the instructions in a high-level language program. (T/F) True A syntax error does not prevent a program from being compiled and executed. (T/F) False Windows Vista, Linux, UNIX, and Mac OS X are all examples of applications software. (T/F) False Word processing programs, spreadsheet programs, email programs, Web browsers, and games are all examples of utility programs. False transmits information across device Databus all main processing power; brain of the computer CPU creates a virtual copy of all programs and downloads RAM stores memory forever hard drive does not permanently store info volatile number of bits in a byte 8 bits The number of bits in a nyble 4 bits low level program assembly high-level programs C++, JavaScript, Python object-oriented programming base templates; scalability value of each term (right to left) in binary 0, 2, 4, 8, 16, 32, 64, 128 data type tells program which type of data you're using list of data types string, integer, double, float, long, short, char Computer programs are also known as ______ software The major computer operations include ______ input, processing, and output Visual Basic, C++, and Java are all examples of computer ______ programming languages A programming language's rules are its ______ syntax The most important task of a compiler or inerpreter is to ______ translate programming language statements into machine language Which of the following is temporary, internal storage? memory Which of the following pairs of steps in the programming process is in the correct order? code the program, translate it into machine language The programmer's most important task before planning the logic of a program is to ______ understand the problem The two most commonly used tools for planning a program's logic are ______ flowcharts and pseudocode Writing a program in a language such as C++ or Java is known as ______ the program. coding An English-like programming language such as Java or Visual Basic is a ______ programming level high-level Which of the following is an example of a syntax error? misspelling a programming language word Which of the following is an example of a logical error? performing arithmetic with a value before inputting it accepting two input values when a program requires only one dividing by 3 when you meant to divide by 30 The parallelogram is the flowchart symbol representing ______ output input In a flowchart, a rectangle represents ______ processing In flowcharts, the decision symbol is a ______ diamond The term "eof" represents ______ a generic sentinel value When you use an IDE instead of a simple text editor to develop a program,______ some help is provided When you write a program that will run in a GUI environment as opposed to a command-line environment, ______ some syntax is different As compared to procedural programming, with objectoriented programming ______ the programmer's focus differs What does a declaration provide for a variable Name & data type A variable's data type describes all of the following except _______? The scope of the variable The value stored in an uninitialized variable is ______? Garbage The value 3 is a ______. Numeric constant The assignment operator _____. is a binary operator Which of the following is true about arithmetic precedence? Division has higher precedence than subtraction The following are terms used as a synonym for module in some programming languages. Method and procedure Why use modularization? Modularization allows you to more easily reuse your work What is the name for the process of paying attention to important properties while ignoring nonessential details? Abstraction Every module has all of the following except ________? Local variable Programmers say that one module can ______ another, meaning that the first module causes the second module to execute. call The more that a module's statements contribute to the job, the greater the ________ of the module. functional cohesion In most modern programming languages, a variable or constant that is declared in a module is _______ in that module. in scope Printing summaries is a typical housekeeping task. (T/F) False The detail loop in a typical program will execute the most. (T/F) True A hierarchy chart tells you ______. which routines call which other routines. What are nonexecuting statements that programmers place within code to explain program statements in English? Comments Are programmers comments required to create a runnable program or a form of external documentation? (T/F) False What is valid advice for naming variables? To make names easier to read, separate long names by using underscores or capitalization for each new word. A message that asks a user for input is a ______. Prompt A expression has one of two values: true or false. a. Georgian b. Boolean c. Barbarian d. Selective Exam
1 2 3 4 5 6 7 8 9 10 Midterm 1
2 Final Exam 1
2
Graded Program Assignment 1 2 3 4 5 6 7 8 9 Python Compiler |
Home |
Accounting & Finance | Business |
Computer Science | General Studies | Math | Sciences |
Civics Exam |
Everything
Else |
Help & Support |
Join/Cancel |
Contact Us |
Login / Log Out |