PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Basic Python Quiz For Beginners

Basic Python Quiz For Beginners

Updated on: August 24, 2022 | 112 Comments

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 in Python functions, string, operators, functions, set, and lists.

The quiz contains 18 Questions. Solve 10 correct to pass the test.

  • Read Python Basics to solve this quiz.
  • Also, Solve Python Basic Exercise for Beginners.

1. A string is immutable in Python?

Every time when we modify the string, Python Always create a new String and assign a new string to that variable.

 
 

2. What is the output of the following code?

var= "James Bond"
print(var[2::-1])
 
 
 
 

3. What is the output of the following code?

def calculate (num1, num2=4):
  res = num1 * num2
  print(res)

calculate(5, 6)

Hint: functions in Python

 
 
 

4. What is the output of the following code

salary = 8000

def printSalary():
  salary = 12000
  print("Salary:", salary)
  
printSalary()
print("Salary:", salary)
 
 
 

5. Can we use the “else” block for for loop?

for example:

for i in range(1, 5):
    print(i)
else:
    print("this is else block statement" )
 
 

6. 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)
 
 
 

7. What is the output of the following code?

valueOne = 5 ** 2
valueTwo = 5 ** 3

print(valueOne)
print(valueTwo)
 
 
 

8. What is the output of the following code?

sampleList = ["Jon", "Kelly", "Jessa"]
sampleList.append(2, "Scott")
print(sampleList)
 
 
 
 

9. Which operator has higher precedence in the following list

 
 
 
 

10. What is the output of the following code?

str = "pynative"
print (str[1:3])
 
 
 
 

11. What is the Output of the following code?

for x in range(0.5, 5.5, 0.5):
  print(x)
 
 
 

12. What is the output of the following code?

p, q, r = 10, 20 ,30
print(p, q, r)
 
 
 

13. What is the output of the following code?

sampleSet = {"Jodi", "Eric", "Garry"}
sampleSet.add(1, "Vicki")
print(sampleSet)
 
 
 

14. The in operator is used to check if a value exists within an iterable object container such as a list. Evaluate to True if it finds a variable in the specified sequence and False otherwise.

 
 

15. What is the output of the following code?

var = "James" * 2  * 3
print(var)
 
 
 

16. What is the output of the following code?

var1 = 1
var2 = 2
var3 = "3"

print(var1 + var2 + var3)
 
 
 
 

17. What is the output of the following

x = 36 / 4 * (3 +  2) * 4 + 2
print(x)

Hint: Python Operators Precedence

 
 
 
 

18. What is the output of the following code?

for i in range(10, 15, 1):
  print( i, end=', ')

Hint: Python range function

 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Basics Python Quizzes

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com