Ad Code

Python Quiz 6 Answers 100% Correct No UFM

 Programming for Noobs

PYTHON Quiz 6 Answers





Disclaimer-

This article only attempts to discover some questions that can be generated in Python for Engineering with the answer to all these questions. There can be some errors to these answers. If you find any error then please do write to us.


Q1. In python,

(a). indentation indicates a block of code.

(b). def keyword is used to indicate starting of a function.

(c). A function can call other functions. 

(d). All of the Above

Reason: Python uses indentation to point a block of code. & The “def” keyword may be a statement for outlining a function in Python. you begin a function with the def keyword, followed by a colon (:) sign. so, all are including in python, so option d is correct

Programming for Noobs


Programming for Noobs

Q2. Assume that the "min" function computes the minimum of two value and "max" function computes the maximum of two value Let x1, x2 be 2 distinct integers. what can you say about the following program (using Python 3.X version)?

 y1 = min (x1, x2)

y2 = max (y1, y2)

(a). if x1 is smaller than x2, then y1 and y2 will be same 

(b). if x1 is greater than x2, then y1 will be equal to x2.

(c). if we further run y3=max (y1, y2), then y3 will always be equal to x1

(d). All of the above

Reason: -the "min" function computes the minimum of two value and "max" function computes the maximum of two value Let x1, x2 be 2 distinct integers. than we can say if we further run y3=max (y1, y2), then y3 will always be equal to x1.

Programming for Noobs



Programming for Noobs

Q3. which of the below statement /s is/ are true for global keyword in Python?

(a).it is used to read Global variable inside a function.

(b). if we want to use value of global variable inside a function, we will have to use Global keyword

(c). A variable name inside a function can be same as variable name of global variable.

(d). All of the above.

Reason:  Different variables in an exceedingly python program have different scope. A variable declared outside a function may be a global variable by default. We use a worldwide keyword for a variable which is inside a function so it is modified. Without the worldwide keyword, the variable inside a function is local by default

Programming for Noobs

Programming for Noobs

Q4.   what will be the output of the following code? -

def keywoedExample(x=1,y=2,z=4):

sum=x+y

min=sum - z

print(min)

keywordExample(y=8,x=4,z=y)

(a). Error

(b).9

(c).0

(d).5

 

Reason: Indentation Error: expected an indented block, so the answer is error

Programming for Noobs


Programming for Noobs

Q5. Which of the following statement is false for string in Python:

(a). they represent sequence of characters 

(b). strings are mutable

(c). backslash be used to escape quote

(d). All of the above

Reason: To create a string, put the sequence of characters inside either single quotes, double quotes, or triple quotes and then assign it to a variable. You can look into how variables work in Python in the Python variables tutorial. For example, you can assign a character 'a' to a variable single_quote_character 

Programming for Noobs

Please subscribe to our channel 











Post a Comment

0 Comments