code classs

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What will be assigned to the variable some_nums after the following code executes? special = '0123456789' some_nums = special[0:10:2]

'02468'

What will be the value of the variable string after the following code executes? string = 'abcd' string.upper()

'ABCD'

What will be the value of the variable string after the following code executes? string = 'Hello' string += ' world!'

'Hello world!'

What are the valid indexes for the string 'New York'?

0 through 7

What will be displayed after the following code is executed? def pass_it(x, y): z = x*y result = get_result(z) return(result) def get_result(number): z = number + 2 return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

14

What will be displayed after the following code is executed? for num in range(0, 20, 5): num += num print(num)

30

What will be displayed after the following code is executed? total = 0 for count in range(4,6): total += count print(total)

4 9

What will be the output after the following code is executed? def pass_it(x, y): z = y**x return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

64

Which of the following is NOT an augmented assignment operator?

<=

The ________ coding scheme contains a set of 128 numeric codes that are used to represent characters in the computer's memory.

ASCII

What will happen if you try to store duplicate data in a primary key column?

An error will occur.

If you want to know the number of rows in a table, or the number of rows that match a search criterion, you would use this SQL function.

COUNT

In SQL, the ________ statement is used to delete one or more rows from a table.

DELETE

In SQL, the ________ statement is used to delete a table from a database.

DROP TABLE

What is the number of the first index in a dictionary?

Dictionaries are not indexed by number.

Which of the following is considered to be the world's first programmable electronic computer?

ENIAC

Which widget allows the user to enter a single line of input from the keyboard?

Entry

In SQLite, this type of exception is thrown any time a database error occurs.

Error

What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8? not (x < y or z > x) and y < z

False

A __________ program is an event-driven program.

GUI

The ________ statement is used in SQL to insert a new row into a table.

INSERT

The ________ statement is used to create a decision structure.

If

What does the following program do? student = 1 while student <= 3: total = 0 for score in range(1, 4): score = int(input("Enter test score: ")) total += score average = total/3 print("Student ", student, "average: ", average) student += 1

It accepts 3 test scores for each of 3 students and outputs the average for each student.

What does the following program do? import turtle def main(): turtle.hideturtle() square(100,0,50,'blue') def square(x, y, width, color): turtle.penup() turtle.goto(x, y) turtle.fillcolor(color) turtle.pendown() turtle.begin_fill() for count in range(4): turtle.forward(width) turtle.left(90) turtle.end_fill() if __name__ == '__main__': main()

It draws a blue square at coordinates (100, 0), 50 pixels wide, in the lower-left corner.

What will be the result of the following code? ages = {'Aaron' : 6, 'Kelly' : 3, 'Abigail' : 1 } value = ages['Brianna']

KeyError

Which widget creates an area that displays one line of text or an image?

Label

Which widget will display multiple lines of text?

Message

Main memory is commonly known as ________.

Ram: Random Access Memory

Suppose an SQLite database has a table named Customers. The Customers table has a REAL column named Purchases. Which SQL statement returns the sum of the Purchases column?

SELECT SUM(Purchases) FROM Customers

A(n) ________ is an object that holds multiple unique items of data in an unordered manner.

Set

What will be the output after the following code is executed? def pass_it(x, y): z = x + ", " + y return(z) name2 = "Julian" name1 = "Smith" fullname = pass_it(name1, name2) print(fullname)

Smith, Julian

A qualified column name takes the form

TableName.ColumnName

Which of the following does NOT apply to sets?

The elements are in pairs.

What does the following statement mean? num1, num2 = get_num()

The function get_num() is expected to return a value for num1 and for num2.

What does the acronym UML stand for?

Unified Modeling Language

What does the acronym UML stand for? Unified Model Language Union of Modeling Languages United Modeling Language Correct! Unified Modeling Language

Unified Modeling Language

What list will be referenced by the variable list_strip after the following code executes? my_string = '03/07/2018' list_strip = my_string.split('/')

['03', '07', '2018']

Which method is automatically executed when an instance of a class is created in memory?

__init__

What is the special name given to the method that returns a string containing an object's state?

__str__

Which method is automatically called when you pass an object as an argument to the print function?

__str__

What is a group of statements that exists within a program for the purpose of performing a specific task?

a function

