Webucator Introduction to Python Review

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What will type("cowboy") return? A-<class 'int'> B-<class 'float'> C-<class 'str'> D-<class 'bool'>

C

When is the epoch according to Python? A-0000-01-01 00:00:00 B-1900-01-01 00:00:00 C-1970-01-01 00:00:00 D-1956-01-31 00:00:00

C

Which method of a file object reads each line of a file into a list? A-f.read() B-f.readline() C-f.readlines() D-f.list()

C

Which of the following is an invalid import statement? A-import random B-from random import randint C-import randint from random D-import random as rand

C

17 / 2 A-8.5 B-9 C-8 D-ERROR

A

5 ** 2 A-25 B-2.5 C-1 D-10

A

True or False: A single try block can have multiple except clauses. A-true B-false

A

What character is used to comment out a line? A-# B-// C-% D-@

A

What does IDLE stand for? A-Integrated Development Environment B-I Drink Lots of Energy Drinks C-I Do Love my Editor D-Incredibly Delightful Little Editor

A

What will type(47) return? A-<class 'int'> B-<class 'float'> C-<class 'str'> D-<class 'bool'>

A

Which of the following is mutable? A-list B-tuple C-string D-range

A

any( [1, 2, 0, True] ) A-true B-false C-3 D-4

A

int('x') results in a... A-ValueError B-NameError C-TypeError D-No error

A

Which of the following will cause an error? A-s= 'He\'s going.' B-s= 'He said "I am going".' C-s= 'He said "I am going"." D-s="He's going."

C

"WEBUCATOR"[:] A-"" B-"WEBUCATOR" C-ERROR

B

True or False: Every if statement needs an else clause. A-true B-false

B

True or False: When you open a file using the with statement, you still must close it with f.close(). A-true B-false

B

What keyword must be used to modify a global variable from within a function? A-local B-global C-external D-var

B

What method of the time module is used to format times? A-time.format() B-time.strftime() C-time.time D-time.str()

B

Which function is used to get data from the user? A-insert() B-input() C-prompt() D-print()

B

Which of the following is not a sequence? A-[1,2,3,4] B-{a': 1, 'b': 2, 'c': 3} C-(1, 2, 3, 4) D-'hello!'

B

Which statement is true? A-open('list.txt','w') opens a file for reading and writing B-open('list.txt','w') opens a file for writing only C-open('list.txt','w') errors of list.txt doesn't exist D-open('list.txt','w') opens a file for reading only

B

[5, 4, 3, 2, 1].pop() A-5 B-1 C-None D-ERROR

B

[5, 4, 3, 2, 1][-2] A-[2, 1] B-2 C-3 D-[5, 4, 3]

B

all( [1, 2, 0, True] ) A-true B-false C-3 D-4

B

max( range(3, 10) ) A-13 B-9 C-10 D-12

B

Assuming foo.py imports sys, what will the first item of sys.argv be when the following code is run at the command line: python foo.py 1 2 3 A-1 B-1 C-foo D-foo.py

D

On which operating system does Python run? A-Windows B-Mac OS X C-Linux D-All of the above

D

What function is used to find the data type of an object? A-class() B-class() C-data_type() D-type() E-print()

D

"WEBUCATOR"[3] A-"WEB" B-"B" C-"U" D-ERROR

C

17 // 2 A-8.5 B-9 C-8 D-ERROR

C

Dividing by zero results in a... A-ValueError B-TypeError C-ZeroDivisionError D-InfinityError

C

If the variable num holds 10. What does it hold after this operation? num += 5 A-10 B-5 C-15 D-NONE

C

Judging by its name, which variable is likely a constant? A-start B-start_value C-START D-startValue

C

What is the name usually given to the function that runs the script? A-init() B-go() C-main() D-run()

C

What type of object expresses the difference between two dates or times? A-datetime.timediff B-datetime.delta C-datetime.datediff D-datetime.timedelta

D

What will type(False) return? A-<class 'int'> B-<class 'float'> C-<class 'str'> D-<class 'bool'>

D

Which of the following clocks measures absolute time? A-time.monotonic() B-time.perf_counter() C-time.process_time() D-time.time()

D

Which print() call is the equivalent of print('Howdy, ',fname)? A-print('Howdy,', fname, end="") B-print('Howdy,', fname, sep="") C-print('Howdy,', fname, sep='\n' end='') D-print('Howdy,', fname, sep='', end='\n'

D

Who created Python? A-Larry Wall B-Ross Ihaka C-Steve Jobs D-Guido Van Rossum

D


Ensembles d'études connexes

Module 7: European modernisms (Modernist alternatives to straight photography; Surrealism + Euro moderns)

View Set

The ozone story- Haloalkanes and ozone

View Set

RETIREMENT PLANNING: Ch10. SIMPLE, 403(b), AND 457 PLANS

View Set

BUSMHR 2500 Chapter 3 Generating and Exploiting New Entries

View Set

Market research and analysis exam 1

View Set