IS4010 Midterm

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

What is the comment delimiter?

#

Which operator computes the remainder of x and y?

%

What is the concatenation operator?

+

What is the correct extension for a Python source code file?

.py

From which number do strings index?

0

What is the output of the following code: x = 42 x = x % 30 print(x)

12

In which base are binary numbers typed?

2

What is the output of the following code: x = 42 x = x // 20 print(x)

2

What does an if statement end w/?

:

Which operator can be used to compare 2 values?

==

What is the creator of Python known as?

Benevolent dictator for life

What does the following expression print print(type(True))

Boolean

What is bool short for?

Boolean

What does CSV stand for?

Comma Separated Value

What is our IDE of choice?

Eclipse

What is a possible value for a Boolean variable?

Either true or false

What is Python IDE (IDLE) named after?

Eric Idle

T/F: Python 2 is still being developed.

False

Who invented Python?

Guido van Rossom

Which app supports tab completion?

IPython Shell

What are loops delimited by?

Indenting

What does IPython mean?

Interactive Python

What is the file extension of a Jupyter Notebook file?

Ipynb

What is the output of the following code: name = "Carl Lindner" print(name[5:8])

Lin

What is Python named after?

Monty Python's Flying Circus

How do you append one string to another?

N/A

What is the upper limit on an integer variable?

N/A

What does the get function return if the key is not present?

None

Which keyword represents a null value in Python?

None

What does P represent in the acronym PEMDAS?

Parentheses

What do you need to run Python programs on your computer?

Python interpreter

What does a package contain?

Python modules

What does REPL stand for?

Read, Evaluate, Print, Loop

T/F: Python supports object-oriented programming.

True

What is the output of the following code: x = 42 if x == 42: print("UC") else: print("Bearcats")

UC

What might the base class for a car be?

Vehicle

Given this code: fish=["bass","perch","bluegill","carp","trout"]print(fish[1:2:2]) what prints?

["perch"]

Which of these expressions defines a list?

[1,2,3,'apple']

Given this code: x = [1,2,3,4,5]print(x[1:2]) What prints?

[2]

A list is created w/ which delimiters?

[]

Given this code: for item in myDict: what is item?

a key

Class attributes are shared by what?

all instances of the class

What other term can be used for binding?

assignment

What else can a dictionary be referred to as?

associative array

Given a list, beta, what is the syntax to extract the last element?

beta[-1]

Given a list, beta, what is the syntax to extract the first 3 elements?

beta[0,3]

Which statement allows one to break out of a loop?

break

What does the import statement do?

brings in code from another module

What is __init__ for a class?

construcot

What does the following code do: myList = ["Apple", 1, True]

creates a list object

Which line of code creates a dictionary?

d = dict()

What does a function definition begin w/?

def

Which data structure consists of key/value pairs?

dictionary

What does Dunder stand for?

double underscore

What is the output of the following code: name="Hello World" print(name[1:3])

el

Which clause of an if statement is optional?

else

T/F A list is immutable.

false

T/F: keys in a dictionary must be the same type.

false

Which data structure can have decimal places?

float

Which loop does Python use?

for

What does the define keyword create?

function

Which construct can be used to improve modularity in a project?

function

Which function checks to see if a class has a specific attribute?

hasattr

Which is the main flow control statement in Python?

if

Which statement allows one to execute a block of code if a condition is true?

if

How are lists accessed?

index

What is the [] operator w/in the context of a tuple?

indexing

What is a mechanism that allows for a class's implementation to be derived from that of another class?

inheritance

Given that Car is a class, what does this statement do? corvette = Car()

instantiates an object

Which data type can contain whole numbers and no decimal places?

int

Python is an _____ language.

interpreted

The set function takes what as an argument?

iterable

How are dictionaries accessed?

key

What does a dictionary consist of?

key/value pairs

With what are dictionaries indexed?

keys

Given a tuple, b, which function returns the number of elements in b?

len(b)

Given a list, alpha, then what is alpha[0,5]?

list slicing

What can list comprehension be used to replace?

loops

What is %timeit?

magic

How does one reference the numerical constant pi in a Python program?

math.pi

Which type of operator is the in operator?

membership

What are object behaviors known as?

methods

What is the term for a file containing Python instructions?

module

Where might functions be placed, in the interest of modularity?

modules

Which class can inherit more than 1 base class?

multiple inheritance

What is the output of the following code: name = "Carl Lindner" print(name[-3])

n

What is meant by the pass keyword?

no operation

Instance attributes will bind to a specific ______.

object

Which type of dictionaries maintain the insertion order of keys?

ordered

According to the author, what does the co-founder of a particular international computer company thinks that objects are like?

people

Which method can be used to remove an element from a set?

pop

What is a correct syntax to output "Hello World" in Python?

print('Hello World')

What is the correct syntax to output the type of a variable or object in Python?

print(type(x))

Which function is used to generate a range of numbers for a for loop?

range

What does this statement do? del a[:]

removes all elements from the list a

What is the primary unit of storage at GitHub.com?

repo

What is a name that cannot be used as a variable b/c Python recognizes it as part of the language?

reversed word

What is the term for a module that can be run?

script

W/in the context of the __init__method, which keyword refers to the object?

self

What is a column in a DataFrame called?

series

Which data structure cannot contain duplicates?

set

Which method is called by default when print is called on an object?

str

Which data type is placed between 2 quotation marks?

string

What other term can be used for tabular data?

structured

What must also exist if a subclass exists?

superclass

What does the expression "Alpha"]-1] yield?

syntax error

What does the expression f"This class is {pie} easy as pie yield?

syntax error

What does Python use to structure code?

tabs

What does a class method do?

takes the class as the 1st argument

Which tool can one create a Python script w/?

text editor

What does program flow describe?

the way statements are executed

What type of program flow does Python use?

top-down

Which method can be used to remove any whitespace from both the beginning and the end of a string?

trim()

T/F A list is indexable.

true

T/F A list is ordered.

true

T/F Python is case-sensitive.

true

T/F: "A":42 is a valid dictionary entry.

true

T/F: Arguments can be passed to an instance method.

true

T/F: Methods can be overriden.

true

T/F: Python Fiddle exists.

true

T/F: Python strings are immutable.

true

T/F: a dictionary can contain another dictionary.

true

T/F: class & type mean the same thing in Python.

true

T/F: dictionaries can be nested.

true

What does the expression "Python"endswith("on") yield?

true

What are the keywords for exception handling?

try/except

What does the integer data type store?

whole numbers

Given this code: b = {1,2,3} b.add(4) print(b) what is the output?

{1,2,3,4}

A dictionary is created w/ which delimiters?

{}


Set pelajaran terkait

Accounting 203 Final- Chapter 11,12 & 5 Quiz Q

View Set

The Atlantic Slave Trade (crash course)

View Set

Phase Transfer Catalysis Chem 237

View Set

Behavioral Sci in Organization Chapter 3

View Set

Abnormal Psych Overview (Ch1,2,3)

View Set

Computer User Support - Chapter 7: System Management 1

View Set