Knowledge check.

- Choose one best answer from given 4 choices for each questions.
- Review before submit as you wont get a chance to review after submit.
- Max Time for quiz is 30 mins and Exam is 90 mins.
- Login is not required for an exam or a quiz.
- By submitting you formally acknowledge and accept terms and conditions mentioned here.

Question Number 1

Give the output of the following code snippet :
>>> myvar = 1.25e-2
>>> myvar

Question Number 2

All the elements that comprise the class are called as :

Question Number 3

Which of the following statements is true about the utility pythondoc in Python?

Question Number 4

Give the output of the following code snippet :
>>> myvar = 0o100
>>> myvar == 64

Question Number 5

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(123)):
	print(Arg + 123)

	
>>> Test(45)

Question Number 6

Which of the following statements are true about Roundup issue Tracker?

Question Number 7

Which attribute can be used to obtain a listing of the individual paths for the system?

Question Number 8

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(23)):
	print(Arg + str(45))

	
>>> Test(10)

Question Number 9

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Hello World Program' and 'Test2.txt' does not exist.

file = open("Test.txt","r")
file2 = open("Test2.txt","r+")
file.seek(8,0)
string = file.read()
file2.write(string)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 10

Give the output of the following code snippet :
print("This is a piece of text which is " +
           "going to appear on multiple lines.")

Question Number 11

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Hello World' and 'Test2.txt' does not exist.

file = open("Test.txt","r")
file2 = open("Test2.txt","r+")
file.seek(8,0)
string = file.read()
file2.write(string)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 12

Which of the following statements is true about the add-on elementtidy?

Question Number 13

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = 100):
	Arg **=2
	Arg //=3
	print(Arg+1)

	
>>> Test(50)

Question Number 14

Which exception is generated when a file that does not exist is accessed?

Question Number 15

Give the output of the following code snippet : Assume the input given in 5.
try 
    value = int(input("Enter number from 1 to 10:"))
except ValueError :
        print("Invalid number")
else:
    if(value > 0 ) and (value <= 10):
        print(value)
    else :
        print("Invalid value")

Question Number 16

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.append("Hello")

for value in List:
    Result += value

print(Result)

Question Number 17

Give the output of the following code snippet:
class MyClass:
    
    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        if(Age > 30):
            self.Age = Age + self.Age
        else:
            self.Age = 20

    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

JohnRecord = MyClass()
AnnaRecord = MyClass()
print(JohnRecord.GetAge())

Question Number 18

Which of the following statements are true about the finally clause?

Question Number 19

Give the output of the following code snippet in the python shell window:
>>> var = 10
>>> var = (~var)
>>> var

Question Number 20

Give the output of the following code snippet:
#!/usr/bin/python

MyTuple = ("Red","Blue")
MyTuple2 = (1,2,3,"Pink")
MyTuple = MyTuple.__add__(("Green",10))
MyTuple = MyTuple.__add__(("Yello",20.5))
print(MyTuple[2]+MyTuple2[3])

Question Number 21

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","w")
file.write("Program")
file.seek(0,0)
string = tell(file)
file.close()
print (string)

Question Number 22

Give the output of the following code snippet:
class MyTest:
    var = 0

NewInst = MyTest()
NewInst2 = MyTest()
NewInst.var = 2
print((NewInst.var +1 ) + (NewInst2.var +1))

Question Number 23

Give the output of the following code snippet:
string = "HelloWorld"
Result = min(string)
print(Result)

Question Number 24

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test2.txt","a+")
file2 = open("Test.txt","a+")
string = file.read()
file2.write(string)
file2.seek(5,0)
string1 = file2.read(5)
file.close()
file2.close()
print (string1)

Question Number 25

Which of the following applies to a key which is created for a dictionary in Python?

Question Number 26

Consider the following snippet. Identify any errors that may have occurred in it.
PRINT("This is an example code");

Question Number 27

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","a")
file.write("Program")
file.close()
file = open("Test.txt","r")
string = file.read()
print (string)

Question Number 28

Which version control product is used for Python?

Question Number 29

Python does not use case sensitive options for command line arguments. State true or false :

Question Number 30

Give the output of the following code snippet :
value = 100

if(value == 100/20):
    print(value)

else:
    print(value + 100)

Question Number 31

Give the output of the following code snippet:
class MyClass:
    def PrintList2(**kwargs):
        for Item in kwargs.items():
            if(count == 'A'):
                print("{0}".format(Item[0]))
            else :
                print("{0}".format(Item[0]+Item[0]))

MyClass.PrintList2(A="Red")
MyClass.PrintList2(A="Green",D="Yellow")

Question Number 32

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.delete(5)

for value in List:
    Result += value

print(Result)

Question Number 33

Which is the following is the correct way to run a python program using command line?

Question Number 34

Give the output of the following code snippet :
import soc
print(socket.gethostbyname("localhost"))

Question Number 35

Give the output of the following code snippet:
string = "This is a test program that is to test string functions"
Result = string.replace("test","new",4)
print(Result)

Question Number 36

Which python product can be used to make unit testing easier?

Question Number 37

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args

    def __add__(self, Other):
        Output = MyClass(self)
        Output.Input = self.Input + Other.Input
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output = Item
        return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = MyClass("Black", "White")
