NEW
Font size
WorksheetsUNIT-1 PYTHON BASICS
Total questions: 10
Worksheet time: 5mins
What is the output of the following code?
Good Bye
Welcome
An error message
None of the above
Analyze the following code and choose the most correct statement:
The program runs and displays "It is even!"
The program runs, but displays nothing.
The program has a Syntax Error in line 1: even = false
The program has an error in line 2: if Even == True
Which code prints the output [3,7,8] for a given list -
[ [1,2,3] , [5,6,7] , [0,9,8] ]
[i[2] for i in list]
[i(2) for i in list]
[i[3] for i in list]
(i(3) for i in list)
What will be the output of the following Python code?
str1 = 'hello'
str1=str1+2
hello2
Error
hello
hello 2
Which of the following is invalid?
_a=1
__a=1
__a__=1
None of the above
Q3. Which of the following is used to insert a new line in Python
\n
\t
\N
\T
What is the result of this statement:
{'b', 'a', 'r'} & set('qux')
{'b', 'r', 'a'}
set()
{'q', 'r', 'x', 'u', 'b', 'a'}
{}
Given the following string:
h = "Hello", which code results in an error?
print (h)
print(h.lower())
h = 's'
print(h+1)
