Anjeev Singh Academy

Python Projects for Class 11 Computer Science and Informatics Practices

Quiz Master Project in Python

The Quiz Master project is based on Python language, in which the Quiz Master will ask multiple-choice questions and ask you to input your response.

Based on your response, the Quiz Master shows your appropriate message with your score.

To develop this project you must know the following Python concepts:-

  • Basic of Python – Variables, Input, Output,
  • if – else
  • while and for loop
  • Importing Library/module
  • random module
  • List
  • Dictionary
  • Logic to build the program.

Questions.py

ques = {
    1 : {'que':'Who developed Python Programming Language?',
        'a' : 'Wick van Rossum',
        'b' :'Rasmus Lerdorf',
        'c' : 'Guido van Rossum',
        'd' : 'Niene Stom',
        'ans' : 'c'},
    2 : {'que':'Which type of Programming does Python support?',
        'a' : 'object-oriented programming',
        'b' : 'structured programming',
        'c' : 'functional programming',
        'd' : 'all of the mentioned',
        'ans': 'd'},
    3: {'que':'Is Python case sensitive when dealing with identifiers?',
        'a' : 'no',
        'b' : 'yes',
        'c' : 'machine dependent',
        'd' : 'none of the mentioned',
        'ans': 'b'},
    4 : {'que':'Which of the following is the correct extension of the Python file?',
        'a' : 'python',
        'b' : '.pl',
        'c' : '.py',
        'd' : '.p',
        'ans' : 'c'},
    5 : {'que' : 'Is Python code compiled or interpreted?',
         'a' : 'Python code is both compiled and interpreted',
         'b' : 'Python code is neither compiled nor interpreted',
         'c' : 'Python code is only compiled',
         'd' : 'Python code is only interpreted',
         'ans' :'a'},
    6 : {'que':'All keywords in Python are in _________',
         'a' : 'Capitalized',
         'b' : 'lower case',
         'c' : 'UPPER CASE',
         'd' : 'None of the mentioned',
         'ans' : 'd'},
    
    7 : {'que': 'What will be the value of the following Python expression?\n\t 4 + 3 % 5',
         'a' : '7',
         'b' : '2',
         'c' : '4',
         'd' : '1',
         'ans' : 'a'},
    8 :{'que' : 'Which of the following is used to define a block of code in Python language?',
         'a' : 'Indentation',
         'b' : 'Key',
         'c' : 'Brackets',
         'd' : 'All of the mentioned',
         'ans': 'a'},
    9 : {'que' : 'Which keyword is used for function in Python language?',
         'a' : 'Function',
         'b' : 'def',
         'c' : 'Fun',
         'd' : 'Define',
         'ans': 'b'},
    10 : {'que' : 'Which of the following character is used to give single-line comments in Python?',
          'a' : '//',
          'b' : '#',
          'c' : '!',
          'd' : '/*',
          'ans': 'b'}
    }

QuizMaster.py

from questions import ques
import random
import os

print("\t\t\tWelcome to Python Quiz Master")

name = input("Your Name ? ")

qlist=[]

score = 0
for n in range(1, 6):
    os.system("cls")

    while True:
        qno = random.randint(1,10)
        if qno not in qlist:
            qlist.append(qno)
            break
    
    print("-"*35)
    print("Question ",n,')', ques[qno]['que'])
    print("\ta. ",ques[qno]['a'])
    print()
    print("\tb. ",ques[qno]['b'])
    print()
    print("\tc. ",ques[qno]['c'])
    print()
    print("\td. ",ques[qno]['d'])
    print()

    choice = input("\t\t Write Your Option (a/b/c/d) :: ").lower()
   
   if choice == ques[qno]['ans']:
        score = score + 1
        print("\t\t\t Correct Answer! Good Keep It up.")
    else:
        print("\t\t\t Wrong Answer!")
        print("\n\nCorrect Answer is Option => ", ques[qno]['ans'])

    input("Press enter key to continue...")

os.system("cls")
print("\n\t\t\t QUIZ OVER")

print("----------------------------------------------------------------------")
print("\n\n\t\t\t\t", name.upper() , ", Your score is ", score)

if score <= 2:
    print("\t\t\t BETTER LUCK NEXT TIME")
elif score >=3 and score <=4:
    print("\t\t\t GOOD, NEED TO DO SOME MORE STUDY")
else:
    print("\t\t\t IT WAS OUTSTANDING. YOU ARE EXCELLENT")

print("----------------------------------------------------------------------")    

print("\n\n\t\t\t\t Thanks")

input("press enter key to exit...")

Keep programming.

Sorry! You cannot copy content of this page. Please contact, in case you want this content.

Scroll to Top