Core Concepts: Mastering Python Basics Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Swati Arya
S
Swati Arya
Community Contributor
Quizzes Created: 1 | Total Attempts: 494
Questions: 10 | Attempts: 495

SettingsSettingsSettings
Core Concepts: Mastering Python Basics Quiz - Quiz

"Core Concepts: Mastering Python Basics Quiz" is your gateway to reinforcing fundamental Python skills. This quiz is meticulously crafted for both beginners aiming to solidify their Python foundation and seasoned developers seeking a comprehensive review.

Challenge yourself with questions that assess your understanding of Python syntax, best practices, and common programming patterns. Whether you're a student, professional, or coding enthusiast, this quiz offers a well-rounded evaluation of your proficiency in Python basics.

Explore the nuances of Python's core concepts, including loops, conditionals, and error handling. Test your knowledge of data structures and their implementation in Python, from lists and tuples Read moreto dictionaries and sets. "Core Concepts" is not just a quiz; it's a roadmap to mastery, guiding you through the bedrock principles that form the backbone of Python programming.

Revisit and reinforce your Python basics, identify areas for improvement, and solidify your foundation with the "Core Concepts: Mastering Python Basics Quiz." Let this quiz be your compass on the journey to Python proficiency.


Questions and Answers
  • 1. 

    What is a correct syntax to output "Hello World" in Python?

    • A.

      Print("hello world");

    • B.

      Print("hello world")

    • C.

      Printer("hello world");

    • D.

      Printing("hello world");

    Correct Answer
    B. Print("hello world")
    Explanation
    The correct syntax to output "Hello World" in Python is print("hello world"). This statement uses the print function in Python to display the text "hello world" on the screen.

    Rate this question:

  • 2. 

    Which operator is right-associative

    • A.

      *

    • B.

      =

    • C.

      +

    • D.

      %

    Correct Answer
    B. =
    Explanation
    The = operator is right-associative. This means that when there are multiple = operators in an expression, the evaluation starts from the rightmost = operator and moves towards the left. This allows for assigning a value to multiple variables in a single statement. For example, in the expression "a = b = c", the value of c is assigned to b first, and then the value of b is assigned to a.

    Rate this question:

  • 3. 

    What is the output of the following program? L = list('123456')  L[0] = L[5] = 0 L[3] = L[-2]  print(L)   

    • A.

      [0, ‘2’, ‘3’, ‘4’, ‘5’, 0]

    • B.

      [‘6’, ‘2’, ‘3’, ‘5’, ‘5’, ‘6’]

    • C.

      [‘0’, ‘2’, ‘3’, ‘5’, ‘5’, ‘0’]

    • D.

      [0, ‘2’, ‘3’, ‘5’, ‘5’, 0]

    Correct Answer
    D. [0, ‘2’, ‘3’, ‘5’, ‘5’, 0]
    Explanation
    The program creates a list L with elements '1', '2', '3', '4', '5', '6'. Then, it assigns the value 0 to L[0] and L[5], making the list [0, '2', '3', '4', '5', 0]. Finally, it assigns the value of L[-2] (which is '5') to L[3], resulting in the final list [0, '2', '3', '5', '5', 0].

    Rate this question:

  • 4. 

    Which of these is not a core data type?

    • A.

      List

    • B.

      Dictionary

    • C.

      Tuple

    • D.

      Class

    Correct Answer
    D. Class
    Explanation
    The core data types in programming languages are the fundamental building blocks for storing and manipulating data. In this question, the options provided are list, dictionary, tuple, and class. While list, dictionary, and tuple are all core data types commonly used in programming, class is not considered a core data type. A class is a blueprint for creating objects, rather than a data type itself. It is used to define the properties and behaviors of objects, making it a higher-level concept in object-oriented programming.

    Rate this question:

  • 5. 

    What is the Output of following program? a = 4.5 b = 2 print a//b 

    • A.

      2

    • B.

      2.0

    • C.

      2.25

    • D.

      3

    Correct Answer
    B. 2.0
    Explanation
    The output of the program is 2.0. The "//" operator is used for floor division, which divides the two numbers and returns the largest integer that is less than or equal to the result. In this case, 4.5 divided by 2 equals 2.25, but since floor division returns the largest integer, the output is 2.0.

    Rate this question:

  • 6. 

    What is the output of following program? a = True b = False c = False    if not a or b:     print 1 elif not a or not b and c:     print 2 elif not a or b or not b and a:     print 3 else:     print 4

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    Correct Answer
    C. 3
    Explanation
    The output of the program is 3. This is because the condition in the third elif statement evaluates to True. The condition is "not a or b or not b and a", which can be simplified as "True or False or True". Since the first condition is True, the entire condition is True and the code inside the elif block is executed, which is to print 3.

    Rate this question:

  • 7. 

    What is the output of following program? list1 = ['physics', 'chemistry', 1997, 2000] print ("list1: ", list1[1:]) 

    • A.

      List1: ['physics', 'chemistry', 1997, 2000]

    • B.

      List1:  ['chemistry', 1997, 2000]

    • C.

      ['physics', 'chemistry', 1997, 2000]

    • D.

      ['chemistry', 1997, 2000]

    Correct Answer
    B. List1:  ['chemistry', 1997, 2000]
    Explanation
    The program creates a list called list1 with four elements: 'physics', 'chemistry', 1997, and 2000. The print statement prints the elements of list1 starting from the index 1 (the second element) onwards. Therefore, the output is "list1: ['chemistry', 1997, 2000]".

    Rate this question:

  • 8. 

    What will be the output of the following Python statement? >>>"a"+"bc"

    • A.

      A

    • B.

      Bc

    • C.

      Acb

    • D.

      Abc

    Correct Answer
    D. Abc
    Explanation
    The given Python statement is using the "+" operator to concatenate two strings. In this case, the strings are "a" and "bc". Therefore, the output of the statement will be the concatenation of these two strings, which is "abc".

    Rate this question:

  • 9. 

    Which of the following is a Python tuple?

    • A.

      [1,2,3,4]

    • B.

      (1,2,3,4)

    • C.

      {1,2,3,4}

    • D.

      {}

    Correct Answer
    B. (1,2,3,4)
    Explanation
    A Python tuple is a collection of ordered, immutable elements enclosed in parentheses. In the given options, only (1,2,3,4) is enclosed in parentheses, making it a tuple. The other options are either enclosed in square brackets (making them lists) or curly braces (making them sets).

    Rate this question:

  • 10. 

    What will be the output of the following Python code snippet? d = {"john":40, "peter":45} print("john" in d)

    • A.

      True

    • B.

      False

    • C.

      Error

    • D.

      None

    Correct Answer
    A. True
    Explanation
    The given Python code snippet creates a dictionary named 'd' with two key-value pairs. The keys are 'john' and 'peter', and the corresponding values are 40 and 45, respectively. The code then checks if the key 'john' is present in the dictionary 'd'. Since 'john' is one of the keys in the dictionary, the output will be True.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Nov 24, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 05, 2020
    Quiz Created by
    Swati Arya
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.