wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

15 days of code quiz 2

Total questions: 22

Worksheet time: 1hrs 4mins

Name
Class
Date
1.
which one of the following syntaxes is used to import a csv file with all the special characters as NaN?
a)
pandas.read_csv(file_name.csv, na_values =[ ])
b)
pandas.read_csv(file_name.csv, nan_values =[ ])
c)
pandas.read_csv(file_name.csv, null_values =[ ])
d)
none
2.

What type of exception will be raised for the code given below?

num_1 = 546

num_2 = '786'

print (num_1 + num_2)

a)

syntax error

b)

type error

c)

index

d)

system

3.

3. What will be output of the code given below?

x = 10

def func(num):

x = 5 for i in num: x *= I

return x

print(func((-2, -1, 1, 2, 3)))

a)

50

b)

56

c)

55

d)

60

4.

Identify the correct statements.

I. Scatter plot is used to convey the relationship between two numerical variables


II. Histogram is used to depict the shape and spread of a continuous variable


III. Bar plot is used to depict the visual representation of statistical five-number summary of a variable

a)

I and III only

b)

I, II, III

c)

I and II only

d)

II and III only

5.

What is the statistical measure related to the box plot?

a)

Mean

b)

median

c)

standard variation

d)

variance

6.

In python, in order to check the null values, which function(s) is / are used?

a)

isnull()

b)

isna()

c)

isnan()

d)

None

7.

NumPy Arrays can be created from:

a)

Lists

b)

Arrays

c)

Nested Python Lists

d)

Random numbers

e)

Pandas series

8.

Choose the correct statement (s):

a)

NumPy arrays better than lists

b)

Lists are better than NumPy arrays

c)

arange() function returns evenly spaced values within a given interval.

d)

arange() function returns evenly spaced numbers over a specified interval.

9.

An array x contains 0 and the following operation: 1/x is performed. What will be the output?

a)

ZeroDivisionError

b)

ValueError

c)

It will give a warning, but not an error

d)

NotImplementedError

10.

Match the following column A (Error Name) with Column B (Description)


I RuntimeError -------A Raised when interpreter detects internal error


II SystemError -- B Raised when a function gets an argument of correct type but improper value


III ValueError------- C Raised when a variable is not found in local or global scope


IV NameError------- D Raised when an error does not fall under any other category

a)

I- A, II- D, III- C, IV- B

b)

I- D, II- A, III- B, IV- C

c)

I- C, II- D, III- A, IV- B

d)

I- A, II- B, III- C, IV- D

11.

What is the output of the following code?

def funcl():

n = 10

print('n in funcl = ' ,n)

def func2():

n = 20

print('n in func2 before call to funcl =' , n)

funcl()

print('n in func2 after call to funcl = ' ,n)

func2()

a)

n in func2 before call to funcl = 20

n in funcl = 10

b)

n in func2 before call to funcl = 20

n in funcl = 10

n in func2 after call to funcl = 20

c)

n in funcl = 10

n in func2 after call to funcl = 20

d)

None

12.

Choose the correct statement(s) about Object- Oriented Programming?

a)

Top-down approach

b)

Does not support code reusability

c)

Provides data hiding

d)

Main features: Polymorphism, Encapsulation, Inheritance

e)

All of the above

13.

Which of the following options are False w.r.t a class?

a)

A class does not take memory space when created

b)

Classes can be declared multiple times

c)

Class is a physical entity

d)

All of the above

14.

_____ has two or more methods having the same name but different parameters or signature.

a)

Polymorphism

b)

Overriding

c)

Overloading

d)

Dynamic polymorphism

15.

Match the following

I Abstract Class -------A Public by default.

II Interface ------ B Can be private, public, etc.

III Interface ------- C Can provide the implementation of an interface.

IV Abstract Class ------- D Variables declared are final by default

a)

I-B, II- D, III- A, IV- C

b)

I-A, II- B, III- C, IV- D

c)

I-D, II- C, III- B, IV- A

d)

I-C, II- D, III- A, IV- B

16.

While opening a file in python,

‘w’ indicates______ and ‘a’ indicates______:

a)

re-write, add

b)

write to different file, append to existing file

c)

re-write, append to different file

d)

write to same file, append to existing file

17.

Select the correct sequence operations:

a)

max()

b)

sort()

c)

len()

d)

index()

e)

Slice

18.

Which of the following are python bitwise operators?

a)

&

b)

^

c)

*

d)

||

e)

~

19.

Choose the correct output of the following Python code snippet?


k = [print(i) for i in my_string if i not in "aeiou"]

a)

prints all the vowels in my_string

b)

prints all the consonants in my_string

c)

prints all characters of my_string that aren’t vowels

d)

prints only on executing print(k)

20.

What is the output of the code shown below?


t=23.00

[round((x-23)*4/5) for x in t]

a)

[0]

b)

0

c)

[0.00]

d)

Error

21.

Registered E-mail address

4 lines
22.

How would you rate the Course?

a)

1

b)

2

c)

3

d)

4

e)

5