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, freeSample questions
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.
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.
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.
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.
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.
More questions in this quiz
Answers and explanations are in the full quiz.
- Which symbol is used for comments in Python?
- How do you create a variable in Python?
- What type of data structure is a list in Python?
- What will be the output of the following code: print(type(5))?
- Which method is used to add an element to a list in Python?
- What will the following code output: print([1, 2, 3] * 2)?
- How would you call a function named 'myFunction' in Python?
- What does 'len()' function do in Python?
- What is a for loop used for in Python?
- What is the output of 'print(9 // 2)' in Python?
- What is a dictionary in Python?
- Which of the following are immutable in Python?
- What will happen if you don’t explicitly return a value from a Python function?
- What is list comprehension in Python?
- What will the following list comprehension return: [x*x for x in range(5)]?
More quizzes
Browse all Programming quizzes