Python Quiz Challenge 2026 ЁЯРН | Can You Solve These Python MCQs?

Python MCQ Questions with Explanation

Python MCQ Questions with Explanation

1. Which module is used to interact with the operating system in Python?
Question:
Which module is used to interact with the operating system in Python?
Options:
  • A. sys
  • B. json
  • C. math
  • D. os
Correct Answer:
✅ D. os
Explanation:

The os module in Python is used to interact with the operating system. It allows you to perform tasks such as:

  • Working with files and directories
  • Getting environment variables
  • Running system commands
  • Checking file paths
Example:
import os print(os.getcwd())

This prints the current working directory.

2. What does this code print?
import os print(os.getcwd())
Options:
  • A. List of files
  • B. Current working directory
  • C. Python version
  • D. System memory
Correct Answer:
✅ B. Current working directory
Explanation:

The function os.getcwd() means Get Current Working Directory. It returns the path of the directory where the Python program is currently running.

Example output:
C:\\Users\\Aditya\\Desktop

This tells Python where your script is executing.

3. Which function converts a Python dictionary into a JSON string?
Options:
  • A. json.load()
  • B. json.dump()
  • C. json.dumps()
  • D. json.loads()
Correct Answer:
✅ C. json.dumps()
Explanation:

The json.dumps() function converts a Python object (like dictionary) into a JSON formatted string.

Example:
import json data = {"name": "Aadi", "age": 22} json_data = json.dumps(data) print(json_data)

Output:
{"name": "Aadi", "age": 22}
So it converts Python → JSON string.

4. What does this code do?
import sys print(sys.version)
Options:
  • A. Prints operating system name
  • B. Prints Python version
  • C. Prints system memory
  • D. Prints file list
Correct Answer:
✅ B. Prints Python version
Explanation:

The sys.version command displays the version of Python currently installed.

Example output:
3.11.2 (main, Jan 15 2026, 10:22:33)

It helps developers know which Python version is running.

5. What is the purpose of json.load()?
Options:
  • A. Convert Python object to JSON string
  • B. Read JSON data from file into Python object
  • C. Write JSON to file
  • D. Delete JSON file
Correct Answer:
✅ B. Read JSON data from file into Python object
Explanation:

The json.load() function reads JSON data from a file and converts it into a Python object.

Example:
import json with open("data.json") as f: data = json.load(f) print(data)

python quiz
python mcq
python programming quiz
python mcq questions
python interview questions
python coding quiz
python questions and answers
python beginner quiz
learn python quiz
python practice questions
python test
coding quiz
programming quiz
python mcq for beginners

Related Posts --   Daily Current Affairs   Computer GK Quiz    UP GK Quiz

рдЯिрдк्рдкрдгिрдпाँ

Top Quizzes

100 Hard Level UP GK & GS Quiz in Hindi 2026: рд╕рднी рд╕рд░рдХाрд░ी рдкрд░ीрдХ्рд╖ाрдУं рдХे рд▓िрдП рдорд╣рдд्рд╡рдкूрд░्рдг рдк्рд░рд╢्рди

Top 50 Pattern Programming Questions with Python Solutions

Interesting GK Questions (AI & Modern)

Complete Data Engineering Roadmap for Beginners (Step-by-Step Guide for Students)

Computer GK Questions in Hindi 2026 – SSC, Railway, UP Police Important MCQ

GK Question || GK In Hindi || GK Question and Answer || GK Quiz

Python OOP Encapsulation Explained ЁЯФР | Private, Protected & Public Variables

UP GK Mock Test 2026: 100 qution рдЙрдд्рддрд░ рдк्рд░рджेрд╢ рд╕ाрдоाрди्рдп рдЬ्рдЮाрди рдорд╣рдд्рд╡рдкूрд░्рдг рдк्рд░рд╢्рдиोрдд्рддрд░ी