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

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

Question Number 2

Give the output of the following code snippet:
List = [1,2,'Three',4,5.5]
Result = 0

for value in List:
    Result += List

print(Result)

Question Number 3

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

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

Question Number 4

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 5

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

Question Number 6

Which of the following is true about the library grabscreen?

Question Number 7

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

Question Number 8

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

Question Number 9

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 10

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

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

else:
    print(value + 100)

Question Number 11

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

Question Number 12

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

Question Number 13

What does the color Blue in the Python IDLE indicate?

Question Number 14

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 15

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

Question Number 16

Which of the following clauses ends the processing of the current element after completing the statements in the if block?

Question Number 17

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

Question Number 18

Which method can be used to get information about both host address and port information?

Question Number 19

Which of the following statements are true about IPython?

Question Number 20

Which of the following list functions adds an entry to a specific position in the list?

Question Number 21

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

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

Question Number 22

Which of the following options is used to start the debugger?

Question Number 23

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

Question Number 24

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:
    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 25

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

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

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

Question Number 26

Which of the following exit commands provides special error-handling features?

Question Number 27

What are the features of the python debugger?

Question Number 28

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 (ValueError, KeyboardInterrupt):
        print("Invalid")
else :
    if(value > 0 ) and (value <= 50):
        print(value)
    else :
        print(0)

Question Number 29

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

for Arg in range(1,10):
        var += 2
else:
        var **= 2
print(Arg)

Question Number 30

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

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

Question Number 31

Which of the following are basic features of a Python IDLE?

Question Number 32

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

Question Number 33

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 = file.read()
file.close()
print (string)

Question Number 34

Which of the following options places python in verbose mode to see all import statements?

Question Number 35

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

while (var != 10):
    var += 1
    break
else :
    var += 2
print(var)

Question Number 36

Give the output of the following code snippet in the python shell window:
>>> var = ~1 + ~2
>>> var

Question Number 37

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

Question Number 38

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

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

Question Number 39

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

Question Number 40

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,10,20)

Question Number 41

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

Question Number 42

Which python utility can be used to sort and clean the python code?

Question Number 43

Which is the readable form of the combination of the host and the port?

Question Number 44

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 45

Give the output of the following code snippet :
>>> myvar = 10
>>> oct(myvar)

Question Number 46

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

for value in List:
        Result += 1

print((List[0]))

Question Number 47

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

Question Number 48

Give the output of the following code snippet : Assume the input given in 5.
try :
    value = int(input("Enter value:"))
except ValueError:
        print("Invalid")
else :
    if(value %2 == 0 ):
        print(value)

Question Number 49

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

>>>Test(1)

Question Number 50

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 51

Which of the following statements are true regarding Tuples in Python?

Question Number 52

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 53

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

for value in List:
    Result += value
    List.append(3)
    break

print(Result)

Question Number 54

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

Question Number 55

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

Question Number 56

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

for Arg in range(1,3):
    if(Arg == 2):
        break
        var += 5

print(var)

Question Number 57

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,1)
file3.write(string)
string = file2.read()
file3.seek(0,0)
file3.write(string)
val = file3.tell()

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

Question Number 58

Give the output of the following code snippet:
string = "Hello World"
Result = string.fill(12)
Result1 = Result.center(15,"*")
Result2 = Result.lower()
print(Result2)

Question Number 59

Give the output of the following code snippet in the python shell window:
>>> define Test :
        print("Hello")

>>>Test()

Question Number 60

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

	
>>> Test()

Question Number 61

Which of the following is a library for working with FTP sites?

Question Number 62

Which port is dedicated to SMTP support on any server?

Question Number 63

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

MyTuple = {"Red","Blue"}
MyTuple = MyTuple.__add__((20,10))
print(MyTuple)

Question Number 64

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

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
        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 66

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:
    for Arg in e.args:
        print(Arg)

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

Question Number 67

Which letter is used to indicate that the base of the number is 16 in Python?

Question Number 68

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

Question Number 69

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

Question Number 70

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(10,0)
string = file.tell()
file.close()
print (string)

Question Number 71

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

Question Number 72

Which option in the File menu is used to close the current window and its associated windows?

Question Number 73

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

Question Number 74

Which of the following command line options in python are used to perform optimization?

Question Number 75

Give the output of the following code snippet in the python shell window:
>>> var = !100 && 0
>>> var

Question Number 76

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

>>> TestFun(5)

Question Number 77

Give the output of the following code snippet : Assume the input given in 100.
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 78

