In which year was the Python 3.0 version developed?
1.2008
2.2000
3.2010
4.2005
Which one of the following has the highest precedence in the expression?
1.Division
2.Subtraction
3.Power
4. Parentheses
How is a function declared in Python?
1.def function function_name():
2.declare function function_name():
3.def function_name():
4.declare function_name():
If return statement is not used inside the function, the function will return:
1.None
2.0
3.Null
4.Arbitary value
In which language is Python written?
1. English
2.PHP
3.C
4.All of the above
In which part of memory does the system stores the parameter and local variables of funtion call?
1.heap
2.stack
3.Uninitialized data segment
4.None of the above
In which year was the Python language developed?
1.1995
2.1972
3.1981
4.1989
What is the maximum possible length of an identifier?
1.16
2.32
3.64
4.None of these above
Lambda is a function in python?
1.TRUE
2.FALSE
3.Lambda is a function in python but user can not use it.
4.None of the above
Study the following code: >>>"javatpoint"[5:] What will be the output of this code?
1.javatpoint
2. java
3.point
4.None of these
Study the following code: x = ['XX', 'YY'] for i in a: i.lower() print(a) What will be the output of this program?
1.['XX', 'YY']
2.['xx', 'yy']
3.[XX, yy]
4.None of these
Study the following function: all([2,4,0,6]) What will be the output of this function?
1. False
2.TRUE
3.0
4. Invalid code
Study the following function: import math abs(math.sqrt(36)) What will be the output of this code?
1.Error
2.#VALUE!
3.6
4.6
Study the following function:any([5>8, 6>3, 3>1]) What will be the output of this code?
1.FALSE
2. True
3.Invalid code
4.None of these
Study the following function:round(4.576) What will be the output of this function?
1.4
2.5
3.576
4.5
Study the following program: a = 1 while True: if a % 7 = = 0: break print(a) a += 1 Which of the following is correct output of this program?
1.1 2 3 4 5
2.1 2 3 4 5 6
3.1 2 3 4 5 6 7
4.Invalid syntax
Study the following program: i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0) What will be the output of this statement?
1. 1 2 3
2.0 1 2 3
3. 0 1 2
4. 3 2 1
Study the following program: i = 1: while True: if i%3 == 0: break print(i) Which of the following is the correct output of this program?
1.1 2 3
2.3 2 1
3.1 2
4.Invalid syntax
Study the following program: x = 1 while True: if x % 5 = = 0: break print(x) x + = 1 What will be the output of this code?
1.error
2.2 1
3.0 3 1
4.None of these
Study the following program: x = ['xy', 'yz'] for i in a: i.upper() print(a) Which of the following is correct output of this program?
1.['xy', 'yz']
2. ['XY', 'YZ']
3.[None, None]
4.None of these
Study the following statement: >>>"a"+"bc" What will be the output of this statement?
1. a+bc
2.abc
3.a bc
4.a
Study the following statements: >>> print(0xA + 0xB + 0xC) What will be the output of this statement?
1.33
2.63
3. 0xA + 0xB + 0xC
4.None of these
Study the following statements: >>> print(ord('h') - ord('z')) What will be the output of this statement?
1.18
2.-18
3.17
4.-17
Study the following statements: >>> str1 = "javat" >>> str2 = ":" >>> str3 = "point" >>> str1[-1:] What will be the output of this statement?
1.t
2.j
3.point
4.Java
The output to execute string.ascii_letters can also be obtained from:?
1.character
2.ascii_lowercase_string.digits
3.lowercase_string.upercase
4.ascii_lowercase+string.ascii_upercase
What do we use to define a block of code in Python language?
1. Key
2. Brackets
3.Indentation
4.None of these
What is a recursive function?
1.A function that calls other function.
2. A function which calls itself.
3.Both A and B
4.None of the above
What is a variable defined outside a function referred to as?
1.local variable
2.global variable
3.static Variable
4.automatic variable
What is called when a function is defined inside a class?
1.class
2. function
3.method
4.module
What is the method inside the class in python language?
1.Object
2.Function
3.Attribute
4.Argument
What is the output of the following program? print(chr(ord(chr(97))))
1.a
2.A
3.97
4.error
What is the output of the following program?z = lambda x : x * x print(z(6))
1.6
2.36
3.0
4.error
Where is function defined?
1.Module
2.class
3.Another Function
4.All of the above
Which character is used in Python to make a single line comment?
1./
2.//
3. #
4.!
Which keyword is use for function?
1.define
2.fun
3.def
4.function
Which of the following declarations is incorrect in python language?
1.xyzp = 5,000,000
2.x y z p = 5000 6000 7000 8000
3.x,y,z,p = 5000, 6000, 7000, 8000
4.x_y_z_p = 5,000,000
Which of the following declarations is incorrect?
1. _x = 2
2. __x = 3
3.__xyz__ = 5
4.None of these
Which of the following function headers is correct?
1.def fun(a = 2, b = 3, c)
2.def fun(a = 2, b, c = 3)
3.def fun(a, b = 2, c = 3)
4.def fun(a, b, c = 3, d)
Which of the following functions is a built-in function in python language?
1. val()
2.print()
3.print()
4.None of these
Which of the following is correctly evaluated for this function? pow(x,y,z)
1. (x**y) / z
2. (x / y) * z
3.(x**y) % z
4. (x / y) / z
Which of the following is not a keyword in Python language?
1.val
2. raise
3.try
4.with
Which of the following is the use of id() function in python?
1. Id() returns the size of object.
2.Id() returns the identity of the object.
3.Both A and B
4.None of the above
Which of the following items are present in the function header?
1.function name
2.parameter list
3.return value
4.Both A and B
Which of the following operators is the correct option for power(ab)?
1.a ^ b
2.a**b
3. a ^ ^ b
4. a ^ * b
Which of the following precedence order is correct in Python?
1.Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
2.Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
3.Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
Which of the following statements is correct for variable names in Python language?
1. All variable names must begin with an underscore.
2. Unlimited length
3.The variable name length is a maximum of 2.
4.All of the above
Which of the following statements is correct in this python code? class Name: def __init__(javatpoint): javajavatpoint = java name1=Name("ABC") name2=name1
1.It will throw the error as multiple references to the same object is not possible
2.id(name1) and id(name2) will have same value
3.Both name1 and name2 will have reference to two different objects of class Name
4. All of the above
Which of the following statements is correct regarding the object-oriented programming concept in Python?
1.Classes are real-world entities while objects are not real
2.Objects are real-world entities while classes are not real
3.Both objects and classes are real-world entities
4.All of the above
Which of the following words cannot be a variable in python language?
1. _val
2.val
3.try
4._try_
Which one of the following has the same precedence level?
1.Division, Power, Multiplication, Addition and Subtraction
2.Division and Multiplication
3.Subtraction and Division
4.Power and Division
Which one of the following is incorrect?
1.The variables used inside function are called local variables.
2.The local variables of a particular function can be used inside other functions, but these cannot be used in global space
3.The variables used outside function are called global variables
4.In order to change the value of global variable inside function, keyword global is used.
Which one of the following is the correct extension of the Python file?
1..py
2..python
3..p
4.None of these
Which one of the following is the correct way of calling a function?
1.function_name()
2.call function_name()
3.ret function_name()
4.function function_name()
Which one of the following syntaxes is the correct syntax to read from a simple text file stored in ''d:java.txt''?
1.Infile = open(''d:\java.txt'', ''r'')
2.Infile = open(file=''d:\java.txt'', ''r'')
3.Infile = open(''d:java.txt'',''r'')
4. Infile = open.file(''d:\java.txt'',''r'')
Which operator is used in Python to import modules from packages?
1..
2.*
3.->
4.&
Who developed the Python language?
1.Zim Den
2.Guido van Rossum
3.Niene Stom
4.Wick van Rossum
Why does the name of local variables start with an underscore discouraged?
1.To identify the variable
2.It confuses the interpreter
3.It indicates a private variable of a class
4.None of these