Python Basics Quiz: Test Your Knowledge

✅ Python Basics Quiz — How Many Did You Get Right? Test your knowledge of Python fundamentals with this quick 10-question quiz. Let’s see how you did! 💡 --- 1️⃣ What does the following code print? ``` print("Hello, Python") ``` ✔️ Answer: B. Hello, Python Explanation: print() displays the string exactly as written inside the quotes. 2️⃣ Which of these is a valid variable name in Python? ✔️ Answer: B. name_1 Explanation: Variable names can't start with a number or contain special characters like - or @. 3️⃣ What is the output of this code? ``` print(10 // 3) ``` ✔️ Answer: B. 3 Explanation: // is floor division — it returns the whole number part of the division. 4️⃣ What is the data type of this value: "25" ✔️ Answer: C. str Explanation: Even though it looks like a number, it's in quotes — so it's a string. 5️⃣ What does input() return by default? ✔️ Answer: C. str Explanation: input() always returns a string, even if you type a number. 6️⃣ Which operator is used for string repetition? ✔️ **Answer: B. *** Explanation: The * operator repeats a string. For example, "Hi" * 3 gives "HiHiHi". 7️⃣ What will this code output? ``` print("Hi " * 2) ``` ✔️ Answer: C. Hi Hi Explanation: The string "Hi " is repeated twice, including the space. 8️⃣ Which of the following is NOT a valid Python data type? ✔️ Answer: B. decimal Explanation: Python uses float for decimal numbers. decimal is not a built-in type. 9️⃣ What does this code do? ``` age = int(input("Enter age: ")) print(age + 5) ``` ✔️ Answer: A. Adds 5 to the input number Explanation: The input is converted to an integer, then 5 is added. 🔟 What is the correct way to check the type of a variable x? ✔️ Answer: C. type(x) Explanation: type() is the built-in function to check the data type of a variable. --- 🧠 If you scored 7/10 or above, you're on the right track! If some questions were tricky, no worries — Python is a journey, not a sprint. 💪 Want to strengthen your Python foundation? EITA Academy's Beginner-Friendly Python Program covers everything from core basics to real-world projects — with expert mentorship and career guidance. Ready to take your coding skills to the next level? Drop a “🧠” in the comments or DM “PYTHON” for details! --- Double tap ♥️ if you found this useful. Follow EITA Academy for more Python tips, quizzes & tutorials. 🔗 Stay Connected 🎬 YouTube – Watch tutorials & success stories: https://lnkd.in/gqv4hTMe 📸 Instagram – Follow for tips & updates: https://lnkd.in/gVW9inS6 🤝 Join our WhatsApp Learning Community: https://lnkd.in/gMURk-nE #PythonQuiz #PythonBasics #LearnToCode #PythonProgramming #CodingQuiz #PythonForBeginners #ProgrammingLogic #EITAcademy #TechSkills #CodeNewbie #TechEducation #DataScience #AI #DeveloperJourney #LinkedInLearning

To view or add a comment, sign in

Explore content categories