Value = Value2 + Value1 + Value3
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 38

Give the output of the following code snippet:
class MyClass:
    Greeting = ""
    def __init__(self, Name="XYZ"):
        Greeting = Name
    def SayHello(self):
        print("Hello {0}".format(self.Greeting))

MyInst = MyClass()
MyInst.SayHello()

Question Number 39

Give the output of the following code snippet:
class MyClass(Anna):
    def __init__(self,Name = "",Age=0):
        self.Name = Name
        self.Age = Age

    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        self.Age = Age
            
    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

class Anna:
    def __init__(self, Age=0):
        self.Name = "Anna"
        self.Age = Age
        self.Id = 1001
        
    def SetName(self,Name):
        print("Name cannot be changed")
        
    def GetID(self):
        return self.Id
        
JohnRecord = Anna()
JohnRecord.SetAge(30)

Question Number 40

Give the output of the following code snippet:
class MyClass:
    def PrintList1(self,*args):
        for count,Item in enumerate(args):
            if(count == 0):
                print((Item[0]))
                

    def PrintList2(self,**kwargs):
        for count,Item in kwargs.items():
            if(count == 0):
                print(Item[1]+Item[1])
                
List2 = MyClass()
List2.PrintList2(A="Green",B="Yellow")
List2.PrintList1("Red")

Question Number 41

What are the components of an email address?

Question Number 42

Give the output of the following code snippet:
List = ["Hello","World"]*2 + ["!"]*2
Result = 0
List.clear()

for value in List:
        Result += 2
        if(value == '*'):
            Result -= 2
        else :
            Result += 2

print(Result)

Question Number 43

Which of the following statements are true about Mercurial?

Question Number 44

Give the output of the following code snippet:
string = "This is a test program that is to test string functions"
Result = string.index("prog",10,30)
print(Result)

Question Number 45

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args

    def __add__(self, Other):
        Output = MyClass(self)
        Output.Input = self.Input + Other.Input
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output += Item
        return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = MyClass("Black", "White")
Value4 = MyClass("Yellow", "Brown")
Value = Value1 + Value2
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 46

Which are the features offered by Roundup issue Tracker after the additional installations have been made?

Question Number 47

Which of the following errors is caused due to typographical errors made in the Python code?

Question Number 48

Give the output of the following code snippet : Assume the file is present and contains the text 'Hello World'.
import sys

try :
    File = fileopen('Test.txt')
except IOError as e:
    print("Error opening file " + "Error number : {0} ".format(e.errno) +
          "Error text :{0}".format(e.strerror))

else:
    print("File opened")
    File.close()

Question Number 49

Give the output of the following code snippet in the python shell window:
>>> var = 10 ** 2
>>> var

Question Number 50

Give the output of the following code snippet :
value = 5

if(value == (10/2)):
    if(value > 0):
       print(value)
       
elif (value == 10-7):
    print(value - 1)

elif (value == 10+4):
    print(value - 2)
    
elif (value == 10//5):
    print(value + 1)    

    

Question Number 51

Give the output of the following code snippet in the python shell window:
>>> def Fun(Arg = "No value"):
	print(Arg)

>>> Fun(Hello World)

Question Number 52

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.

file = open("Test.txt","a")
file2 = open("Test2.txt","a")
string = file.read()
file2.write(string)
file2.seek(0,0)
string1 = file2.read()
file.close()
file2.close()
print (string1)

Question Number 53

Give the output of the following code snippet:
#!/usr/bin/python

DList = ["A": "Blue", "B": "Red"]
print(DList["A"])

Question Number 54

Give the output of the following code snippet :
>>> myComplex = 3 + 2j
>>> myComplex

Question Number 55

While defining a custom exception class, which function can be used to create a new instance for the class?

Question Number 56

Which command is used to convert a numeric value to octal in Python?

Question Number 57

Give the output of the following code snippet:
string = "1234 WORLD"
Result = string.isnumeric()
print(Result)

Question Number 58

Give the output of the following code snippet :
>>> myvar = 0b101
>>> myvar

Question Number 59

Give the output of the following code snippet:
class MyClass:
    def __init__(self,Age=0):
        self.Age = Age

    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        if(Age > 30):
            self.Age = Age + self.Age
        else:
            self.Age = 20

    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

JohnRecord = MyClass()
JohnRecord.SetAge()
AnnaRecord = MyClass()
print(JohnRecord.GetAge())

Question Number 60

Which testing stage is associated with verifying that your application meets user needs and will react to user input in the way the user expects?

Question Number 61

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test2.txt","r+")
file2 = open("Test3.txt","w+")
string = file.read()
file2.write(string)
file2.seek(10,0)
string1 = file2.read(10)
file.close()
file2.close()
print (string1)

Question Number 62

Which of the following statements is true about the os._exit() command in python?

Question Number 63

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","w+")
file.write("Program")
string = file.read()
print (string)

Question Number 64

Give the output of the following code snippet:
List = [1,2,'Three',4.5]
print((List[0:1] +(List[:3]))(1))

Question Number 65

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args

    def __add__(self, Other):
        Output = MyClass()
        Output.Input = self.Input + self.Input
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output += Item
        return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = MyClass("Black", "White")
Value = Value1 + Value2 + Value3
print("{0} + {1} = {2}".format(Value1, Value2, Value))

Question Number 66

Which of the following commands can be used to convert a string to a number?

Question Number 67

To uncomment multiple lines of code at one, highlight those lines and select :

Question Number 68

Give the output of the following code snippet :
print("Red " +
#           "Yellow" +
           "Blue")

Question Number 69

Give the output of the following code snippet:
#!/usr/bin/python

MyTuple = ("Red","Blue")
MyTuple2 = (1,2,3,("Pink","Brown"))
MyTuple = MyTuple.__add__(("Green",10))
MyTuple = MyTuple.__add__(("Yello",20.5))
print(MyTuple[2]+MyTuple2[3])

Question Number 70

Which of the following statements is true about the utility squeeze in Python?

Question Number 71

Give the output of the following code snippet:
#!/usr/bin/python

DList = {"B": 10, "B": 20,"C1" : 30}
DList2 = {"A": 5,"B" : 40}
DList3 = {"C": 50, "C": 60}

DList.update({"C1" : 50})
print(DList["B"]+ DList["C1"])

Question Number 72

Give the output of the following code snippet : Assume the input given in 'Hello'.
try :
    value = int(input("Enter value from 1 to 50:"))
except (ValueErr, KeyboardInterrupt):
        print("Invalid")
else :
    if(value > 0 ) and (value <= 50):
        print(value)
    else :
        print(0)

Question Number 73

Give the output of the following code snippet:
var = 1

for Arg in str(var):
    var += 1
print(var)

Question Number 74

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(123)):
	print(Arg)

	