When an object is passed as an argument, ________ is passed into the parameter variable.

a reference to the object

What type of method provides a safe way for code outside a class to retrieve the values of attributes, without exposing the attributes in a way that could allow them to be changed by code outside the method?

accessor

Which of the following can be thought of as a self-contained unit that consists of data attributes and the methods that operate on the data attributes?

an object

The smallest storage location in a computer's memory is known as a

bit

A set of statements that belong together as a group and contribute to the function definition is known as a

block

Which is the first line needed when creating a class named Worker?

class Worker:

The data that is stored in a row of a database is divided into

columns

A(n) ________ expression is made up of two or more Boolean expressions.

compound

What type of loop structure repeats the code based on the value of Boolean expression?

condition-controlled loop

A(n) ________ structure is a logical design that controls the order in which a set of statements execute.

control

The decision structure that has two possible paths of execution is known as

dual alternative

Combining data and code in a single object is known as

encapsulation

Which method would you use to determine whether a certain substring is the suffix of a string?

endswith(substring)

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y and z > x

false

This Cursor method returns only one row of the results of the previously executed SELECT statement, as a tuple.

fetchone

Which method would you use to determine whether a certain substring is present in a string?

find(substring)

USB drives store data using ________ memory.

flash

Accessor methods are also known as

getters

In object-oriented programming, one of first tasks of the programmer is to

identify the classes needed

A(n) ________ loop usually occurs when the programmer does not include code inside the loop that makes the test condition false.

inifinite

Which attributes belong to a specific instance of a class?

instance

Which method would you use to get all the elements in a dictionary returned as a list of tuples?

items

The built-in function, ________, returns the number of items in a set.

len

Which would you use to get the number of elements in a dictionary?

len

In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called

list

The following is an example of an instruction written in which computer language? 10110000

machine language

The disk drive is a secondary storage device that stores data by ________ encoding it onto a spinning circular disk.

magnetically

The procedures that an object performs are called

methods

The logical ________ operator reverses the truth of a Boolean expression.

not

What type of programming contains class definitions?

object-oriented

What type of programming contains class definitions? procedural modular top-down Correct! object-oriented

object-oriented

When using the ________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.

or

The while loop is known as a(n) ________ loop because it tests the condition before performing an iteration.

pretest

The first operation is called the ________ and its purpose is to get the first input value that will be tested by the validation loop.

priming read

A(n) ________ structure causes a set of statements to execute repeatedly.

repetition

When the operand on the left side of the * symbol is a string and the operand on the right side is an integer, the * becomes the ________ operator.

repetition

In ________ mode, the interpreter reads the contents of a file that contains Python statements and executes each statement.

script

Which section in the UML holds the list of the class's data attributes?

second section

Mutator methods are also known as

setters

A(n) ________ is a span of characters that are taken from within a string.

slice

Modern CPUs are much ________ than the CPUs of early computers.

smaller and more powerful

The ________ method returns the list of the words in a string.

spit()

Python comes with ________ functions that have already been prewritten for the programmer.

standard

Which section in the UML holds the list of the class's methods?

third section

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y or z > x

true

Each element in a dictionary view is a ________.

tuple

The encoding technique used to store negative numbers in the computer's memory is called

two's complement

What are the items that appear on the graphical interface window called?

widgets

Which of the following will create an object, worker_joey, of the Worker class?

worker_joey = Worker()

What does the following expression mean? x <= y

x is less than or equal to y

What is the correct structure to create a dictionary of months where each month will be accessed by its month number (for example, January is month 1, April is month 4)?

{ 1 : 'January', 2 : 'February', ... 12 : 'December' }

What will be displayed after the following code executes? (Note: the order of the display of entries in a dictionary are not in a specific order.) cities = {'GA' : 'Atlanta', 'NY' : 'Albany', 'CA' : 'San Diego'} if 'FL' in cities: del cities['FL'] cities['FL'] = 'Tallahassee' print(cities)

{'GA': 'Atlanta', 'FL': 'Tallahassee', 'NY': 'Albany', 'CA': 'San Diego'}


संबंधित स्टडी सेट्स

functional groups and macromolecules

View Set

Business Communications Chapter 16

View Set

Types of DNS Records and DNS terms

View Set

lifetime physical health and wellness chapter 3 quiz

View Set