Python Quiz - Control Structure

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Priyasadhale
P
Priyasadhale
Community Contributor
Quizzes Created: 1 | Total Attempts: 770
| Attempts: 770 | Questions: 7
Please wait...
Question 1 / 7
0 %
0/100
Score 0/100
1. "if" is decision making control structure in Python.

Explanation

The statement is true because "if" is indeed a decision-making control structure in Python. It allows the program to execute a certain block of code only if a specified condition is true. This control structure is essential for implementing conditional logic and making the program more flexible and responsive to different scenarios.

Submit
Please wait...
About This Quiz
Python Quiz - Control Structure - Quiz

Take the challenge to quickly check your understanding about basic concepts in Python including control structure

2. Python executes program line by line

Explanation

Python executes a program line by line, meaning that it executes each line of code in the order it is written. This sequential execution allows for step-by-step processing of the program's instructions, ensuring that each line is executed before moving on to the next. This is a fundamental characteristic of Python and many other programming languages, allowing for control flow and the ability to perform tasks in a specific order.

Submit
3.
What is the output of below line
print("I want to read the books written by 'Sudha Murthy'")

Explanation

The output of the given line will be "I want to read the books written by 'Sudha Murthy'". This is because the print statement will display the text within the double quotes exactly as it is, including the single quotes around 'Sudha Murthy'.

Submit
4. Convert "Today is SPecial day" in all capital letters

Explanation

The correct answer is ""Today is SPecial day".upper()". This is because the .upper() method is used to convert a string to all capital letters. In this case, the given string "Today is SPecial day" will be converted to "TODAY IS SPECIAL DAY" when the .upper() method is applied to it.

Submit
5.
Guess the output
marks = 78
if marks < 0 and marks > 100:
    print("You can enter marks between 0 to 100")

Explanation

The correct answer is "no output". This is because the condition in the if statement is not satisfied. The variable "marks" is assigned a value of 78, which is neither less than 0 nor greater than 100. Therefore, the code inside the if statement will not be executed and no output will be printed.

Submit
6. Print() in Python is used for

Explanation

The correct answer is that the print() function in Python is used for printing the result of an operation, debugging the program, and displaying a message to input the data. This function allows us to output text or variables to the console or terminal. It is commonly used for displaying information during the execution of a program, making it easier to understand and debug the code. Additionally, it can be used to prompt the user to input data by displaying a message.

Submit
7. _____ is used to accept input from user

Explanation

Both the print() and input() functions are used to accept input from the user. The print() function is used to display output on the console, while the input() function is used to prompt the user to enter data. Therefore, both functions can be used to interact with the user and accept input in a Python program.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 17, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 22, 2020
    Quiz Created by
    Priyasadhale
Cancel
  • All
    All (7)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
"if" is decision making control structure in Python.
Python executes program line by line
What is the output of below line ...
Convert "Today is SPecial day" in all capital letters
Guess the output ...
Print() in Python is used for
_____ is used to accept input from user
Alert!

Advertisement