Font size
Worksheetspython basics by vaishali
Total questions: 50
Worksheet time: 25mins
To display something on the screen, use this command:
print()
Print()
screen()
write()
display()
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
name = 'Dave'
print (name)
Which operator performs a division?
-
+
/
*
Which operator checks if a value is equal to another value?
+
=
==
!=
Which operator checks if a value is not equal to another value?
==
+=
!=
=
Which of the following is correct?
Comments are for programmers for better understanding of the program.
Python Interpreter ignores comment.
You can write multi-line comments in Python using triple quotes, either ''' or """.
All of the above
In the following code, n is a/an _______?
n = '5'
integer
string
tuple
operator
What is used to take input from the user in Python?
cin
scanf()
input()
<>
What is a input?
A built-in function that allows us to prompt the user to enter data.
To plug in something.
Data displayed on a screen.
A device.
What syntax would you use to create a name variable?
name=input()
input=name
name=input{}
name=INPUT
print("Hello world!\nHello world!")
Hello world!
Syntax Error
print("Hello" + str(2) + "world!")
Syntax Error
What does the following code do? myAge = int(myAge)
Converts the variable myAge to a integer
Syntax Error
Converts the variable myAge from a integer to a string
Missing input
Are Double or single quotes used in Python?
Double
Single
Neither
Both work
Python correct naming convention for variables is?
new_user25
NewUser25
25_new_user
25NewUser
NEWUSER25
The output of the program
x = 4
x = "Sally"
print(x)
four
Saly
Sally
4
print("Hello" + 2 + "world")
print("3+4")
print(3+4)
What is the name of the variable in this program?
colour
input
" "
What will be the output for following python programme:
x = 100
y = float(x)
print(y)
200
100.0
100
Can't convert an integer to a floating number.
Which of the statements below is true about indentation in Python?
Indentation only matters in for loops. Then, everything must be indented one level.
Indentation never matters in Python. You can align your code any way you like, but indentation makes your code easier to read.
Indentation always matters in Python. Every statement must be aligned correctly.
Indentation only matters in functions. Then, everything must be indented one level.
Which one is NOT a legal variable name?
_fname
first_Name
f-Name
Fname
What is the correct syntax to output the type of a variable or object in Python?
print(type(x))
print(typeof(x))
print(type of (x))
print(typeOf(x))
In Python, 'Hello', is the same as "Hello"
True
False
Cant say
both are wrong
What is the correct file extension for Python files?
.pyth
.py
.pt
.pyt
Who developed the Python programming language?
Rasmus Lerdorf
Wick van Rossum
Guido van Rossum
Guido Van Stom
Full form of IDLE in python is:
(a)
a > b
a >= b
my number = 36
print("Hello world!" * 2)
(a) is smallest individual unit in a program.
Size of the string "Ant Man"
(a)
