SlideShare a Scribd company logo
1 of 13
What is the output of print(2 ** 3 ** 2)
64
512
2. What is the output of print(2%6)
ValueError
0.33
2
3. Bitwise shift operators (<<, >>) has higher precedence than Bitwise And(&)
operator
False
True
4. What is the output of the following addition (+) operator
a = [10, 20]
b = a
b += [30, 40]
print(a)
print(b)
[10, 20, 30, 40]
[10, 20, 30, 40]
[10, 20]
[10, 20, 30, 40]
5. What is the output of print(2 * 3 ** 3 * 4)
216
864
6. What is the output of print(10 - 4 * 2)
2
12
7. 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise
operators?
a = 4
b = 11
print(a | b)
print(a >> 2)
15
1
14
1
8. What is the output of the expression print(-18 // 4)
-4
4
-5
5
9. What is the output of the following code
print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j))
True True False True
False True True True
True True False True
False True False True
10. What is the value of the following Python Expression
print(36 / 4)
9.0
9
11. Whichof the following operators has the highest precedence?
not
&
*
+
12. What is the output of the following code
x = 6
y = 2
print(x ** y)
print(x // y)
66
0
36
0
66
3
36
3
13. What is the output of the following assignment operator
y = 10
x = y += 2
print(x)
12
10
SynatxError
14. What is the output of the following Python code
x = 10
y = 50
if (x ** 2 > 100 and y < 100):
print(x, y)
100 500
10 50
None
15. What is the output of the following code
x = 100
y = 50
print(x and y)
True
100
False
50
Whichmethod should I use to convert String "welcome to the beautiful world
of python" to "Welcome To The Beautiful World Of Python"
capitalize()
title()
2. Select the correct output of the following String operations
strOne = str("pynative")
strTwo = "pynative"
print(strOne == strTwo)
print(strOne is strTwo)
false false
true true
true false
false true
3. Select the correct output of the following String operations
str1 = 'Welcome'
print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
4. Select the correct output of the following String operations
str = "my name is James bond";
print (str.capitalize())
My Name Is James Bond
TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’
My name is james bond
5. Select the correct output of the following String operations
str1 = "my isname isisis jameis isis bond";
sub = "is";
print(str1.count(sub, 4))
5
6
7
6. Choose the correct function to get the ASCII code of a character
char(‘char’)
ord(‘char’)
ascii(‘char’)
7. Select the correct output of the following String operations
myString = "pynative"
stringList = ["abc", "pynative", "xyz"]
print(stringList[1] == myString)
print(stringList[1] is myString)
true false
true true
8. Guess the correct output of the following code?
str1 = "PYnative"
print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1])
PYn PYnat ive PYnativ vitanYP
Yna PYnat tive PYnativ vitanYP
Yna PYnat tive PYnativ PYnativ
9. Guess the correct output of the following String operations
str1 = 'Welcome'
print(str1*2)
WelcomeWelcome
TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’
10. What is the output of the following string operations
str = "My salary is 7000";
print(str.isalnum())
True
False
11. Python does not support a character type; a single character is treated as
strings of length one.
False
True
12. What is the output of the following code
str1 = "My salary is 7000";
str2 = "7000"
print(str1.isdigit())
print(str2.isdigit())
False
True
False
False
True
False
13. Strings are immutable in Python, which means a string cannot be modified.
True
False
14. What is the output of the following string comparison
print("John" > "Jhon")
print("Emma" < "Emm")
True
False
False
False
15. Choose the correctfunction to get the character from ASCII number
ascii(‘number)
char(number)
chr(number)
Select which is true for for loop
Python’s for loop used to iterates over the items of list, tuple, dictionary, set,
or string
else clause of for loop is executed when the loop terminates naturally
else clause of for loop is executed when the loop terminates abruptly
Weuse for loop when we want to perform a task indefinitely until a particular
condition is met
2. What is the output of the following nested loop
for num in range(10, 14):
for i in range(2, num):
if num%i == 1:
print(num)
break
10
11
12
13
11
13
3. What is the value of x
x = 0
while (x < 100):
x+=2
print(x)
101
99
None of the above, this is an infinite loop
100
4. What is the output of the following range() function
for num in range(2,-5,-1):
print(num, end=", ")
2, 1, 0
2, 1, 0, -1, -2, -3, -4, -5
2, 1, 0, -1, -2, -3, -4
5. What is the output of the following for loop and range() function
for num in range(-2,-5,-1):
print(num, end=", ")
-2, -1, -3, -4
-2, -1, 0, 1, 2, 3,
-2, -1, 0
-2, -3, -4,
6. What is the output of the following loop
for l in 'Jhon':
if l == 'o':
pass
print(l, end=", ")
J, h, n,
J, h, o, n,
7. Given the nested if-else structure below, what will be the value of x after
code execution completes
x = 0
a = 0
b = -5
if a > 0:
if b < 0:
x = x + 5
elif a > 5:
x = x + 4
else:
x = x + 3
else:
x = x + 2
print(x)
2
0
3
4
8. What is the value of x after the following nested for loop completes its
execution
x = 0
for i in range(10):
for j in range(-1, -10, -1):
x += 1
print(x)
99
90
100
9. What is the output of the following if statement
a, b = 12, 5
if a + b:
print('True')
else:
print('False')
False
True
10. What is the value of the var after the for loop completes its execution
var = 10
for i in range(10):
for j in range(2, 10, 1):
if var % 2 == 0:
continue
var += 1
var+=1
else:
var+=1
print(var)
20
21
10
30
11. if -3 will evaluate to true
True
False
12. Given the nested if-else below, what will be the value x when the code
executed successfully
x = 0
a = 5
b = 5
if a > 0:
if b < 0:
x = x + 5
elif a > 5:
x = x + 4
else:
x = x + 3
else:
x = x + 2
print(x)
0
4
2
3
13. What is the output of the following nested loop
numbers = [10, 20]
items = ["Chair", "Table"]
for x in numbers:
for y in items:
print(x, y)
10 Chair
10 Table
20 Chair
20 Table
10 Chair
10 Table
In Python3, Whatever you enter as input, the input() function converts it into a
string
False
True
2. Whichof the following is incorrect file handling mode in Python
r
x
t+
b
3. Whichof the following is incorrect file handling mode in Python
wb+
ab
xr
ab+
4. What is the output of print('[%c]' % 65)
65
A
[A]
Syntax Error
5. Use the following file to predict the output of the code
test.txt Content:
aaa
bbb
ccc
ddd
eee
fff
ggg
Code:
f = open("test.txt", "r")
print(f.readline(3))
f.close()
bbb
Syntax Error
aaa
aa
6. In Python3, which functions are used to accept input from the user
input()
raw_input()
rawinput()
string()
7. What is the output of the following print() function
print(sep='--', 'Ben', 25, 'California')
Syntax Error
Ben–25–California
Ben 25 California
8. What will be displayed as an output on the screen
x = float('NaN')
print('%f, %e, %F, %E' % (x, x, x, x))
nan, nan, NAN, NAN
nan, NaN, nan, NaN
NaN, NaN, NaN, NaN,
9. What is true for file mode x
create a file if the specified file does not exist
Create a file, returns an error if the file exists
Create a file if it doesn’t exists else Truncate the existed file
10. What is the output of print('%x, %X' % (15, 15))
15 15
F F
f f
f F
11. What is the output of the following print() function
print('%d %d %.2f' % (11, '22', 11.22))
11 22 11.22
TypeError
11 ’22’ 11.22
12. What is the output of the following code
print('PYnative ', end='//')
print(' is for ', end='//')
print(' Python Lovers', end='//')
PYnative /
is for /
Python Lovers /
PYnative //
is for //
Python Lovers //
PYnative // is for // Python Lovers//
PYnative / is for / Python Lovers/