Give the output of the following code snippet:
List = [1,2,'Three',4,5.5]
Result = 0

for value in List:
    Result += int(List[value])

print(Result)

Question Number 79

Which of the following logical operators in python is used to determine if one of the operators is true?

Question Number 80

Give the output of the following code snippet : Assume the input given in 11.
try :
    value = int(input("Enter value:"))
except ValueError:
        print("Invalid")
else :
    if(value %2 == 0 ):
        print(value)
    else :
        print(0)

Question Number 81

Give the output of the following code snippet:
string = "Hello\nWorld Program\n"
Result = string.splitlines()
print(Result)

Question Number 82

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("Test3.txt","w+")
file2 = open("Test2.txt","a+")
string = file.read()
file2.seek(5,0)
file2.write(string)
string1 = file2.read(5)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 83

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

if(value == (10//5)):
    print(value)

elif (value != 10//2):

else :
    print(value - 1)

Question Number 84

Which is the library that helps you create Simple Object Access Protocol (SOAP) connections to Web services providers?

Question Number 85

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

>>> from LibTest import SayHello
>>> SayHello("Anne")

Question Number 86

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

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

else :
    var += 5
print(var)

Question Number 87

Which method can be used to read a string from an open file?

Question Number 88

Which is a utility for creating documentation from the comments in the Python code that works much like JavaDoc?

Question Number 89

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

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

>>> import LibTest
>>> PrintAge()

Question Number 90

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

for value in List:
        Result += 1

print(len(List))

Question Number 91

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,0)
file3.write(string)
string = file2.read()
file3.seek(0,0)
file3.write(string)
file3.seek(5,0)
val = file3.read(5)

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

Question Number 92

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

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

Question Number 93

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

Question Number 94

Which of the following statements are true about IPython?

Question Number 95

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

Question Number 96

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

NewInst = MyTest()
NewInst2 = MyTest()
NewInst.var = 2
NewInst.var = 3
print((NewInst2.var + NewInst1.var))

Question Number 97

Which type of documentation is generally required by a library?

Question Number 98

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 99

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 100

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 101

Give the output of the following code snippet:
string = "This is a Test Program"
Result = string.istitle()
print(Result)

Question Number 102

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

Question Number 103

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

Question Number 104

Based on which time frame the error is made, most programming language breaks the types of errors that occur into which of the following types?

Question Number 105

Which of the following statements are true about the class variables?

Question Number 106

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 107

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

DList = {"B": "Red", "C": "Yellow"}
DList2 = {"A": "Blue"}
print(DList2["A"] + DList["C"])

Question Number 108

Which attribute provides the name and location of the cached file that is associated with a module?

Question Number 109

Which utility converts your Python code into Java code so that you can make full use of Java functionality in your application while maintaining the features that you like about Python?

Question Number 110

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 111

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

Question Number 112

Which of the following are add-ons to the elementtree library?

Question Number 113

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

if(value == (10//5)):
    print(value)

elif (value != 10//2):
    print (value+1)

else :
    print(value - 1)
    

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","b+")
string = file.read()
file2.seek(1,0)
file2.write(string)
string1 = file2.read(10)
string = file2.tell()
file.close()
file2.close()
print (string1)

Question Number 115

Which of the following control structures is used to replace the missing switch case statement in Python?

Question Number 116

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

MyTuple = ("Red")
MyTuple = MyTuple.__add__(("Green"))
MyTuple = MyTuple.__add__(("Yellow"))
print(MyTuple)

Question Number 117

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","r+")
file.seek(0,0)
string = file.read()
file2.write(string)
string1 = file2.read()
file.close()
file2.close()
print (string)

Question Number 118

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

	
>>> Test()

Question Number 119

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

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

else :
    print (value+1)

Question Number 120

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

Question Number 121

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 122

Give the output of the following code snippet :
>>> myComp1 = 1 + 5j
>>> myComp2 = 5 + 4j
>>> myComp3 = myComp1 + myComp2
>>> myComp3

Question Number 123

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 124

The Python shell window displays a _______ message every time the application is run.

Question Number 125

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

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

Question Number 126

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

Question Number 127

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

>>> Test(20)

Question Number 128

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","r+")
file.seek(0,0)
string = file.read()
file2.write(string)
string1 = file2.read()
file.close()
file2.close()
print (string1)

Question Number 129

Give the output of the following code snippet:
List = [1,2] + [11,10]
Result = 0
List2 = List.copy()
List2.reverse()
List.sort() 
print(List + List2)

Question Number 130

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

for value in List:
    Result += value

print(Result)

Question Number 131

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

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

>>> import LibTest
>>>SayHello()

Question Number 132

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

if(value == (10//5)):
    print(value)

elif: (value != 10//2)
    print (value+1)

else :
    print(value - 1)

Question Number 133

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

for value in List:
    Result += value

print(Result)

Question Number 134

Give the output of the following code snippet:
class MyClass:
    def PrintList1(*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])
                
MyClass.PrintList1("Red")
List2 = MyClass()
List2.PrintList2(A="Green",B="Yellow")

Question Number 135

Which of the following are some of the forms of MIME which are used when creating a message for an email?

Question Number 136

Give the output of the following code snippet:
string = "Hello World"
Result = len(string)
print(Result)

Question Number 137

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

Question Number 138

The current date and time can be obtained using which command?

Question Number 139

What is the process of converting the encrypted data back to its original form while reading it?

Question Number 140

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

Question Number 141

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 = Value1 + Value2 + Value1
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 142

Which of the following is an example of the collections which are available in Python?

Question Number 143

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

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

>>> from LibTest import PrintAge()
>>>PrintAge()

Question Number 144

Which of the following statements are true about the local host name of the email address?

Question Number 145

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(List2)

Question Number 146

Which of the following statements are true about the pydoc, also known as, Python Module Documentation?

Question Number 147

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

for value in List:
    Result += value

print(Result)

Question Number 148

Give the output of the following code snippet:
List = [1,2,'Three',4,5.5]
Result = 0

for value in List:
    Result += List[value]

print(Result)

Question Number 149

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

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

Question Number 150

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

Question Number 151

Give the output of the following code snippet:
string = "\r\n"
Result = string.isspace()
print(Result)

Question Number 152

Expand MIME :

Question Number 153

Which of the following logical operators in python is used to negate the value of the operand?

Question Number 154

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

Question Number 155

Which of the following Python installers can be used to install a program from your system to the user's system?

Question Number 156

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 157

Which of the following statements are true about the Twisted Matrix library?

Question Number 158

Give the output of the following code snippet in the python shell window:
>>> var = int("1000",2)
>>> if ( var >= 4):
	var //= 2
	var **= 2
	print(var)

Question Number 159

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

Question Number 160

Which of the following statements are true regarding custom exceptions?

Question Number 161

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(5)
file.close()
file3.close()
print (string1)

Question Number 162

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 = Value1 + Value2 + Value3
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 163

Give the output of the following code snippet : Assume the input given in 10.
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 164

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

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 165

Give the output of the following code snippet:
class MyTest:
    var = 0
    def SayHello():
        print("Hello")

NewInst = MyTest()
NewInst.SayHello()

Question Number 166

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

Question Number 167

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 168

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

Question Number 169

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

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

else :
    var += 5
print(var)

Question Number 170

Which of the following statements are true regarding Tuples in Python?

Question Number 171

Which letter is used to indicate that the base of the number is 8 in Python?

Question Number 172

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

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

Question Number 173

What does the color Black in the Python IDLE indicate?

Question Number 174

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

MyClass.PrintList1(1A="Red",2A="Blue")

Question Number 175

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

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

Question Number 176

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

Question Number 177

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

>>> TestFun( 10 > 20)

Question Number 178

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

		
>>> Test()

Question Number 179

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

	
>>> Test()

Question Number 180

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

Question Number 181

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","w+")
string = file.read()
file2.seek(15,0)
file2.write(string)
string1 = file2.read()
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 182

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","a+")
file2 = open("Test2.txt","a+")
file3 = open("Test3.txt","w+")
string = file.read()
file3.seek(0,2)
file3.write(string)
string = file2.read()
file3.seek(0,0)
file3.write(string)
val = file3.tell()

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

Question Number 183

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 184

Which operation is used to make multiple lines of text appear on a single line in the output?

Question Number 185

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

Question Number 186

Give the output of the following code snippet:
class MyClass:
    def __init__(self,Age,Name="John"):
        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 + 10

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

JohnRecord = MyClass(50)
AnnaRecord = MyClass("Amy", 44)
print(JohnRecord)

Question Number 187

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(5,0)
string = file.read()
file2.write(string)
file2.seek(0,0)
string = file2.read()
file.close()
file2.close()
print (string)

Question Number 188

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 189

Which of the following arithmetic operators in python is used to perform floor division?

Question Number 190

Which of the following options is used to add a warning when the application runs certain python features?

Question Number 191

Give the output of the following code snippet : Assume the input given in 0.
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 192

Which of the following command line options in python are used to perform optimization?

Question Number 193

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

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

Question Number 194

Which of the following statements are true about PyInstaller?

Question Number 195

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

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

Question Number 196

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 = Value1 + Value2
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 197

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

Question Number 198

Which MIME form is used to provide a method for sending and receiving application input and output?

Question Number 199

Give the output of the following code snippet :
>>> myInt = float("56.05") + int("24.05")
>>> type(myInt)

Question Number 200

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

	
>>> TestFun(1)

Question Number 201

Which of the following list functions removes an entry from a specific position in the list?

Question Number 202

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

for value in List:
    Result += 1

print(Result)

Question Number 203

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

Question Number 204

Which of the following statements are true about function overloading?

Question Number 205

Based on how they are made, most programming language breaks the types of errors that occur into which of the following types?

Question Number 206

What does the color Yellow in the Python IDLE indicate?

Question Number 207

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

Question Number 208

Which of the following characters is used to form an escape sequence?

Question Number 209

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

Question Number 210

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

Question Number 211

What are the features of the python debugger?

Question Number 212

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

for value in List:
        Result += 1

print(len(List[0]))

Question Number 213

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 = Value1 + Value2 + Value2
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 214

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","a+")
file2 = open("Test3.txt","w+")
string = file.read()
file2.seek(1,0)
file2.write(string)
string1 = file2.read(10)
string = file2.tell()
file.close()
file2.close()
print (string)

Question Number 215

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

Question Number 216

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","w+")
string = file.read()
file3.seek(0,2)
file3.write(string)
string = file2.read()
file3.seek(0,2)
file3.write(string)
file3.seek(10,0)
val = file2.tell()
string3 = file3.read(5)

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

Question Number 217

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

Question Number 218

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

if(value == (10//5)):
    print(value)

else:
    print(value - 1)

    
    

Question Number 219

Give the output of the following code snippet :
>>> myvar = 1.25e-2
>>> myvar +=2
>>> type(myvar)

Question Number 220

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+")
string = file.read(6)
file2.write(string)
file2.seek(0,0)
string = file2.read()
file.close()
file2.close()
print (string)

Question Number 221

Which window is actually used to create the applications?

Question Number 222

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

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

Question Number 223

What is the act of storing each version of an application in a separate place so that changes can be undone or redone as needed?

Question Number 224

Which of the following commands is used to exit python?

Question Number 225

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

Question Number 226

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","a+")
file3 = open("Test3.txt","w+")
string = file.read()
file3.seek(0,0)
file3.write(string)
string = file2.read()
file3.seek(0,1)
file3.write(string)
file3.seek(10,0)
val = file3.read(5)

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

Question Number 227

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

Question Number 228

Which environment variable determines the seed value used to generate hash values from various kinds of data?

Question Number 229

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

>>> import LibTest
>>> LibTest.SayHello("Arya")

Question Number 230

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

Question Number 231

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

Question Number 232

Which is the value generally returned by the _initializing_ module which determines if the module is in the process of initializing itself?

Question Number 233

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

Question Number 234

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

Question Number 235

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 236

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 237

Which MIME form contains an audio file?

Question Number 238

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

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

Question Number 239

Give the output of the following code snippet in the python shell window:
>>> var = ~2 + (-4) - ~1
>>> var

Question Number 240

Give the output of the following code snippet:
string = "HELLO123WORLD"
Result = string.isupper()
print(Result)

Question Number 241

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

while(var > 1):
    if(Arg !='r'):
            var +=1

print(var)

Question Number 242

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

Question Number 243

Give the output of the following code snippet:
class MyClass:
    Sum = 0
    def Calc(self,Val1 = 10, Val2=20):
        Sum = Val1 * Val2/10
        print(Sum)    

MyExp = MyClass(20)
MyExp.Calc(40)

Question Number 244

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 245

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 = Value1 + Value2 + Value2
print("{0} + {1} = {2}".format(Value1, Value2, Value3))

Question Number 246

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

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

Question Number 247

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

Question Number 248

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

MyTuple = ("Red")
MyTuple = MyTuple.__add__((20,"Green"))
MyTuple = MyTuple.__add__((10.5))
print(MyTuple)

Question Number 249

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

>>>TestFun()

Question Number 250

Which of the following statements are true about the Twisted Matrix library?

Question Number 251

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

Question Number 252

Which of the following clauses immediately ends the processing of the current element?

Question Number 253

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 254

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

Question Number 255

Which method provides a useful method for determining how you can access a particular location?