What will be the output after the following statements? x = ‘2.7’ print(x.isdecimal()) a. True b. False c. 1 d. 0
What does the following statement do? x = open(‘python.csv’, ‘r’) a. Opens an existing text file named python.csv to write b. Opens an existing text file named python.csv to append c. Opens an existing text file named python.csv to read d. Opens a new file named python.csv to read
What does the following statement do? x = open(‘python.csv’, ‘w’) a. Opens or creates a text file named python.csv to write b. Opens or creates a text file named python.csv to append c. Opens or creates a text file named python.csv to read d. Opens a new file named python.csv to write
What does the following statement do? x = open(‘python.csv’, ‘a’) a. Opens or creates a text file named python.csv to write b. Opens or creates a text file named python.csv to append c. Opens or creates a text file named python.csv to read d. Opens a new file named python.csv to append
What does the following statement do? x = open(‘python.txt’, ‘r+’) a. Opens a text file named python.txt to read from or write to b. Opens a text file named python.txt to read c. Opens a text file named python.txt to write d. Opens a new file named python.txt to append
What does the following statement do? x = open(‘python.txt’, ‘w+’) a. Opens a text file named python.txt to read b. Opens a text file named python.txt to write to or read from c. Opens a text file named python.txt to write d. Opens a new file named python.txt to append
What does the following statement do? x = open(‘python.txt’, ‘a+’) a. Opens a text file named python.txt to read b. Opens a text file named python.txt to read and write c. Opens a text file named python.txt to write to d. Opens or creates a text file named python.txt to read from or write to at the end of the file
What does the following statement do? x = open(‘python.bat’, ‘rb’) a. Opens an existing text file named python.bat to write b. Opens an existing binary file named python.bat to write c. Opens an existing binary file named python.bat to append d. Opens an existing binary file named python.bat to read
What does the following statement do? x = open(‘python.bat’, ‘wb’) a. Opens or creates a binary file named python.bat to write b. Opens or creates a binary file named python.bat to append c. Opens or creates a binary file named python.bat to read d. Opens a new file named python.bat to write
What does the following statement do? x = open(‘python.bat’, ‘ab’) a. Opens or creates a binary file named python.bat to write b. Opens or creates a binary file named python.bat to append c. Opens or creates a binary file named python.bat to read d. Opens a new file named python.bat to append
What will be the output after the following statements? x = open(‘python.txt’, ‘r’) print(x.name) a. python b. python.txt opened c. python.txt or FileNotFoundError d. python r
What will be the output after the following statements? x = open(‘python.csv’, ‘w’) print(x.mode) a. python write b. python.txt c. r d. w
What will be the output after the following statements? x = open(‘python.csv’, ‘w’) print(x.closed) a. open b. closed c. True d. False
What will be the output after the following statements? x = open(‘python.csv’, ‘w’) x.close() print(x.closed) a. open b. closed c. True d. False
What will be the output after the following statements? x = open(‘python.csv’, ‘w’) print(x.readable()) a. readable b. writable c. True d. False
What will be the output after the following statements? x = open(‘python.csv’, ‘w’) print(x.writable()) a. readable b. writable c. True d. False
What will be the output after the following statements? x = open(‘python.csv’, ‘a’) print(x.writable()) a. readable b. writable c. True d. False
In IDLE shell, the output will be the same for all the following statements except one. Which one? a. 4+4 b. 4 + 4 c. 4*2 d. 4**2
In IDLE shell, what is the keyboard shortcut for the previous command in history on Windows/Linux? a. Page Down a. Page Down b. Page Up c. Alt + P d. Ctrl + P
In IDLE shell, what is the keyboard shortcut for the next command in history on Windows/Linux? a. Page Down b. Page Up c. Ctrl + N d. Alt + N
In IDLE shell, what is the keyboard shortcut for the previous command in history on Mac OS X? a. Page Down b. Page Up c. Alt + P d. Ctrl + P
In IDLE shell, what is the keyboard shortcut for the next command in history on Mac OS X? a. Page Down b. Page Up c. Ctrl + N d. Alt + N
In IDLE file editor, what is the keyboard shortcut for executing the program in shell? a. F5 b. F1 c. Shift d. Alt
What type of error is shown when you use a variable without assigning an initial value? a. Not declared b. Not defined c. Not assigned d. Not a variable
What type of language is Python? a. High level b. Low level c. Top level d. Bottom level
Python language was named after? a. Python – the reptile b. Monty Python c. A pet d. A company
Who is the creator of Python? a. Bill Gates b. Guido Van Rossum c. Jeff Bezos d. Larry Page
Which of the following is identified with Python? a. Dynamic typing b. Static typing c. Slow typing d. Auto typing d. Auto typing
Which of the following is used to enclose strings? a. Single quotes b. Double quotes c. Either single quotes or double quotes d. ! symbol
Which of the following is used to add an invisible tab character to the output? a. \t b. \tab c. \a d. \b
What will be the output after the following statement? print(‘2\\t4’) a. 2 t 4 b. 2\t4 c. 2 4 d. 2 tab 4
What will be the output after the following statements? a = True b = False c = 5 if (a == 1) else b print(c) a. True b. False c. b d. 5
What will be the output after the following statements? a = True b = False c = ‘a’ if (b == 0) else ‘b’ print(c) a. True b. False c. a d. b
What will be the output after the following statements? a = False b = False print(a and b) a. True b. False c. ab d. ba
In the order of precedence, which of the operation will be completed first in the following statement? 3 * 6 + 5 – 4 / 2 a. Multiplication b. Division c. Addition d. Subtraction
In the order of precedence, which of the operation will be completed last in the following statement? 3 * 6 + 5 – 4 / 2 a. Multiplication b. Division c. Addition d. Subtraction
What will be the order of precedence of operations in the following statement? 10 * 4 – 1 + 8 / 5 a. Multiplication, Division, Subtraction, Addition b. Multiplication, Division, Addition, Subtraction c. Division, Multiplication, Subtraction, Addition d. Division, Multiplication, Addition, Subtraction
What will be the data type of x after the following statement if input entered is 64? x = float(input(‘Enter a number: ‘)) a. Integer b. String c. List d. Float
What will be the output after the following statements? a = 27 / 3 % 2 * 4**2 print(a) a. 0 b. 16.0 c. 32 d. 4.0
What will be the output after the following statements? a = 3 / 3 47 – 3*3 print(a) a. 20.0 b. 1.0 c. 36.0 d. 0.0
What will be the output after the following statements? a = [1,3,5,7,9,11,13,15,17,19] print(a[1:5],a[3:17]) a. [3, 5, 7, 9] b. [1, 3, 5] [3, 5, 7, 9, 11, 13, 15, 17] c. [3, 5, 7, 9] [7, 9, 11, 13, 15, 17, 19] d. [3, 5, 7, 9, 11, 13, 15, 17, 19]
What will be the output after the following statements? a = [1,3,5] print(a * 2) a. [1, 3, 5, 1, 3, 5] b. [1, 2, 3, 5] c. [3, 5] d. [11, 33, 55]
Which of the following is not a valid variable name? a. abc b. abc123 c. 123abc d. abc_123
Which of the following is a valid variable name? a. a$1 b. a1 c. 1a d. abc 123
What will be the output after the following statements? a = 15 b = a a = 25 print(a,b) a. 25 15 b. 15 25 c. a 15 d. 25 a
What will be the output after the following statements? x = 16 / 4 * 5 y = 16 / 4 * 5.0 z = 16 / 4.0 * 5 print(x, y, z) a. 25 15 20 b. 20.0 20.0 20.0 c. 20.0 20 20.0 d. 20 20.0 20
What will be the data type of x after the following statement? x = 1/2 a. Integer b. List c. String d. Float
What will be the output after the following statements? def x(y,z): pass x(1,4) a. 1,4 b. y,z c. No output d. None
What will be the output after the following statements? b = 1 for a in range(1, 10, 3): b += a + 1 print(b) a. 14 b. 16 c. 20 d. 25
What will be the output after the following statements? b = 1 for a in range(1, 10): b += a – 1 print(b) a. 37 b. 47 c. 44 d. 38