NEW
Font size
WorksheetsPython Internship Quiz
Total questions: 15
Worksheet time: 8mins
What will be the output?
S=50.6
number=int(S)
new_number=number-1
print(new_number)
49.6
49
50
51.6
52
What does the term 'debug' mean?
Identify errors and fix them.
Making a calculation
A set of instructions
Looking at code
Running a code in Jupyter
Python is an example of a....
Text-based programming language
Object orientated programming language
language written in java script
Visual-based programming language
What does the print function do in python?
It's a variable.
It can input data.
It displays something like a string or integer
It loops the code.
Which of these is the correct code for creating a list of names?
Name_List = Apple, Banana, Grape, Apple, Banana, Banana
Name_List = ("Apple", "Banana", "Grape", "Apple", "Banana", "Banana")
Name_List = ["Apple", "Banana", "Grape", "Apple", "Banana", "Banana"]
Name_List = [Apple, Banana, Grape, Apple, Banana, Banana]
What output will this code produce?
Colours=[]
Colours.append(“blue”)
Colours.append(“green”)
Colours.append(“red”)
Print(colours[2])
blue
green
red
error
none of these
Which of the following is not valid variable name in Python?
_var
var_name
Elephant
var11
11var
Which of the following is incorrect regarding variables in Python?
Variable names in Python cannot start with number. However, it can contain number in any other position of variable name.
Variable names can start with an underscore.
Data type of variable names should not be declared
None of the above
Choose the correct option.
In Python, a tuple can contain only integers as its elements.
In Python, a tuple can contain only strings as its elements.
In Python, a tuple can contain both integers and strings as its elements.
In Python, a tuple can contain either string or integer but not both at a time.
Why are local variable names beginning with an underscore discouraged?
they are used to indicate a private variables of a class
they confuse the interpreter
they are used to indicate global variables
they slow down execution
Which of the following statements create a dictionary?
d = {}
d = {"brand": "Tesla","electric": True}
d = {2012:"Model S", 2016:"Model 3"}
d = {"brand": "Tesla","electric": True,"colors": ["red", "white", "blue"]}
All of the mentioned
Which of the following will give "Simon" as output?
If str1="John,Simon,Aryan"
print(str1[-7:-12])
print(str1[-11:-7])
print(str1[-11:-6])
print(str1[-7:-11])
Which of the following will result in an error?
str1="python"
print(str1[2])
print(str1[0:9])
str1[1]="x"
Both (a) and (b)
What will be the output of below Python code?
str1="6/4"
print("str1")
1
6/4
1.5
str1
error
What is the name of the environment in Python that write your programs and then test them out?
Shell
Window
IDLE
CLI
