Question: PYTHON PROBLEMS 3/ __________ creates a list. (Choose all that apply) list1 = list() list1 = [] list1 = list([12, 4, 4]) list1 = [12,

PYTHON PROBLEMS

3/ __________ creates a list. (Choose all that apply)

list1 = list()

list1 = []

list1 = list([12, 4, 4])

list1 = [12, 4, 4]

list1 = [1, "3", "red"]

6/ Analyze the following code:

class A:

def __init__(self, s):

self.s = s

def print(self):

print(self.s)

a = A()

a.print()

The program has an error because class A does not have a constructor.

The program has an error because s is not defined in print(s).

The program runs fine and prints nothing.

The program has an error because the constructor is invoked without an argument

8/ Which classes are the exception classes in Python? (Choose all that apply)

ArithmeticError

IOException

RuntimeError

DivideByZeroError

10/ Is pow(a, b) the same as a ** b?

Yes

No

13/ The word True is ________. (Choose all that apply)

a Python keyword

a Boolean literal

same as value 1

same as value 0

14/ To generate a random integer between 0 and 5, use ________________.(Choose all that apply)

random.randint(0, 5)

random.randint(0, 6)

random.randrange(0, 5)

random.randrange(0, 6)

21/ What relationship is appropriate for Account and Savings Account?

association

composition

inheritance

no relation

30/ What type of error produces incorrect results but does not prevent the program from running?

syntax

logic

grammatical

human

34/ Which of the following should be defined as a None function?

Write a function that prints integers from 1 to 100.

Write a function that returns a random integer from 1 to 100.

Write a function that checks whether current second is an integer from 1 to 100.

Write a function that converts an uppercase letter to lowercase.

42/ What statement can be used to indicate error ExceptionA occurred in a program?

throw ExceptionA

raise ExceptionA

ExceptionA occurred

ExceptionA()

45/ Which of the following function returns a sequence 0, 1, 2, 3? (Choose all that apply)

range(0, 3)

range(0, 4)

range(3)

range(4)

47/ A computer's _______ is volatile; that is, any information stored in it is lost when the system's power is turned off.

floppy disk

hard disk

flash stick

CD-ROM

memory

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!