Quiz – Python

/5

Variables and Data Types

1 / 5

What will be the output of below code:

2 / 5

What will be the output of below code:

                    

def myfunc():
    x = 99
    return x
myfunc()
print(x)

3 / 5

What will be the output of below code:

4 / 5

What will be the output of below code:

5 / 5

What will be the output of below code:

Your score is

The average score is 35%

0%

Exit

/5

Strings

1 / 5

What will be the output of below code:

                    

str = “my name is jack”;

print (str.capitalize())

2 / 5

What will be the output of below code:

                    

str1 = “my isname isisis Jameis isis bond”;

sub = ‘is’

print (str1.count(sub, 4)

3 / 5

What will be the output of below code:

                    

print (“John” > “Jhon”)

print (“Emma” < “Emm”)

4 / 5

What will be the output of below code:

                    

str1 = “My salary is 7000”;

str2 = “7000”

print (str1.isdigit())

print (str2.isdigit())

5 / 5

Which method is used to convert string “welcome to the beautiful world” to “Welcome To The Beautiful World”

Your score is

The average score is 66%

0%

Exit

/3

Input and Output

1 / 3

In Python3, which functions are used to accept input from the user and whatever you enter in the function converts it into which data types?

2 / 3

What will be the output of below code:

                    

print (sep=’-- ‘, Ben’, ‘25’, California’)

3 / 3

What will be the output of below code:

Your score is

The average score is 48%

0%

Exit

/5

Operators

1 / 5

What will be the output of below code:

2 / 5

What will be the output of below code:

3 / 5

What will be the output of below code:

4 / 5

What will be the output of below code:

5 / 5

What will be the output of below code:

                    

str1 = ‘Welcome’

print(str1*2)

Your score is

The average score is 95%

0%

Exit

/5

Loops

1 / 5

What will be the output of below code:

                    

x=0

for i in range (10):

  for j in range (-1, -10, -1):

     x +=1

     print(x)

2 / 5

What will be the output of below code:

                    

for num in range ( -2, -5, -1)

      print (num, end = “,”)

3 / 5

What will be the output of below code:

                    

for i in ‘Jhon’:

    if i == ‘o’:

       pass

    print (i, end = “,”)

4 / 5

What will be the output of below code:

                    

for num in range (2, -5, -1):

   print (num, end = “,”)

5 / 5

What will be the output of below code:

                    

for i in range (10,15,1):

  print (i, end=’,’)

Your score is

The average score is 53%

0%

Exit

/5

Functions

1 / 5

What will be the output of below code:

                    

def add (a, b):

   return a+5, b+5

 

result = add (3, 2)

print(result)

2 / 5

Please select the correct expression to reassign a global variable “x” to 20 inside a function fun1()?

                    

x=50

def fun1():

   #your code to assign global x=20

fun1()

print(x) #it should print 20

3 / 5

What will be the output of below code:

                    

def func1():

     x = 50

     Return x

func1()

print(x)

4 / 5

What will be the correct function declaration of func1() so that we can execute the following function call successfully

                    

 

fun1(25,75, 55)

fun1(10, 20)

5 / 5

What will be the output of below code:

                    

def calculate (num1, num2=4):

  res = num1*num2

  print(res)

calculate (5,6)

Your score is

The average score is 44%

0%

Exit

Price Based Country test mode enabled for testing United States (US). You should do tests on private browsing mode. Browse in private with Firefox, Chrome and Safari