Final Exam

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Tuples are: Not indexed Mutable Unordered Not mutable

.

What is a two-dimensional data structure? Pandas Dataframe Pandas Series Numpy

.

What is the Python find() method used for? The method finds the ending index of a substring The method finds the starting index of a substring The method finds every second index of a substring

.

What is the process of forcing your program to output an error message when it encounters an issue? Exception handling Output errors Error messages Force Out

.

What is the result of the following lines of code? a=np.array([0,1,0,1,0]) b=np.array([1,0,1,0,1]) a*b array([1, 1, 1, 1, 1]) array([0, 0, 0, 0, 0]) 0

.

What is the result of the following lines of code? a=np.array([10,9,8,7,6]) a+1 array([11,10,9,8,7]) array([9, 8, 7, 6, 5]) array([101,91,81,71,61])

.

What is the result of the following operation: '1:2,3:4'.split(':')? ['1,2', '3,4'] ['1', '2,3', '4'] ['1,2,3,4'] ['1', '2', '3', '4']

.

What is the type of the following: 1.0 str float int

.

A list cannot be sorted if it contains: concatenated strings only numeric values only strings strings and numeric values

.

Consider the file object: File1. How would you print the first two lines of text? for n in range(0,2): print(file1.readline()) file1.readline(4)

.

In Python 3, what is the type of the variable x after the following: x=2/2 ? float int

.

In Python, if you executed name = 'Lizz', what would be the output of print(name[0:2])? Li L Lizz

.

In Python, if you executed var = '01234567', what would be the result of print(var[::2])? 0246 1357 1234567

.

What add function would return '2' ? def add(x): return(x+x+x) add('1') def add(x): return(x+x) add('1') def add(x): return(x+x) add(1)

.

What are the 3 parts to a URL? Block, post, and route Put, route, and get Get, post, and scheme Scheme, internet address, and route

.

What code segment would output the following? 2 for i in range(1,5): if (i!=2): print(i) for i in range(1,5): if (i==2): print(i) for i in range(1,5): if (i!=1): print(i)

.

What data type must have unique keys? List Dictionary Tuple

.

What does the index of "1" correspond to in a list or tuple? the third The second element The first element

.

What following code segment would produce an output of "0"? 1//2 1/2

.

What following code segment would return a 3? float(3.99) str(3.99) int(3.99)

.

What is a collection that is unordered, unindexed and does not allow duplicate members? List Set Tuple

.

What is the width of the rectangle in the class Rectangle? class Rectangle(object): def __init__(self,width=2,height =3,color='r'): self.height=height self.width=width self.color=color def drawRectangle(self): import matplotlib.pyplot as plt plt.gca().add_patch(plt.Rectangle((0, 0),self.width, self.height ,fc=self.color)) plt.axis('scaled') plt.show() 3 2 0

.

What mode over writes existing text in a file? Append "a" Write "w" Read "r"

.

What segment of code would output the following? 11 22 33 A=['1','2','3'] for a in A: print(2*a) A=[1,2,3] for a in A: print(2*a) A=['1','2','3'] for a in A: print(3*a)

.

What value of x will produce the following output? How are you? x= if(x!=1): print('How are you?') else: print('Hi') x=1 x=6 x="7"

.


Kaugnay na mga set ng pag-aaral

Communications and the Law: Chapter 1

View Set

MH Psych Pharm Practice Test 1 2020

View Set

Ch.7: Strategies for Competing in International Markets

View Set

Environmental Science Chapter One Test (9/17-9/18)

View Set

Intro to Human Anatomy and Physiology

View Set

Scrum Master: Multiple answers, Scrum Master, Scrum Master

View Set

ECON 1 FINAL NOTES ch 13,15,16,17

View Set