CYBR 2370 Brainscape - Week 6 Flashcards

1
Q

Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program?

A

PYTHONPATH

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following environment variable for Python contains the path of an initialization file containing Python source code?

A

PYTHONSTARTUP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following environment variable for Python is used in Windows to instruct Python to find the first case-insensitive match in an import statement?

A

PYTHONCASEOK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following environment variable for Python is an alternative module search path?

A

PYTHONHOME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is python a case sensitive language?

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following data types is not supported in python?

A

Slice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the following data types is not supported in python?

A

Generics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the output of print str if str = ‘Hello World!’?

A

Hello World!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the output of print str[0] if str = ‘Hello World!’?

A

H

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the output of print str[2:5] if str = ‘Hello World!’?

A

llo

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the output of print str[2:] if str = ‘Hello World!’?

A

llo World!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the output of print str * 2 if str = ‘Hello World!’?

A

Hello World!Hello World!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the output of print list if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?

A

[ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the output of print list[0] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?

A

abcd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the output of print list[1:3] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?

A

[786, 2.23]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the output of print list[2:] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?

A

[2.23, ‘john’, 70.2]

17
Q

What is the output of print tinylist * 2 if tinylist = [123, ‘john’]?

A

[123, ‘john’, 123, ‘john’]

18
Q

What is the output of print tinylist * 2 if tinylist = [123, ‘john’]?

A

[123, ‘john’, 123, ‘john’]

19
Q

Which of the following is correct about tuples in python?

A

Sequence of data, values separated by commas, enclosed with parentheses

20
Q

What is the output of print list if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?

A

( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )

21
Q

What is the output of print tuple[0] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?

A

abcd

22
Q

What is the output of print tuple[1:3] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?

A

(786, 2.23)

23
Q

What is the output of print tuple[2:] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?

A

(2.23, ‘john’, 70.2)

24
Q

What is the output of print tinytuple * 2 if tinytuple = (123, ‘john’)?

A

(123, ‘john’, 123, ‘john’)

25
Q

What is the output of print tinytuple * 2 if tinytuple = (123, ‘john’)?

A

(123, ‘john’, 123, ‘john’)

26
Q

Which of the following is correct about dictionaries in python?

A

Kind of hash table, consist of key-value pairs, values can be any object

27
Q

Which of the following function of dictionary gets all the keys from the dictionary?

A

keys()

28
Q

Which of the following function of dictionary gets all the values from the dictionary?

A

values()

29
Q

Which of the following function convert a string to an int in python?

A

int(x [,base])

30
Q

Which of the following function convert a string to a long in python?

A

long(x [,base] )

31
Q

Which of the following function convert a string to a float in python?

A

float(x)

32
Q

Which of the following function convert an object to a string in python?

A

str(x)

33
Q

Which of the following function convert an object to a regular expression in python?

A

repr(x)

34
Q

Which of the following function convert a String to an object in python?

A

eval(str)

35
Q

Which of the following function convert a String to a tuple in python?

A

tuple(s)