More Related Content

What's hot

Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
gekiaruj
 

What's hot (20)

C++ L06-Pointers
C++ L06-PointersC++ L06-Pointers
C++ L06-Pointers
 
C++ L05-Functions
C++ L05-FunctionsC++ L05-Functions
C++ L05-Functions
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
 
Java cheatsheet
Java cheatsheetJava cheatsheet
Java cheatsheet
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
 
C++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+OperatorsC++ L02-Conversion+enum+Operators
C++ L02-Conversion+enum+Operators
 
C++ L01-Variables
C++ L01-VariablesC++ L01-Variables
C++ L01-Variables
 
The java language cheat sheet
The java language cheat sheetThe java language cheat sheet
The java language cheat sheet
 
Python
PythonPython
Python
 
Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...
Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...
Notes for GNU Octave - Numerical Programming - for Students - 02 of 02 by aru...
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Python programing
Python programingPython programing
Python programing
 
Python Conditionals and Functions
Python Conditionals and FunctionsPython Conditionals and Functions
Python Conditionals and Functions
 
Talk Code
Talk CodeTalk Code
Talk Code
 
09. Java Methods
09. Java Methods09. Java Methods
09. Java Methods
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
 
06.Loops
06.Loops06.Loops
06.Loops
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 

Similar to Mcq cpup