>>> Test(Hello)

Question Number 75

Give the output of the following code snippet in the python shell window:
>>> var = 0
>>> if var == (10 > 20):
	print(var + 20)

Question Number 76

Give the output of the following code snippet :
>>> myint = str("123") + str("234")
>>> myint

Question Number 77

Give the output of the following code snippet :
>>> myvar = 0o16
>>> hex(myvar)

Question Number 78

Give the output of the following code snippet in the python shell window:
>>> def TestFun():
	print("Hello")
	
>>> def TestFun2():
	print("World")

>>> TestFun2("Hello") 

Question Number 79

Give the output of the following code snippet:
string = "Hello World"
Result = string.rjust(15,"*")
print(Result)

Question Number 80

Give the output of the following code snippet : Assume the inputs given for value1 = 10 and value2 = 20.
try :
    value1 = int(input("Enter first value:"))
    value2 = int(input("Enter second value:"))
    Result = value1/value2
except (ValueError):
        print("Enter whole number")
except (KeyboardInterrupt):
        print("Interrupt detected")
except (ArithmeticError):
        print("Undefined Math error")
except (ZeroDivisionError):
        print("Cannot divide by zero")
else :
        print(Result)

Question Number 81

Give the output of the following code snippet : Assume the input given in 40.
try :
    value = int(input("Enter value from 1 to 50:"))
except:
        print("Invalid")
else :
    if(value > 0 ) and (value <= 50):
        print(value)
    else :
        print(0)

Question Number 82

Give the output of the following code snippet in the python shell window:
>>> def Test(Count,*ArgList):
	for Arg in ArgList:
		print(Arg)

		
>>> Test(2,"Hello")

Question Number 83

Which of the following statements is true about the os._exit() command in python?

Question Number 84

Which colour in the Python IDLE indicates that you have typed a command?

Question Number 85

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test.txt","r+")
file3 = open("Test2.txt","w+")
string = file.read(5)
file3.write(string)
file3.seek(0,0)
string1 = file3.read(5)
file.close()
file3.close()
print (string1)

Question Number 86

The date and time obtained can be converted to a more readable format using which command?

Question Number 87

Which of the following applies to a key which is created for a dictionary in Python?

Question Number 88

Give the output of the following code snippet:
var = 0
string = "Hello"

for Arg in string:
    if(Arg == 'o'):
        var +=2
else :
    var -=1
print(var)

Question Number 89

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","w")
file.seek(10,1)
string = file.tell()
file.write("Program")
file.close()
print (string)

Question Number 90

Which of the following is an example of a product used to provide Python applications with GUI?

Question Number 91

Give the output of the following code snippet in the python shell window:
>>> var = 0
>>> if var = (10 != 20):
	print(var + 20)

Question Number 92

Give the output of the following code snippet in the python shell window:
>>> def TestFun(Arg):
	ret(Arg+1)

>>> TestFun(1)

Question Number 93

Which of the following environment variables is used to define the file name to execute when python starts?

Question Number 94

Give the output of the following code snippet : Assume the input given in 5.
try :
    value = int(input("Enter number from 1 to 10:"))
except ValueError 
        print("Invalid number")
else:
    if(value > 0 ) and (value <= 10):
        print(value)
    else :
        print("Invalid value")

Question Number 95

Give the output of the following code snippet:
var = 1

