wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Bertelsmann AI Track Quiz Initiative #3

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

What is the difference between list and tuples in Python? Choose all correct answers

a)

Lists are mutable i.e they can be edited.

b)

Tuples are mutable i.e they can be edited.

c)

Tuples are immutable (tuples are lists which can’t be edited).

d)

Lists are immutable (Lists are array which can’t be edited).

2.

What are the key features of Python? Choose all correct answers

a)

Python is a compiled language. That means that, like languages like C and its variants, Python does need to be compiled before it is run.

b)

Python is dynamically typed, this means that you don’t need to state the types of variables when you declare them or anything like that.

c)

Python is well suited to object-orientated programming in that it allows the definition of classes along with composition and inheritance.

d)

In Python, functions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions.

3.

How is memory managed in Python? Choose all correct answers

a)

Memory management in python is managed by Python private heap space

b)

Memory management in python is managed by Python private stack space

c)

Python also has an inbuilt garbage collector which recycles all the unused memory

d)

Memory allocation have to be managed by the programmer

4.

Which data types are natively supported in Python? Choose all correct answers

a)

Numbers

b)

Strings

c)

Tensors

d)

Dictionaries

5.

A = "Bertelsman"

B = "Scholarship"

B = A.join(B)


What is the value of B?

a)

Bertelsman Scholarship

b)

BertelsmanScholarship

c)

Scholarship

d)

Error because string is immutable

6.

r = lambda q: q * 2

s = lambda q: q * 3

x = 2

x = r(x)

x = s(x)

x = r(x)

print (x)


What's printed in the console?

a)

6

b)

12

c)

24

d)

48

7.

a = 4.5

b = 2

print (a//b)


What's printed in the console?

a)

0

b)

1.0

c)

1.5

d)

2.0

8.

stg='XYZ'

A=len(stg)

B=stg[0]

print(A,B)


What's printed to the console?

a)

3 X

b)

3 Y

c)

4 X

d)

4 Y

9.

How to modify python array? Choose all correct answers

a)

pop()

b)

slice()

c)

push()

d)

append()

10.

a="Udacity Course"

print(a.split())


What's printed on the console?

a)

["Udacity ", "Course"]

b)

["Udacity", "Course"]

c)

["Udacity Course", ""]

d)

[]

11.

How to import modules in python? Choose all correct answers

a)

import array

b)

import array as arr

c)

from array import *

d)

import * from array

12.

Which library below used for Machine Learning in python? Choose all correct answers

a)

PyTorch

b)

mlpack

c)

Tensorflow

d)

Keras

13.

Which of the following is an invalid statement?

a)

abc = 1,000,000

b)

a,b,c = 1000, 2000, 3000

c)

a b c = 1000 2000 3000

d)

a_b_c = 1,000,000

14.

What are the principal differences between the lambda and def?

a)

Def can hold multiple expressions while lambda is a uni-expression function

b)

Lambda can hold multiple expressions while def is a uni-expression function

c)

Def can have a return statement. Lambda can’t have return statements.

d)

Lambda can have a return statement. Def can’t have return statements.

15.

What does the **kwargs do in Python?

a)

It let us pass N (variable) number of arguments which can be named or keyworded

b)

It gives us the ability to pass N (variable) number of arguments.

16.

Which library below is used to plot a chart in python? Choose all correct answers

a)

Plotly

b)

D3

c)

Matplotlib

d)

Seaborn

17.

Which library below is used to calculate linear algebra except for Numpy? Choose all correct answers

a)

Pandas

b)

PyTorch

c)

Tensorflow

d)

Sympy

18.

import numpy as np

arr = np.array([1, 3, 2, 4, 5])

print(arr.argsort()[-3:][::-1])


What's printed in console?

a)

[4 3 1]

b)

[3 1 2]

c)

[1 3 2]

d)

[3 5 4]

19.

fruits = ["apple", "banana", "cherry"]

newlist = [x for x in fruits if "a" in x]


What this operation is called?

a)

Inline loop

b)

List comprehension

c)

Array spread operation

d)

Conditional array

20.

import math

all([bool(x) for x in [0, 1.2, 0.5, math.inf, math.nan]])


What's the result of the code snippet above?

a)

True

b)

False