Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

7. Senior management supports the career system.

Answered: 1 week ago