Python Programming Module 1: Quiz!

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 Rajeev Dave
R
Rajeev Dave
Community Contributor
Quizzes Created: 1 | Total Attempts: 620
| Attempts: 620 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Which of the following statements is true?

Explanation

The statement "All of the above" is the correct answer because all three statements are true. Python is a high-level programming language, meaning it is designed to be easily readable and understandable by humans. Python is also an interpreted language, which means that it does not need to be compiled before running, allowing for faster development and testing. Additionally, Python is an object-oriented language, which means it supports the creation and manipulation of objects to solve problems. Therefore, all three statements are true.

Submit
Please wait...
About This Quiz
Python Programming Module 1: Quiz! - Quiz

Python Programming Module 1: Quiz evaluates foundational Python skills. It covers syntax, operations, error handling, and array manipulations, assessing learners' ability to apply Python in programming contexts effectively.

2. What is the output of >>> 5.5=5?

Explanation

The correct answer is "Syntax Error: can't assign to literal". In Python, the "=" symbol is used for variable assignment, not for comparing values. Therefore, trying to assign a value to a literal like 5.5 will result in a syntax error.

Submit
3. What is the output of the below program? >>> a = [4,7,3,2,5,9] >>> a[-2]  

Explanation

The program creates a list called 'a' with the elements [4,7,3,2,5,9]. The expression 'a[-2]' accesses the second element from the end of the list, which is 5. Therefore, the output of the program is 5.

Submit
4. What is used to define a block of code (body of loop, function etc.) in Python?

Explanation

In Python, a block of code is defined using indentation. This means that instead of using curly braces or parentheses like in other programming languages, Python uses the indentation level to determine which lines of code belong to a particular block. This helps in improving code readability and ensures that the code is properly structured.

Submit
5. What is the output of the below program? >>> 'abc' * 3

Explanation

The output of the program is "abcabcabc". This is because the string 'abc' is multiplied by 3 using the * operator, which concatenates the string with itself three times.

Submit
6. The following Python code – >>> 2.0 + 2

Explanation

The given Python code is performing addition between a float (2.0) and an integer (2). In Python, when performing arithmetic operations between different numeric types, the result will be of the more precise type. In this case, since 2.0 is a float and 2 is an integer, the result will be a float. Therefore, the correct answer is 4.0.

Submit
7. What is the output of the following program? >>> word = 'abcdefghij' >>> print (word[:3] + word[3:])

Explanation

The program takes a string "word" with the value "abcdefghij". It then uses slicing to concatenate the substring from index 0 to index 3 (exclusive) with the substring from index 3 to the end of the string. This essentially combines the entire string, resulting in the output "abcdefghij".

Submit
8. What is the output of the below program? >>> S = "NCR Gurgaon" >>>  S[1:5]

Explanation

The output of the program is "CR G". This is because the slice notation [1:5] extracts the characters from index 1 to index 4 (excluding index 5) from the string "NCR Gurgaon". Therefore, the characters "CR G" are returned as the output.

Submit
9. Which of the following is true of Python but not of C or Java?

Explanation

In Python, indentation is used to define block statements, which means that the code within a block is indented at the same level. This is not the case in C or Java, where block statements are defined using braces {}. In C and Java, line breaks are used to end a statement, while in Python, line breaks are not required to end a statement. Additionally, Python has more than two forms of looping, unlike the statement that says "Only two forms of looping are used." Therefore, the correct answer is "Indentation is used for block statements."

Submit
10. What is the order of operation is Python?

Explanation

The order of operations in Python follows the PEMDAS rule, which stands for Parentheses, Exponents, Multiplication and Division (from left to right), and Addition and Subtraction (from left to right). This rule determines the sequence in which mathematical operations are performed in an expression.

Submit
View My Results

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

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

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 15, 2019
    Quiz Created by
    Rajeev Dave
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following statements is true?
What is the output of >>> 5.5=5?
What is the output of the below program? ...
What is used to define a block of code (body of loop, function etc.)...
What is the output of the below program? ...
The following Python code – >>> 2.0 + 2
What is the output of the following program?...
What is the output of the below program? ...
Which of the following is true of Python but not of C or Java?
What is the order of operation is Python?
Alert!

Advertisement