Python Questions


Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/public/class-quiz-maker-public.php on line 1335

Deprecated: Implicit conversion from float 0.16666666666666666 to int loses precision in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/includes/class-quiz-maker-data.php on line 1008

Deprecated: Implicit conversion from float 0.16666666666666666 to int loses precision in /home/u797631661/domains/codermantra.com/public_html/wp-content/plugins/quiz-maker/includes/class-quiz-maker-data.php on line 1008

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/u797631661/domains/codermantra.com/public_html/wp-includes/formatting.php on line 449
0 votes, 0 avg
455

Python Questions

1 / 15

1. Which keyword is used for function in Python language?

2 / 15

2. Study the following code:

x = [‘XX’, ‘YY’]
for i in a:
i.lower()
print(a)

What will be the output of this program?

3 / 15

3.

What will be the datatype of the var in the below code snippet?

var = 10
print(type(var))
var = "Hello"
print(type(var))

4 / 15

4. Which one of the following syntaxes is the correct syntax to read from a simple text file stored in ”d:python.txt”?

5 / 15

5. Let A and B be objects of class Foo. Which functions are called when print(A + B) is executed?

6 / 15

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

places = ['Bangalore', 'Mumbai', 'Delhi']

places1 = places places2 = places[:]
places1[1]="Pune" places2[2]="Hyderabad" print(places)

7 / 15

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

8 / 15

8. Which of the following is used to define a block of code in Python language?

9 / 15

9. Which of the following is false regarding conditional statement in Python?

10 / 15

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

class Demo:
    def __new__(self):
        self.__init__(self)
        print("Demo's __new__() invoked")
    def __init__(self):
        print("Demo's __init__() invoked")
class Derived_Demo(Demo):
    def __new__(self):
        print("Derived_Demo's __new__() invoked")
    def __init__(self):
        print("Derived_Demo's __init__() invoked")
def main():
    obj1 = Derived_Demo()
    obj2 = Demo()
Main()

11 / 15

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

import re
s = 'abc123 xyz666 lmn-11 def77'
re.sub(r'b([a-z]+)(d+)', r'21:', s)

12 / 15

12. As what datatype are the *args stored, when passed into a function?

13 / 15

13. Which of the following functions can be used to read data from a file using a file descriptor?

14 / 15

14. What will be the output of the following Python program?

z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
Z

15 / 15

15. In Python, the break and continue statements, together are called ___ statement.

Your score is

The average score is 35%

0%