9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855 SEARCHING FOR ACADEMIC PROJECT?
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855    ### PYTHON QUESTIONS : PART 8

Which keyword is use for function?

Fun

Define

Def

Function

SHOW ANSWER

What is the output of the below program?

def sayHello:

print('Hello World')

say Hello()

say Hello()

Hello World!

Hello world!

'Hello World!'

'Hello World!'

Hello

Hello

None of the mentioned

SHOW ANSWER

What is the output of the below program?

def printMax(a, b):

if a> b:

print(a, 'is maximum)

elif a= b:

print(a, 'is equal to, b)

else:

print(b, 'is maximum)

printMax(3,4)

3

4

4 is maximum

None of the mentioned

SHOW ANSWER

How are variable length arguments specified in the function heading?

one star followed by a valid identifier

one underscore followed by a valid identifier

two stars followed by a valid identifier

two underscores followed by a valid identifier

SHOW ANSWER

What is the output of the below program?

def sum(*args):

"'Function returns the sum

of all values"

r=0

for i in args:

r+=i

return r

print sum.__doc__

print sum(1,2,3)

print sum(1, 2, 3, 4, 5)

6

15

6

100

123

12345

None of the mentioned

SHOW ANSWER

What is the output of below program?

def say(message, times=1):

print(message times)

say('Hello')

way('World',5)

Hello

World World World World World

Hello

World 5

Hello

World, World, World, World, World

Hello

Hello Hello Hello Hello Hello

SHOW ANSWER

What is the output of the below program?

def func(a, b 5,c= 10):

print('a is', a, 'and b is',b, 'and c is',c)

func(3, 7)

func(25, c= 24)

func(c=50, a = 100)

a is 7 and b is 3 and c is 10

a is 25 and b is 5 and c is 24

a is 5 and b is 100 and c is 50

a is 3 and b is 7 and c is 10

a is 5 and b is 25 and c is 24

a is 50 and b is 100 and c is 5

a is 3 and b is 7 and c is 10

a is 25 and bis 5 and c is 24

a is 100 and b is 5 and c is 50

None of the mentioned

SHOW ANSWER

Python supports the creation of anonymous functions at runtime, using a constructor called -----------

Lambda

pi

anonymous

None of the mentioned

SHOW ANSWER

what is the output of below program?

lamb=lamda x:x**3

print (lamb (5))

15

555

125

None of the mentioned

SHOW ANSWER

What is the output of this program?

y=6

z=lambda x:x*y

printz(8)

48

14

64

None of the mentioned

SHOW ANSWER

What is a variable defined outside a function referred to as?

A static variable

A global variable

A local variable

An automatic variable

SHOW ANSWER

Which of the following data structures is returned by the functions globals() and locals()?

list

set

dictionary

tuple

SHOW ANSWER

What is the output of the below program?

x = 50

def func):

global x

print('x is', x)

X= 2

print('Changed global x to', x)

func()

print ('Value of x is',x)

x is 50

Changed global x to 2

Value of x is 50

x is 50

Changed global x to 2

Value of x 2

x is 50

Changed global x to 50

Value of x is 50

None of the mentioned

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