Data Handling.pdf
Data Handling.pdfData Handling.pdf
Data Handling.pdf
MILANOP1
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
nayakq
 

Similar to Mcq cpup (20)

Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
 
Python programming workshop session 3
Python programming workshop session 3Python programming workshop session 3
Python programming workshop session 3
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
week4_python.docx
week4_python.docxweek4_python.docx
week4_python.docx
 
Data Handling
Data Handling Data Handling
Data Handling
 
Java file
Java fileJava file
Java file
 
Java file
Java fileJava file
Java file
 
10. Recursion
10. Recursion10. Recursion
10. Recursion
 
Python From Scratch (1).pdf
Python From Scratch  (1).pdfPython From Scratch  (1).pdf
Python From Scratch (1).pdf
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiarities
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Python basic
Python basic Python basic
Python basic
 
Data Handling.pdf
Data Handling.pdfData Handling.pdf
Data Handling.pdf
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdf
 
07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 

Mcq cpup

  • 1. What is the output of print(2 ** 3 ** 2) 64 512 2. What is the output of print(2%6) ValueError 0.33 2 3. Bitwise shift operators (<<, >>) has higher precedence than Bitwise And(&) operator False True 4. What is the output of the following addition (+) operator a = [10, 20] b = a b += [30, 40] print(a) print(b) [10, 20, 30, 40] [10, 20, 30, 40] [10, 20] [10, 20, 30, 40] 5. What is the output of print(2 * 3 ** 3 * 4) 216 864 6. What is the output of print(10 - 4 * 2) 2 12 7. 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators? a = 4
  • 2. b = 11 print(a | b) print(a >> 2) 15 1 14 1 8. What is the output of the expression print(-18 // 4) -4 4 -5 5 9. What is the output of the following code print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j)) True True False True False True True True True True False True False True False True 10. What is the value of the following Python Expression print(36 / 4) 9.0 9 11. Whichof the following operators has the highest precedence? not & * + 12. What is the output of the following code x = 6 y = 2
  • 3. print(x ** y) print(x // y) 66 0 36 0 66 3 36 3 13. What is the output of the following assignment operator y = 10 x = y += 2 print(x) 12 10 SynatxError 14. What is the output of the following Python code x = 10 y = 50 if (x ** 2 > 100 and y < 100): print(x, y) 100 500 10 50 None 15. What is the output of the following code x = 100 y = 50 print(x and y) True 100 False 50
  • 4. Whichmethod should I use to convert String "welcome to the beautiful world of python" to "Welcome To The Beautiful World Of Python" capitalize() title() 2. Select the correct output of the following String operations strOne = str("pynative") strTwo = "pynative" print(strOne == strTwo) print(strOne is strTwo) false false true true true false false true 3. Select the correct output of the following String operations str1 = 'Welcome' print (str1[:6] + ' PYnative') Welcome PYnative WelcomPYnative Welcom PYnative WelcomePYnative 4. Select the correct output of the following String operations str = "my name is James bond"; print (str.capitalize()) My Name Is James Bond TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’ My name is james bond 5. Select the correct output of the following String operations str1 = "my isname isisis jameis isis bond"; sub = "is"; print(str1.count(sub, 4)) 5
  • 5. 6 7 6. Choose the correct function to get the ASCII code of a character char(‘char’) ord(‘char’) ascii(‘char’) 7. Select the correct output of the following String operations myString = "pynative" stringList = ["abc", "pynative", "xyz"] print(stringList[1] == myString) print(stringList[1] is myString) true false true true 8. Guess the correct output of the following code? str1 = "PYnative" print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1]) PYn PYnat ive PYnativ vitanYP Yna PYnat tive PYnativ vitanYP Yna PYnat tive PYnativ PYnativ 9. Guess the correct output of the following String operations str1 = 'Welcome' print(str1*2) WelcomeWelcome TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’ 10. What is the output of the following string operations str = "My salary is 7000"; print(str.isalnum()) True False
  • 6. 11. Python does not support a character type; a single character is treated as strings of length one. False True 12. What is the output of the following code str1 = "My salary is 7000"; str2 = "7000" print(str1.isdigit()) print(str2.isdigit()) False True False False True False 13. Strings are immutable in Python, which means a string cannot be modified. True False 14. What is the output of the following string comparison print("John" > "Jhon") print("Emma" < "Emm") True False False False 15. Choose the correctfunction to get the character from ASCII number ascii(‘number) char(number) chr(number) Select which is true for for loop
  • 7. Python’s for loop used to iterates over the items of list, tuple, dictionary, set, or string else clause of for loop is executed when the loop terminates naturally else clause of for loop is executed when the loop terminates abruptly Weuse for loop when we want to perform a task indefinitely until a particular condition is met 2. What is the output of the following nested loop for num in range(10, 14): for i in range(2, num): if num%i == 1: print(num) break 10 11 12 13 11 13 3. What is the value of x x = 0 while (x < 100): x+=2 print(x) 101 99 None of the above, this is an infinite loop 100 4. What is the output of the following range() function for num in range(2,-5,-1): print(num, end=", ") 2, 1, 0 2, 1, 0, -1, -2, -3, -4, -5 2, 1, 0, -1, -2, -3, -4 5. What is the output of the following for loop and range() function
  • 8. for num in range(-2,-5,-1): print(num, end=", ") -2, -1, -3, -4 -2, -1, 0, 1, 2, 3, -2, -1, 0 -2, -3, -4, 6. What is the output of the following loop for l in 'Jhon': if l == 'o': pass print(l, end=", ") J, h, n, J, h, o, n, 7. Given the nested if-else structure below, what will be the value of x after code execution completes x = 0 a = 0 b = -5 if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x) 2 0 3 4 8. What is the value of x after the following nested for loop completes its execution x = 0 for i in range(10): for j in range(-1, -10, -1): x += 1
  • 9. print(x) 99 90 100 9. What is the output of the following if statement a, b = 12, 5 if a + b: print('True') else: print('False') False True 10. What is the value of the var after the for loop completes its execution var = 10 for i in range(10): for j in range(2, 10, 1): if var % 2 == 0: continue var += 1 var+=1 else: var+=1 print(var) 20 21 10 30 11. if -3 will evaluate to true True False 12. Given the nested if-else below, what will be the value x when the code executed successfully x = 0 a = 5 b = 5
  • 10. if a > 0: if b < 0: x = x + 5 elif a > 5: x = x + 4 else: x = x + 3 else: x = x + 2 print(x) 0 4 2 3 13. What is the output of the following nested loop numbers = [10, 20] items = ["Chair", "Table"] for x in numbers: for y in items: print(x, y) 10 Chair 10 Table 20 Chair 20 Table 10 Chair 10 Table In Python3, Whatever you enter as input, the input() function converts it into a string False True 2. Whichof the following is incorrect file handling mode in Python r x t+ b 3. Whichof the following is incorrect file handling mode in Python
  • 11. wb+ ab xr ab+ 4. What is the output of print('[%c]' % 65) 65 A [A] Syntax Error 5. Use the following file to predict the output of the code test.txt Content: aaa bbb ccc ddd eee fff ggg Code: f = open("test.txt", "r") print(f.readline(3)) f.close() bbb Syntax Error aaa aa 6. In Python3, which functions are used to accept input from the user input() raw_input() rawinput() string() 7. What is the output of the following print() function
  • 12. print(sep='--', 'Ben', 25, 'California') Syntax Error Ben–25–California Ben 25 California 8. What will be displayed as an output on the screen x = float('NaN') print('%f, %e, %F, %E' % (x, x, x, x)) nan, nan, NAN, NAN nan, NaN, nan, NaN NaN, NaN, NaN, NaN, 9. What is true for file mode x create a file if the specified file does not exist Create a file, returns an error if the file exists Create a file if it doesn’t exists else Truncate the existed file 10. What is the output of print('%x, %X' % (15, 15)) 15 15 F F f f f F 11. What is the output of the following print() function print('%d %d %.2f' % (11, '22', 11.22)) 11 22 11.22 TypeError 11 ’22’ 11.22 12. What is the output of the following code print('PYnative ', end='//') print(' is for ', end='//') print(' Python Lovers', end='//')
  • 13. PYnative / is for / Python Lovers / PYnative // is for // Python Lovers // PYnative // is for // Python Lovers// PYnative / is for / Python Lovers/