Any2Quiz
Quizzes / CBSE / Class 7 / Computer Science / Programming

Programming in Python Quiz - CBSE Class 7 Computer Science

Free practice quiz: Programming in Python (CBSE Class 7 Computer Science). 20 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

This CBSE Class 7 Computer Science practice quiz has 20 multiple-choice questions on Programming in Python, and 20 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.

Start quiz: 20 questions, free

Sample questions

  1. What does the print() function do in Python?

    Show answer

    Answer: A. Displays output to the console

    The print() function is used to display output on the console in Python.

  2. What does 'def' keyword do in Python?

    Show answer

    Answer: A. Defines a function

    The 'def' keyword is used to define a function in Python.

  3. What is the correct syntax to create a function in Python?

    Show answer

    Answer: B. def myFunction():

    The correct syntax to define a function in Python starts with the keyword 'def' followed by the function name and parentheses.

  4. Which of the following keywords is used to handle exceptions in Python?

    Show answer

    Answer: A. try

    The 'try' keyword is used to start a block of code to be tested for errors.

  5. What is the purpose of the 'return' statement in a function?

    Show answer

    Answer: B. To provide output to the calling code

    The 'return' statement is used to send a result back to the caller of the function.

Take the full quiz

More questions in this quiz

Answers and explanations are in the full quiz.

  1. Which symbol is used for comments in Python?
  2. How do you create a variable in Python?
  3. What type of data structure is a list in Python?
  4. What will be the output of the following code: print(type(5))?
  5. Which method is used to add an element to a list in Python?
  6. What will the following code output: print([1, 2, 3] * 2)?
  7. How would you call a function named 'myFunction' in Python?
  8. What does 'len()' function do in Python?
  9. What is a for loop used for in Python?
  10. What is the output of 'print(9 // 2)' in Python?
  11. What is a dictionary in Python?
  12. Which of the following are immutable in Python?
  13. What will happen if you don’t explicitly return a value from a Python function?
  14. What is list comprehension in Python?
  15. What will the following list comprehension return: [x*x for x in range(5)]?

More quizzes

Browse all Programming quizzes

More to play

Daily ChallengeA new quiz every day. Keep your streak.HangmanGuess the word, letter by letter.Story QuestLearn through short interactive stories.All quizzesCBSE, ICSE, competitive exams and more.