CS 161 Quiz

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

[Q2] __ is the process where objects that are no longer needed are deleted. - Memory clearing - Identity recycling - Garbage collection - Object recycling

Garbage collection

[Q1] Basic instruction types are input, process, and __. - Calculation - Output - Memory - Assignment

Output

[Q1] What is a common word for the textual representation of a program? - Expression - Interpreter - Code - Prompt

Code

[Q1] Which type of program converts a high-level language program into machine instructions? - App - Assembler - Processor - Compiler

Compiler

[Q1] Which statement about Python is true? - There are no free web-based tools for learning Python - Developers are not usually required to pay a fee to write a Python program - Linux and Mac computers do not come with Python installed - Windows usually comes with Python installed

Developers are not usually required to pay a fee to write a Python program

[Q2] An item passed to a function is called a(n) __.? - call - module - argument - instruction

argument

[Q2] Assigning a value to a floating point variable that is too large for the computer to represent is a condition called __. - bit error - overcapacity - system error - overflow

overflow

[Q1] Which symbol is used in Python to create a comment? - # - * - C - //

#

[Q2] 15 __ 3 = 0 - / - // - * - %

%

[Q1] Which code is an expression? - # display x - x = 4 - (x * y) / 2 - print(x)

(x * y) / 2

[Q1] Which symbol represents the multiplication operation in programming? - * - . - x

*

[Q2] What is the value of x after the following code is executed? x = 15 x = x + 1 x = x * 2 x = 30 - x - 2 - 15 - -2 - 32

-2

[Q2] What is displayed when the following code is executed? empty_string = '' print( len(empty_string) ) - '0' - 0 - 1 - 'empty'

0

[Q2] What is the output? my_list = [2, 8, 3, 1, 18, 5] print( my_list[3] + my_list[1] * 2) - 7 - 17 - 18 - 10

17

[Q1] Consider the following program: t = 15 t= t * 2 t = t + 1 t = t - 4 What does the program produce as output? - 12 - 27 - 15 - 11

27

[Q2] Which of the following is not a valid expression? Assume x and y are integer variables - 2x + 3y - x / (y * 7) - y / x * 2 - (x - 3*y)

2x + 3y (operations need to be explicit)

[Q2] What is the value of 11 // 2? - 6 - 0 - -5 - 5

5

[Q1] What is an IDE used for? - Program development, including writing the source code - Searching for open-source application that preform a specific task - Deciding which programming language is best suited for a specific application - Publishing an app in an app store

Program development, including writing the source code

[Q1] In an instruction like: z = x + y, the symbols x, y, z are examples of __. - Variables - Output - Visibles - Instructions

Variables

[Q2] Which statement assigns the string variable airport_code with the value JFK? - airport_code = 'JFK' - JFK = 'airport_code' - 'JFK' = airport_code - airport_code = JFK

airport_code = 'JFK'

[Q1] A sequence of instructions that solves a problem is called __. - a process - turtle graphics - an allegory - an algorithm

an algorithm

[Q1] Because Python 2.7 programs cannot be run by the Program 3.0 interpreter, Python 3.0 is not __. - a scripting language - open-source - backwards compatible - standalone

backwards compatible

[Q1] 0s and 1s are known as __. - electricity - bits - voltage - switches

bits

[Q2] The operator *= is called a(n) __ operator. - multiple assignment - double - increment - compound

compound

[Q2] The special two-item charcater sequence that represents special characters like \n is known as a(n) __. - backslash code - escape sequence - unicode spec - literal character

escape sequence

[Q2] Which statement makes the code in the math module available? - import math - include math - use math - allow math

import math

[Q1] A processor is a circuit that executes a list of __. - instructions - switches - bits - memories

instructions

[Q1] Which function converts a string to an integer? - convert(string, int) - int() - string_to_int() - integer()

int()

[Q1] Which type of error does not cause the program to crash? - assignment error - logic error - value error - indentation error

logic error

[Q2] Which of the following identifiers is valid? - True - 32area - transfer$ - max_age

max_age

[Q2] Which of the following assignment statements create a list with 4 integer elements? - my_list = integer(4) - my_list = [7, 2 , -8, 16] - my_list = [4] - my_list = ['1', '2', '3', '4']

my_list = [7, 2 , -8, 16]

[Q2] Which of the following statements assigns a new variable, my_set, with a set that contains 3 elements? - my_set = { [1, 2, 3] } - my_set = set(3) - my_set = [1, 2, 3].to_set() - my_set = set([1, 2, 3])

my_set = set([1, 2, 3])

[Q1] The Python language is developed by a public community of users, therefore Python is a(n) __ language. - buggy - open-source - open-space - beginner

open-source

[Q2] Which print statement would display the letter 'A'? (Note that the code point letter for the letter 'A' is 65) - print( unicode(65) ) - print( code_point(65) ) - print( ord(65) ) - print( chr(65) )

print( chr(65) ) chr() and ord() are inverse functions

[Q1] In the statement: age = input('Enter your age: ') the string 'Enter your age: ' is called a(n) __. - prefix - variable - assignment - prompt

prompt

[Q1] Dividing by zero is an example of which type of error? - infinity - runtime - syntax - logic

runtime

[Q1] What is Moore's Law? - a processor used in cold weather is more likely to fail - any given program will become obsolete - every action has an equal and opposite reaction - the capacity of ICs double roughly every 18 months

the capacity of ICs double roughly every 18 months

[Q1] Which statement reads a user-generateed string into user_name? - user_name = input() - input = user_name - user_name = "input()" - input() => user_name

user_name = input()

[Q2] A __ is a named item used to hold a value. - variable - number - statement - constant

variable

[Q1] Space, tab and newline are all called __ characters. - space-line - noprint - symbol - whitespace

whitespace

[Q1] Which statement has a syntax error? Assume variables x, y, z and age have already been defined. - print('Name, age') - age = '32' - x + y = z - y = y

x + y = z

[Q2] Which statement is equivalent to the following assignment? x -= 2 + y - x = 2 + y - x - x = x - 2 + y - x = x - (2 + y) - x = -(2 + y)

x = x - (2 + y)


Set pelajaran terkait

Neuro3: Circadian Rhythms and Sleep (Dr. Cao - 1 hr)

View Set

Principles of Management Chapter 19

View Set

Physics 111 Chapter 12-15 review

View Set

Ch.2 AP Human Geography Test Prep (Vocabulary and Multiple Choice)

View Set

World Geography Semester Review Chapter 5-10

View Set

Marketing Research Exam 1 (chapters 1 & 2)

View Set

Direct and Indirect Object, Compound Direct Obj, Compound Indirect Obj or Neither

View Set