while (var <= (10//2)):
       pass
       var += 2
else:
    pass
    var -= 1
    
print(var)

Question Number 96

Which of the following statements are true about the finally clause?

Question Number 97

Give the output of the following code snippet:
class MyTest :
    var = 0

NewInst = MyTest()
print(NewInst.var + 1)

Question Number 98

Give the output of the following code snippet :
>>> myvar = 0o100
>>> myvar

Question Number 99

Give the output of the following code snippet :
value = 5

if(value == (10/3)):
    if(value > 0):
       value -= 1
       print(value)
       
elif (value == 10-5):
    print(value + 1)

elif (value == 10/2):
    print(value - 2)
    
    

Question Number 100

Which module is required to access the MIME module while composing an email?

Question Number 101

Give the output of the following code snippet in the python shell window:
>>> var = 10 & 20 ^ 30 >> 2
>>> var

Question Number 102

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.

file = open("Test.txt","a+")
file2 = open("Test2.txt","w")
file.seek(5,0)
string = file.read()
file2.write(string)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 103

Which of the following statements are true regarding custom exceptions?

Question Number 104

Which method of a file object flushes any unwritten information and closes the file object?

Question Number 105

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.clear()

for value in List:
    Result += value

print(Result)

Question Number 106

Give the output of the following code snippet:
class MyClass:
    age = 0
    def __init__(self,age = 10):
        self.age = age + 20
    def Greet(self):
        print("Hello")   
    def PrintAge(self):
        print(self.age)    

MyClass.age = 10
MyInit = MyClass()
MyInit.PrintAge()

Question Number 107

Consider the seek(offset, from) method used to change the current file position. What is the value to be given for 'from' to use the current position of the pointer as the reference position?

Question Number 108

The finding of geographic coordinates, such as longitude and latitude from geographic data, such as address, is known as :

Question Number 109

Give the output of the following code snippet in the python shell window:
>>> def TestFun(Arg = 10):
	return(Arg+1,Arg+2)

>>> TestFun( 1 != 0)

Question Number 110

Give the output of the following code snippet : Assume the file is present and contains the text 'Hello World'.
import sys

try :
    File = open('Test.txt')
except IOError as e:
    print("Error opening file " + "Error number : {0} ".format(e.errno) +
          "Error text :{0}".format(e.strerror))

else:
    print("File opened")
    File.close()

Question Number 111

Which of the following acts as a specific entryway for a server location?

Question Number 112

Give the importance of the -h command line option in python :

Question Number 113

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.remove(5)

for value in List:
    Result += value

print(Result)

Question Number 114

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test.txt","r+")
file2 = open("Test3.txt","a+")
string = file.read()
file2.write(string)
file2.seek(1,0)
string1 = file2.read()
string = file2.tell()
file.close()
file2.close()
print (string1)

Question Number 115

Which MIME form contains an image file?

Question Number 116

Give the output of the following code snippet : Assume the file is not present.
import sys

try :
    File = open('Test.txt')
except IOError as e:
    for Arg in e:
        print(Arg)

else:
    print("File opened")
    File.close()

Question Number 117

Give the output of the following code snippet in the python shell window:
>>> def TestFun():
	print("Hello")
	
>>> def TestFun2():
	print("World")

>>> TestFun() TestFun2()

Question Number 118

Give the output of the following code snippet :
>>> myInt = float("5678") + int("24")
>>> myInt

Question Number 119

What are the components of an email address?

Question Number 120

Give the output of the following code snippet:
## LibTest.py
def SayHello():
    print("Hello")
    return

def SayAge(Age):
    print("Age : ", Age + 10)
    return

>>> from LibTest import SayHello
>>> LibTest.SayHello()

Question Number 121

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args[0]

    def __add__(self, Other):
        Output = MyClass(self)
        Output.Input = self.Input + Other.Input
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output += Item
            Output += " "
            return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = Value1 + Value2
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 122

Which of the following is true about the library tkinter3000?

Question Number 123

Give the output of the following code snippet in the python shell window:
>>> var = 10
>>> if var == (10 > 20):
	print(var + 20)

Question Number 124

Which product serves to interact with both the RDBMS and the SQL?

Question Number 125

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(23)):
	print(Arg + str(45))

	
>>> Test(str(10))

Question Number 126

Give the output of the following code snippet :
value = 100

if(value >= 100//22 ):
    print(value)

else:
    print(value + 100)

Question Number 127

Give the output of the following code snippet:
from collections import Counter 

List = [1,2,4,5] + [11,10]
Result = 0
List2 = List.copy()
List2.reverse()
List3 = List+ List2

ListCount= Counter(List3)
print((ListCount.get(1))+(ListCount.get("Hello")))

Question Number 128

Give the output of the following code snippet :
>>> myInt = int("5678") + int("24")
>>> myInt

Question Number 129

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.

file = open("Test.txt","a")
file2 = open("Test2.txt","w")
file.seek(5,0)
string = file.read()
file2.write(string)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 130

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt")
print (file.read())

Question Number 131

Give the output of the following code snippet:
## LibTest.py
def SayHello(Name):
    print("Hello",Name)
    return

def SayAge(Age):
    print("Age : ", Age + 10)
    return

>>> import LibTest
>>> LibTest.SayAge()

Question Number 132

Give the output of the following code snippet:
var = 0
string = "Hello"

for Arg in string:
    if(Arg == 'o'):
        var += 2
        break
    elif (var != 1):
        var -=1
print(var)

Question Number 133

Give the output of the following code snippet:
class MyClass:
    def __init__(self,Name = "",Age=0):
        self.Name = Name
        self.Age = Age

    def GetName(self):
        return self.Name

    def SetName(self, Name):
        self.Name = Name    
    
    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        if(Age > 30):
            self.Age = Age + self.Age
        else:
            self.Age = 20
            
    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

class Anna(MyClass):
    def __init__(self,Name = "X", Age=0):
        self.Name = Name
        self.Age = Age
        self.Id = 1001

    def GetID(self):
        return self.Id
        
JohnRecord = MyClass()
AnnaRecord = Anna()
print(AnnaRecord)

Question Number 134

Give the output of the following code snippet:
string = "1234 World"
Result = string.isdigit()
print(Result)

Question Number 135

Give the output of the following code snippet:
from collections import Counter

List = [1,2,4,5] + [11,10]
Result = 0
List2 = List.copy()
List2.reverse()
List3 = List+ List2

ListCount= Counter(List3)
print(ListCount.get(3))

Question Number 136

Give the output of the following code snippet:
string = "This is a test program that is to test string functions"
Result = string.search("prog")
print(Result)

Question Number 137

The output of the application is displayed in which window?

Question Number 138

Which of the following are built in Python exception categories that the user regularly works with?

Question Number 139

Which window automatically indents some types of text?

Question Number 140

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(123)+ str(45)):
	print(str(123)+Arg)

	
>>> Test()

Question Number 141

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test2.txt","r")
file2 = open("Test3.txt","w+")
string = file.read()
file2.write(string)
file2.seek(5,0)
string1 = file2.read()
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 142

Give the output of the following code snippet:
List = ["Hello","World"] + ["!"]
Result = 0
List.pop(1)

for value in List[1]:
        Result += 2
        if(value == 'o'):
            Result -= 2
        else :
            Result += 2

print(Result)

Question Number 143

Which of the following is a method for making simple modifications to callable objects?

Question Number 144

Give the output of the following code snippet :
>>> myvar = 0b100
>>> myvar == 100

Question Number 145

Give the output of the following code snippet:
## LibTest.py
def SayHello():
    print("Hello")
    PrintAge(10)
    return

def PrintAge(Age):
    print(Age + 10)
    return 

>>> import LibTest
>>> PrintAge()

Question Number 146

Give the output of the following code snippet:
var = 0
string = "Hello World"

for Arg in string:
    if(Arg == ''):
        var +=2
if( Arg == 'd'):
    pass
    var -= 5

else :
    var += 5
print(var)

Question Number 147

Give the output of the following code snippet :
value = 10

if(value != ~(10//5)):
    value //= 4
    print(value)

else :
    print (value+1)

Question Number 148

Which of the following functions are true regarding the split() string function in Python?

Question Number 149

Give the output of the following code snippet:
## LibTest.py
def SayHello():
    print("Hello")
    PrintAge(10)
    return

def PrintAge(Age):
    print(Age + 10)
    return 

>>> from LibTest import SayHello,SayAge
>>> SayHello()

Question Number 150

What does the color Green in the Python IDLE indicate?

Question Number 151

Give the output of the following code snippet in the python shell window:
>>> def TestFun(Arg):
	return(Arg+1,Arg+2)

>>> TestFun(2)

Question Number 152

Give the output of the following code snippet:
var = 0
string = "Hello"

for Arg in string:
    if(Arg == 'l'):
        var +=2
        continue
        print(string)
        
    else:
        var -=1
print(var)

Question Number 153

Give the output of the following code snippet:
List = [1,2,3,4] + [11,10,9,8]
Result = 0
List2 = List.copy()
List2.append("!")
List.sort() 
print(List)

Question Number 154

Give the output of the following code snippet:
class MyClass:
    age = 0
    def __init__(self,age = 10):
        self.age = age + 20
    def PrintAge(self):
        print(self.age)
    def Greet(self):
        print("Hello")    

MyInst = MyClass(10)
MyInst.Greet()

Question Number 155

Give the output of the following code snippet :
>>> myvar = 0o16
>>> binary(myvar)

Question Number 156

Give the output of the following code snippet:
class MyClass:
    def __init__(self,Name = "",Age=0):
        self.Name = Name
        self.Age = Age

    def GetName(self):
        return self.Name

    def SetName(self, Name):
        self.Name = Name    
    
    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        self.Age = Age
            
    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

class Anna(MyClass):
    def __init__(self,Name = "X", Age=0):
        self.Name = Name
        self.Age = Age
        self.Id = 1001

    def GetID(self):
        return self.Id
        
JohnRecord = MyClass()
AnnaRecord = Anna("Anna")
print(AnnaRecord.GetAge())

Question Number 157

Give the output of the following code snippet : Assume the input given in 100.
try :
    value =(input("Enter a string : "))
except:
        print("Invalid")
else :
    if(value == "Hello"):
        print(value)
    else :
        print(0)

Question Number 158

Which value determines how long a port stays open waiting for a response so that the application doesn't have to continuously re-create the connection?

Question Number 159

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test.txt","r+")
file2 = open("Test2.txt","w+")
file3 = open("Test3.txt","w+")
string = file.read()
file3.seek(0,2)
file3.write(string)
string = file2.read()
file3.seek(0,2)
file3.write(string)
val = file3.tell()

file.close()
file2.close()
file3.close()
print (val)

Question Number 160

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.insert(5,1)

for value in List:
    Result += value

print(List[3])

Question Number 161

Give the output of the following code snippet:
List = ["Hello","World"]*2 + ["!"]*2
Result = 0

for value in List:
        Result += 1
        if(value == '!'):
            Result -= 2
        else :
            Result += 2
            
List2 = (List.copy()) + ["!"])* 2
print(len(List2))

Question Number 162

Give the output of the following code snippet in the python shell window:
>>> var = not 50
>>> var

Question Number 163

Give the output of the following code snippet : Assume the inputs given for value1 = 10 and value2 = 0.
try :
    value1 = int(input("Enter first value:"))
    value2 = int(input("Enter second value:"))
    Result = value1/value2
except (ValueError):
        print("Enter whole number")
except (KeyboardInterrupt):
        print("Interrupt detected")
except (ArithmeticError):
        print("Undefined Math error")
except (ZeroDivisionError):
        print("Cannot divide by zero")
else :
        print(Result)

Question Number 164

Which of the following arithmetic operators in python is used to calculate the exponential value of the right operand by the left operand?

Question Number 165

Which command line options is used to tell python not to print the version and copyright messages on inter-active startup?

Question Number 166

Which of the following is used to indicate a multiline comment?

Question Number 167

Give the output of the following code snippet:
var = 0

for Arg in range(1,5):
        var += 5
else:
        var //= 2
print(var)

Question Number 168

Give the output of the following code snippet : Assume the file is not present
import sys

try :
    File = open('Test.txt')
except IOError as e:
    print("Error opening file " + "Error number : {0} ".format(e.errno) +
          "Error text :{0}".format(e.strerror))

else:
    print("File opened")
    File.close()

Question Number 169

Give the output of the following code snippet :
>>> myvar = 0x10
>>> bin(var)

Question Number 170

Which of the following statements is true about the add-on celementtree?

Question Number 171

Name a technique for creating specialized versions of simple functions that derive from more complex functions :

Question Number 172

Which of the following is a valid option for the arg option in -w arg command line argument?

Question Number 173

Which of the following clauses can be used to break out of a loop?

Question Number 174

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = 25):
	Arg **=2
	Arg //=3
	print(Arg+1)

	
>>> Test()

Question Number 175

The celementtree is an add-on to which library that makes working with XML data more efficient and faster?

Question Number 176

Which of the given files is an executable Python file?

Question Number 177

Give the output of the following code snippet:
Formatted = "(:*>8X)"
print(Formatted.format(1000))

Question Number 178

Which library is used to build a search mechanism into the application so that files can be searched and retrieved easily?

Question Number 179

Give the output of the following code snippet in the python shell window:
>>> var = 10
>>> if ( var == 20 or var == 10)
	print(100)

Question Number 180

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test2.txt","r+")
file2 = open("Test3.txt","a+")
string = file.read()
file2.write(string)
file2.seek(5,0)
string1 = file2.read(5)
file.close()
file2.close()
print (string1)

Question Number 181

Give the output of the following code snippet :
>>> myvar = 0b100
>>> myvar == 4

Question Number 182

Give the output of the command given in the shell window if the file Test.py contains the following line of code : print("Hello World")
>>> exec(open("c:\\Test.py").read)

Question Number 183

Give the output of the following code snippet:
## LibTest.py
def SayHello(Name):
    print("Hello",Name)
    return

def SayAge(Age):
    print("Age : ", Age + 10)
    return

>>> import LibTest
>>> LibTest.SayAge(10.5)

Question Number 184

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test.txt","r+")
file3 = open("Test2.txt","w+")
string = file.read()
file3.write(string)
file3.seek(0,0)
string1 = file3.read()
file.close()
file3.close()
print (string1)

Question Number 185

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.

file = open("Test.txt","r+")
file2 = open("Test2.txt","a+")
string = file.read(6)
file2.write(string)
file2.seek(0,0)
string1 = file2.read(5)
file.close()
file2.close()
print (string1)

Question Number 186

Give the output of the following code snippet:
var = 1

for Arg in range(1,10):
    if(Arg != (10%3)):
        var += 2
        break
    elif (Arg != (20%3)):
        var **= 2
print(Arg)

Question Number 187

Give the output of the following code snippet:
class MyClass:
    def PrintList1(**kwargs):
        for count,Item in kwargs.list():
            print("{0}. {1}".format(count,Item))

MyClass.PrintList1(A="Red",B="Blue")

Question Number 188

Which of the following statements are true about lists in Python?

Question Number 189

Which of the following statements is true regarding compile time errors?

Question Number 190

Which argument is provided to the methods so that it takes a variable list of arguments?

Question Number 191

Which of the following operators raises an error in the current versions of python?

Question Number 192

Give the output of the following code snippet in the python shell window:
>>> var = 100
>>> var //=11
>>> var

Question Number 193

For the open() function to access a file, what is the action taken if the buffering value is set to 0?

Question Number 194

Which exception is generated by Python when user presses an interrupt key(such as Delete or Ctrl + c)?

Question Number 195

Which documentation shows how the application works?

Question Number 196

Give the output of the following code snippet:
List = [1,2,4,5.5]
Result = 0
List.append(10)

for value in List:
    Result += value
    if(Result > 0):
        Result += 1 

print(Result)

Question Number 197

Give the output of the following code snippet :
>>> myint = str("123") + int("234")
>>>myint

Question Number 198

Give the output of the following code snippet in the python shell window:
>>> def Test(Arg = str(123)):
	print(Arg)

	
>>> Test()

Question Number 199

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","a+")
file.write("Program")
file.seek(0,0)
string = file.read(5)
file.close()
print (string)

Question Number 200

Which of the following statements is true regarding the from…import statement?

Question Number 201

Which of the following statements are true about dictionaries in Python?

Question Number 202

Give the output of the following code snippet:
string = "Hello World"
print(string[0 = 3])

Question Number 203

Give the output of the following code snippet in the python shell window:
>>> var = not 0 + (10 and 20)
>>> var

Question Number 204

Give the output of the following code snippet:
List = [1,2,4,5.5,7,8.25]
Result = 0
List.clear()
List.append(10.5)

for value in List:
    if(value % 2 == 0):
        Result -= 1
    else:
        Result +=1

print(len(List))

Question Number 205

Give the output of the following code snippet :
import sys

try :
##    raise ValueError
    print("Begin Test")
except (ValueError):
        sys.exit()

finally:
    print("Hello")

print("End")

Question Number 206

Give the output of the following code snippet:
## LibTest.py
def SayHello():
    print("Hello")
    PrintAge(10)
    return

def PrintAge(Age):
    print(Age + 10)
    return 

>>> from LibTest import SayHello :
>>> SayHello()

Question Number 207

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args

    def __add__(self, Other):
        Output = MyClass(self)
        Output.Input = self.Input + Other.Input
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output += Item
        return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = MyClass("Black", "White")
Value4 = MyClass("Yellow", "Brown")
Value = Value1 + Value2 + Value3
print("{0} + {1} = {2}".format(Value1, Value2, Value))

Question Number 208

Give the output of the following code snippet in the python shell window:
>>> var = 10
>>> if ( var == 20 && var == 10):
	print(100)

Question Number 209

The finally clause is always executed even if the exception is not raised. State true or false

Question Number 210

Give the output of the following code snippet:
 class MyClass:
    def __init__(self,Age):
        self.Age = Age

    def GetName(self):
        return self.Name

    def SetName(self, Name):
        self.Name = Name

    def GetAge(self):
        return self.Age

    def SetAge(self):
        self.Age = 10

    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

JohnRecord = MyClass(50)
JohnRecord.SetAge()
AnnaRecord = MyClass(44)
print(AnnaRecord.GetAge())

Question Number 211

Give the output of the following code snippet :
>>> myvar = 0x152
>>> myvar

Question Number 212

Which of the following statements is true regarding run time errors?

Question Number 213

Give the output of the following lines of code executed in the python shell window :
>>> var = 5
>>>myvar = 0
>>>myvar == var

Question Number 214

Which attribute is used internally by the import system to make is easier to load and manage modules?

Question Number 215

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.

file = open("Test.txt","r")
file2 = open("Test2.txt","w")
file.seek(0,0)
string = file.read()
file2.write(string)
string1 = file2.read()
file.close()
file2.close()
print (string1)

Question Number 216

Give the output of the following code snippet :
value = 10

if(value >= 10//8 ):
    print(value **2)

else:
    print(value + 10)

    

Question Number 217

Give the output of the following code snippet :
>>> myvar = 0x152
>>> myvar == 338

Question Number 218

Give the output of the following code snippet : Assume the input given in Hello.
try :
    value =float(input("Enter value from 1 to 50:"))
except:
        print("Invalid")
else :
    if(value > 0.0 ) and (value <= 50.5):        
        print(value)
    else :
        print(0)

Question Number 219

Which of the following statements are true about dictionaries in Python?

Question Number 220

Give the output of the following code snippet:
List = [1,2,'Three',4.5]:
print(List[0])

Question Number 221

Which of the following statements are true about constructors in Python?

Question Number 222

Which is the standard hostname?

Question Number 223

Give the output of the following code snippet : The contents of the file is a string 'Hello World'

file = open("Test.txt","a+")
file.write("Program")
file.seek(1,1)
string = file.read()
file.close()
print (string)

Question Number 224

Which command is used to convert a numeric value to hexadecimal in Python?

Question Number 225

What are the key components of the server side for which the tutorials are provided for?

Question Number 226

Give the output of the following code snippet:
string = "Hello World Program"
Result = string.split("#")
print(Result)

Question Number 227

Give the importance of the command line option -u in python :

Question Number 228

Which of the following errors occur due to incorrect implementation of the code?

Question Number 229

Give the output of the following code snippet:
class MyClass:
    def __init__(self, *args):
        self.Input = args

    def __add__(self, Other):
        Output = MyClass()
        Output.Input = self.Input + self.Input
        break
        return Output

    def __str__(self):
        Output = ""
        for Item in self.Input:
            Output += Item
        return Output
        
Value1 = MyClass("Red", "Green")
Value2 = MyClass("Blue", "Purple")
Value3 = MyClass("Black", "White")
Value4 = MyClass("Yellow", "Brown")
Value = Value1 + Value2 + Value3
print("{0} + {1} = {2}".format(Value1, Value2, Value))

Question Number 230

Give the output of the following code snippet:
var = 0
string = "Hello World"

for Arg in string:
    if(Arg == 'o' or Arg = 'l'):
        var += 2
    else :
        var -=1
print(var)

Question Number 231

Which of the following is true about the library elementtree?

Question Number 232

What is the act of keeping track of the changes that occur in an application between application releases to the production environment?

Question Number 233

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' , 'Test2.txt' contains the string ' Green Yellow' and 'Test3.txt' contains the string ' Black White'.
file = open("Test.txt","r+")
file2 = open("Test2.txt","r+")
file3 = open("Test3.txt","a+")
string = file.read()
file3.seek(0,2)
file3.write(string)
string = file2.read()
file3.seek(0,2)
file3.write(string)
file3.seek(10,0)
string3 = file3.read(5)

file.close()
file2.close()
file3.close()
print (string3)

Question Number 234

Give the output of the following code snippet in the python shell window:
>>> def TestFun(Arg = 10):
	return(Arg+1,Arg+2)

>>> TestFun(str(123))

Question Number 235

Which of the following statements are true about the Python IDLE?

Question Number 236

Which command line option of python doesn’t run 'import site' on initialization?

Question Number 237

Which of the following list functions adds an entry to the end of the list?

Question Number 238

Which symbol is used to concatenating multiple lines of text in a python code?

Question Number 239

Give the output of the following code snippet in the python shell window:
>>> def Test(*ArgList):
	for Arg in ArgList:
		print(Arg)

		
>>> Test(1,2)

Question Number 240

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Red Blue' and 'Test2.txt' contains the string ' Green Yellow'.
file = open("Test.txt","w+")
file2 = open("Test2.txt","w+")
string = file.read()
file2.write(string)
file2.seek(0,0)
string1 = file2.read()
file.close()
file2.close()
print (string1)

Question Number 241

Give the output of the following code snippet:
class MyClass:
    def __init__(self,Name = "",Age=0):
        self.Name = Name
        self.Age = Age

    def GetAge(self):
        return self.Age

    def SetAge(self,Age):
        self.Age = Age
            
    def __str__(self):
        return "{0} is aged {1}.".format(self.Name,self.Age)

class Anna(MyClass):
    def __init__(self,Name = "X", Age=0):
        self.Name = Name
        self.Age = Age
        self.Id = 1001

    def GetID(self):
        return self.Id
        
JohnRecord = MyClass()
JohnRecord.GetID()
print(JohnRecord)

Question Number 242

Which of the following unary operators in python is used to same value which is given as input?

Question Number 243

Which of the following errors is caused due to incorrect definition of the code by the developer?

Question Number 244

What are the following topics provided by W3Schools in order to study and understand XML?

Question Number 245

Which of the following commands is used to obtain the host name for a host address?

Question Number 246

Give the output of the following code snippet:
#!/usr/bin/python

MyTuple = ("Red","Blue")
MyTuple = MyTuple.__add__(("Green",10))
MyTuple = MyTuple.__add__(("Yellow",20.5))
print(MyTuple[3])

Question Number 247

Which of the following statements are true about the finally clause?

Question Number 248

Give the output of the following code snippet : The contents of the file 'Test.txt' is a string 'Hello World' and 'Test2.txt' does not exist.

file = open("Test.txt","r")
file2 = open("Test2.txt","w+")
file.seek(5,0)
string = file.read()
file2.write(string)
file2.seek(0,0)
string = file2.read()
file.close()
file2.close()
print (string)

Question Number 249

Give the output of the following code snippet : Assume the inputs given for value1 = 10 and value2 = 'Hello'
try :
    value1 = int(input("Enter first value:"))
    value2 = int(input("Enter second value:"))
    Result = value1/value2
except (ValueError):
        print("Enter whole number")
except (KeyboardInterrupt):
        print("Interrupt detected")
except (ZeroDivisionError):
        print("Cannot divide by zero")
except (ArithmeticError):
        print("Undefined Math error")
else :
        print(Result)

Question Number 250

Which method provides the means to determine how a particular port is used?

Question Number 251

Give the output of the following code snippet in the python shell window:
>>> var = 100 and 50 or 20
>>> var

Question Number 252

Give the output of the following code snippet : Assume the name of the host machine is 'Main'.
import socket
print(socket.gethostbyaddr("127.0.0.1")[2])

Question Number 253

Which of the following statements is true about the Body part of the email?

Question Number 254

Give the output of the following code snippet :
>>> myvar = 0b100
>>> myvar -= 0b001
>>> myvar

Question Number 255

Which of the following statements are true about databases?