Please add flowchart for each question with code, and give explanation for each question and don't copy from internet 1. Which of the following is
This question has been answered
Question

Please add flowchart for each question with code, and give explanation

for each question and don't copy from internet
1. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don't provide better modularity for your application
c) you can't also create ur own functions
d) All of the mentioned


2. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function


3. What will be the output of the following Python code?


def sayHello():
  print('Hello World!') 
sayHello() 
sayHello()
a)


Hello World!
Hello World!
b)


'Hello World!'
'Hello World!'
c)


Hello
Hello
d) None of the mentioned


4. What will be the output of the following Python code?


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)
a) 3
b) 4
c) 4 is maximum
d) None of the mentioned


5. What will be the output of the following Python code?


x = 50
def func(x):
  print('x is', x)
  x = 2
  print('Changed local x to', x)
func(x)
print('x is now', x)
a)


x is 50
Changed local x to 2
x is now 50
b)


x is 50
Changed local x to 2
x is now 2
c)


x is 50
Changed local x to 2
x is now 100
d) None of the mentioned


6. What will be the output of the following Python code?


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)
a)


x is 50
Changed global x to 2
Value of x is 50
b)


x is 50
Changed global x to 2
Value of x is 2
c)


x is 50
Changed global x to 50
Value of x is 50
d) None of the mentioned


7. What will be the output of the following Python code?


def say(message, times = 1):
  print(message * times)
say('Hello')
say('World', 5)
a)


Hello
WorldWorldWorldWorldWorld
b)


Hello
World 5
c)


Hello
World,World,World,World,World
d)


Hello
HelloHelloHelloHelloHello
 
8. What will be the output of the following Python code?


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)


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
b)


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
c)


a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
d) None of the mentioned


9. What will be the output of the following Python code?


def maximum(x, y):
  if x > y:
    return x
  elif x == y:
    return 'The numbers are equal'
  else:
    return y
 
print(maximum(2, 3))
a) 2
b) 3
c) The numbers are equal
d) None of the mentioned


10. Which of the following is a feature of DocString?
a) Provide a convenient way of associating documentation with Python modules, functions, classes, and methods
b) All functions should have a docstring
c) Docstrings can be accessed by the doc attribute on objects
d) All of the mentioned

Answered by Expert Tutors

gue vel laoreet ac, dictum vitae odio

Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce
Step-by-step explanation

trices ac ma
ipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae
ultrices ac

ipiscing el
fficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus

ce dui lectu
, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, da

ultrices ac
ng elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum v
a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur
acinia pulv
ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

ec aliquet.
dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar
cing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lore
trices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibu

m ipsum dolo
molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui
a. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing el

usce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam

icitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar

ctum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultri

et, consect
, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoree

a molestie co
nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacini

Get unstuck

376,503 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses