Filters
Question type

Study Flashcards

The expression primes = (2, 3, 5, 7, 11) creates a list named primes.

A) True
B) False

Correct Answer

verifed

verified

It is good practice to import all names from a module using the * operator.

A) True
B) False

Correct Answer

verifed

verified

Indenting code that should be executed when an if statement evaluates as true makes your program easier to read, but the indentation is not necessary.

A) True
B) False

Correct Answer

verifed

verified

In Python, _MyVar15 is a valid variable name.

A) True
B) False

Correct Answer

verifed

verified

To create an end-of-line comment, which symbol do you use to begin the comment?


A) #
B) *
C) /
D) @

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

Strings are compared using ASCII ordering.

A) True
B) False

Correct Answer

verifed

verified

Which statement is true about Python syntax?


A) a code block must begin with a left brace
B) each code statement must end with a semicolon
C) white space is ignored
D) blocks of code are indicated by indentation

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

The keywords True and False are floating point values.

A) True
B) False

Correct Answer

verifed

verified

False

In Python, a variable containing the value 5 will evaluate as true if used with the and logical operator.

A) True
B) False

Correct Answer

verifed

verified

Standard functions and Python's library functions check the types of their arguments when the function is called.

A) True
B) False

Correct Answer

verifed

verified

With what character does the print function terminate its output by default?


A) newline
B) null
C) period
D) space

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

What is the output of the following code? Sum = 0 For value in range(1,4) : If value == 2: Sum = sum**2 Sum += value Print(sum)


A) 6
B) 12
C) 8
D) 16

E) A) and D)
F) B) and D)

Correct Answer

verifed

verified

What symbol is used to insert a tab in a string?


A) \t
B) [ TAB ]
C) / t
D) @ tab

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Strings are mutable objects, which means you can replace their contents.

A) True
B) False

Correct Answer

verifed

verified

A list mutator is a method used to modify the contents of a list.

A) True
B) False

Correct Answer

verifed

verified

True

What keyword is used to make a multiway if statement?


A) else
B) elif
C) then
D) elseif

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

The main python module contains the starting point of execution.

A) True
B) False

Correct Answer

verifed

verified

In a class definition, what type of method uses the values of the object's instance variables without changing them?


A) constructor
B) accessor
C) instance
D) mutator

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

Select the answer that should be used to replace the missing code in the following statements. myList = list() FileObj = open("myfile.dat", "rb") While True: Try: Item = pickle.load(fileObj) MyList.append(item) < missing code > FileObj.close() Break Print(myList)


A) if EOF:
B) elif Error:
C) except EOFError:
D) else while TRUE:

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

The keyword while means the same thing as While in Python.

A) True
B) False

Correct Answer

verifed

verified

False

Showing 1 - 20 of 51

Related Exams

Show Answer