Basic Python Quiz for Beginners
by Kwiz
Qs
18
Difficulty
Junior
Plays
2
Record
n/a
Description

This Quiz is for beginners who are new to Python Programming. This quiz provides Multiple Choice Questions to get familiar with Python. The quiz focuses on testing your basic skills on Python essential functions, string, operators, functions, set, and lists questions.

First published by Vishal @PyNative at https://pynative.com/basic-python-quiz-for-beginners/

Question Preview
What is the output of the following code?
var1 = 1
var2 = 2
var3 = "3"

print(var + var2 + var3)
Question Preview
The ‘in’ operator is used to check if a value exists within an iterable object container such as a list. Evaluates to true if it finds a variable in the specified sequence and false otherwise.
Question Preview
What is the Output of the following code?
for x in range(0.5, 5.5, 0.5):
  print(x)
Question Preview
Which operator has higher precedence in the following list
Question Preview
What is the output of the following code?
valueOne = 5 ** 2
valueTwo = 5 ** 3

print(valueOne)
print(valueTwo)
Question Preview
What is the output of the following code?
x = 36 / 4 * (3 +  2) * 4 + 2
print(x)
Question Preview
What is the output of the following code?
str = "pynative"
print (str[1:3])
Question Preview
What is the output of the following code?
listOne = [20, 40, 60, 80]
listTwo = [20, 40, 60, 80]

print(listOne == listTwo)
print(listOne is listTwo)
Question Preview
What is the output of the following code?
def calculate (num1, num2=4):
  res = num1 * num2
  print(res)

calculate(5, 6)
Question Preview
What is the output of the following code
salary = 8000

def printSalary():
  salary = 12000
  print("Salary:", salary)
  
printSalary()
print("Salary:", salary)
Question Preview
Can we use the “else” clause for loops?
# For example:
for i in range(1, 5):
    print(i)
else:
    print("this is else block statement" )
Question Preview
What is the output of the following code?
sampleList = ["Jon", "Kelly", "Jessa"]
sampleList.append(2, "Scott")
print(sampleList)
Question Preview
What is the output of the following code?
var = "James" * 2  * 3
print(var)
Question Preview
What is the output of the following code?
p, q, r = 10, 20 ,30
print(p, q, r)
Question Preview
What is the output of the following code?
sampleSet = {"Jodi", "Eric", "Garry"}
sampleSet.add(1, "Vicki")
print(sampleSet)
Question Preview
What is the output of the following code?
for i in range(10, 15, 1):
  print( i, end=', ')
Question Preview
What is the output of the following code?
var= "James Bond"
print(var[2::-1])
Question Preview
A string is immutable in Python?