Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

PYTHON QUESTIONS : PART 7

What is the output of the code shown?

s=set

type(s)

<'set'>

<class 'set'>

set

class set

SHOW ANSWER

What is the output of the snippet of code shown below?

z=set('abc$de')

'a' in z

True

False

No output

Error

SHOW ANSWER

The -------- function removes the first element of a set and the last element of a list.

remove

pop

discard

dispose

SHOW ANSWER

Which of the following statements create a dictionary?

d = {}

d ={"john":40, "peter":45}

d={40:"john", 45:"peter"}

All of the mentioned

SHOW ANSWER

Read the code shown below carefully and pick out the keys?

d={"john":40, "peter":45}

"John", 40, 45, and "peter"

"john" and "peter"

40 and 45

d = {40:"john", 45:"peter"}

SHOW ANSWER

What is the output of the following snippet of code?

>>>a={1:" A",2:"B",3:"C" }

>>>del a

method del doesn't exist for the dictionary

del deletes the values in the dictionary

del deletes the entire dictionary

del deletes the keys in the dictionary

SHOW ANSWER

What is the output of the following snippet of code?

test ={1:'A', 2:'B', 3:'C'}

test={}

print(len(test))

0

None

3

An exception is thrown

SHOW ANSWER

What is the output of the following snippet of code?

>>>a={i:i*i for i in range(6)}

Dictionary comprehension doesn't exist

(0:0, 1:1,2:4, 3: 9,4: 16,5: 25, 6:36}

(0:0,1: 1,4: 4,9:9,16:16,25:25)

(0:0, 1:1, 2: 4.3:9, 4: 16,5:25)

SHOW ANSWER

What is the output of the following?

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

prints all the vowels in my_string

prints all the consonants in my_string

prints all characters of my_string that aren't vowels

prints only on executing print(k)

SHOW ANSWER

What is the output of the following code?

>>> a, b = 6,7

>>> a, b = b, a

>>> a, b

(6,7)

Invalid syntax

(7,6)

Nothing is printed

SHOW ANSWER

Which of the following is the use of function in python ?

Function e reusable pieces of programs

Functions don't provide better modularity for your application

You can't also create your own functions

All of the mentioned

SHOW ANSWER

Which are the advantages of functions in python?

Reducing duplication of code

Decomposing complex problems into simpler pieces

Improving clarity of the code

All of the mentioned

SHOW ANSWER

What are the two main types of functions?

Custom function

Built-in function & User defined function

User function

System function

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in