PYTHON FORENSICS QUIZ DESCRIPTION Total Questions −30 00 Max Time − 15:00 Which of the following statements is correct for variable names in Python language? All variable names must begin with an underscore. Unlimited length The variable name length is a maximum of 2. All of the above Study the following program: class Std_Name: def __init__(self, Std_firstName, Std_Phn, Std_lastName): self.Std_firstName = Std_firstName self. Std_PhnStd_Phn = Std_Phn self. Std_lastNameStd_lastName = Std_lastName Std_firstName = “Wick” name = Std_Name(Std_firstName, ‘F’, “Bob”) Std_firstName = “Ann” name.lastName = “Nick” print(name.Std_firstName, name.Std_lastName) What will be the output of this statement? Ann Bob Ann Nick Wick Bob Wick Nick Study the following program: z = “xyz” j = “j” while j in z: print(j, end=” “) What will be the output of this statement? xyz No output x y z j j j j j j j.. Which of the following statements is correct in this python code? class Name: def __init__(javatpoint): javajavatpoint = java name1=Name(“ABC”) name2=name1 It will throw the error as multiple references to the same object is not possible id(name1) and id(name2) will have same value Both name1 and name2 will have reference to two different objects of class Name All of the above Which one of the following has the highest precedence in the expression? Division Subtraction Power Parentheses Which of the following precedence order is correct in Python? Parentheses, Exponential, Multiplication, Division, Addition, Subtraction Multiplication, Division, Addition, Subtraction, Parentheses, Exponential Division, Multiplication, Addition, Subtraction, Parentheses, Exponential Exponential, Parentheses, Multiplication, Division, Addition, Subtraction Study the following code: x = [‘XX’, ‘YY’] for i in a: i.lower() print(a) What will be the output of this program? [‘XX’, ‘YY’] [‘xx’, ‘yy’] [XX, yy] None of these Study the following program: x = ‘pqrs’ for i in range(len(x)): x[i].upper() print (x) Which of the following is the correct output of this program? PQRS pqrs qrs None of these Study the following program: class book: def __init__(a, b): a.o1 = b class child(book): def __init__(a, b): a.o2 = b obj = page(32) print “%d %d” % (obj.o1, obj.o2) Which of the following is the correct output of this program? 32 32 32 32 None Error is generated Study the following function: all([2,4,0,6]) What will be the output of this function? False True 0 Invalid code 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? [‘xy’, ‘yz’] [‘XY’, ‘YZ’] [None, None] None of these Which of the following data types is shown below? L = [2, 54, ‘javatpoint’, 5] What will be the output of this statement? Dictionary Tuple List Stack Which of the following statements is correct regarding the object-oriented programming concept in Python? Classes are real-world entities while objects are not real Objects are real-world entities while classes are not real Both objects and classes are real-world entities All of the above Study the following program: def example(a): aa = a + ‘1’ aa = a*1 return a example(“javatpoint”) What will be the output of this statement? hello2hello2 hello2 Cannot perform mathematical operation on strings indentationError Study the following statement: ”a”+”bc” What will be the output of this statement? a+bc abc a bc a Which one of the following has the same precedence level? Division, Power, Multiplication, Addition and Subtraction Division and Multiplication Subtraction and Division Power and Division Study the following code: ”javatpoint”[5:] What will be the output of this code? javatpoint java point None of these Study the following statements: >>> print(0xA + 0xB + 0xC) What will be the output of this statement? 33 63 0xA + 0xB + 0xC None of these Which one of the following syntaxes is the correct syntax to read from a simple text file stored in ”d:\java.txt”? Infile = open(”d:\java.txt”, ”r”) Infile = open(file=”d:\java.txt”, ”r”) Infile = open(”d:java.txt”,”r”) Infile = open.file(”d:\java.txt”,”r”) Study the following statements: print(ord(‘h’) – ord(‘z’)) What will be the output of this statement? 18 -18 17 -17 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 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 Invalid syntax Why does the name of local variables start with an underscore discouraged? To identify the variable It confuses the interpreter It indicates a private variable of a class None of these Which of the following is not a keyword in Python language? val raise try with Study the following code: >>> print (r”\njavat\npoint”) What will be the output of this statement? java point java point javat point Print the letter r and then javat and then point What is the maximum possible length of an identifier? 16 32 64 None of these above Which of the following operators is the correct option for power(ab)? a ^ b a**b a ^ ^ b a ^ * b Which of the following declarations is incorrect in python language? xyzp = 5,000,000 x y z p = 5000 6000 7000 8000 x,y,z,p = 5000, 6000, 7000, 8000 x_y_z_p = 5,000,000 What is the method inside the class in python language? Object Function Attribute Argument 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? error 2 1 0 3 1 None of these Which of the following declarations is incorrect? _x = 2 __x = 3 __xyz__ = 5 None of these Previous Next Total Question16 Wrong Answer13 Right Answer13