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: 753
| Attempts: 756
SettingsSettings
Please wait...
  • 1/7 Questions

    Print() in Python is used for

    • Print result of operation
    • Debug the program
    • To display message to input the data
    • None of the above
Please wait...
Programming Quizzes & Trivia
About This Quiz

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


Quiz Preview

  • 2. 

    Python executes program line by line

    • True

    • False

    Correct Answer
    A. True
    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.

    Rate this question:

  • 3. 

    "if" is decision making control structure in Python.

    • True

    • False

    Correct Answer
    A. True
    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.

    Rate this question:

  • 4. 

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

    • Syntax error

    • I want to read the books written by Sudha Murthy

    • I want to read the books written by 'Sudha Murthy'

    • No idea

    Correct Answer
    A. 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'.

    Rate this question:

  • 5. 

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

    • No output

    • It will print You can enter marks between 0 to 100

    • Error: if can not have multiple conditions

    • TypeError

    Correct Answer
    A. No output
    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.

    Rate this question:

  • 6. 

    Convert "Today is SPecial day" in all capital letters

    • Data = "Today is SPecial day" print(data)  

    • "Today is SPecial day".lower()

    • Upper("Today is SPecial day")

    • "Today is SPecial day".upper()

    Correct Answer
    A. "Today is SPecial day".upper()
    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.

    Rate this question:

  • 7. 

    ________ is used to accept input from user

    Correct Answer
    print(), input(), both
    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.

    Rate this question:

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.