Python Beginners Quiz

Reviewed by Samy Boulos
Samy Boulos, MSc (Computer Science) |
Computer Science
Review Board Member
With over 25 years of expertise, Samy is a seasoned Senior Technology Consultant. His extensive background spans diverse areas such as software development, data migration, Apple and Office 365 integration, computer helpdesk support, data engineering, and cloud computing. A dedicated professional, Samy combines technical proficiency with a strategic mindset, ensuring optimal solutions for complex technological challenges. His vast experience positions him as a reliable and knowledgeable consultant in navigating the ever-evolving landscape of IT and technology.
, MSc (Computer Science)
Created 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 Priyanshu Gupta
P
Priyanshu Gupta
Community Contributor
Quizzes Created: 2 | Total Attempts: 5,153
Questions: 14 | Attempts: 4,328

SettingsSettingsSettings
Python Beginners Quiz - Quiz

Are you interested in learning the Python language? Python is a Computer Programming language with a simplified syntax and easy-to-write style. There are many online courses here that suit your level and needs. Also, you can take our Python Beginners Quiz, which is as simple as the language itself, to see how much you know already and learn more with every question you attempt.


Questions and Answers
  • 1. 

    Which keyword allows us to load a module in Python?

    • A.

      Import

    • B.

      Load

    • C.

      Include

    • D.

      library

    Correct Answer
    A. Import
    Explanation
    The keyword "import" allows us to load a module in Python. It is used to bring in functionality from other modules into our current program. By using the "import" keyword, we can access the functions, classes, or variables defined in the module and use them in our code.

    Rate this question:

  • 2. 

    Which one from the following objects in Python is immutable?

    • A.

      Lists

    • B.

      Dictionary

    • C.

      Tuple

    • D.

      Set

    Correct Answer
    C. Tuple
    Explanation
    A tuple is immutable in Python, meaning that once it is created, its elements cannot be changed. This is in contrast to lists, dictionaries, and sets, which are mutable and can be modified after creation. 

    Rate this question:

  • 3. 

    Give the output of the following code. a = "Python Quiz" print(a[2:5])

    • A.

      Ytho

    • B.

      Tho

    • C.

      Yth

    • D.

      thon

    Correct Answer
    B. Tho
    Explanation
    The code is using string slicing to print a portion of the string "Python Quiz". The slicing notation a[2:5] means to start at the index 2 (inclusive) and end at the index 5 (exclusive). So, it will print the characters at index 2, 3, and 4, which are "t", "h", and "o" respectively. Therefore, the output will be "tho".

    Rate this question:

  • 4. 

    The ________ module is used for creating and manipulating DataFrames in Python.

    • A.

      Numpy

    • B.

      Scipy

    • C.

      Pandas

    • D.

      Collection

    Correct Answer
    C. Pandas
    Explanation
    The Pandas module is used for creating and manipulating DataFrames in Python. It provides high-performance, easy-to-use data structures and data analysis tools. With Pandas, users can efficiently handle and analyze large datasets, perform data cleaning and transformation, and perform various statistical operations. It is widely used in data science and data analysis tasks due to its flexibility and powerful features.

    Rate this question:

  • 5. 

    Which one of the following operators can perform floor division in Python?

    • A.

      /

    • B.

      **

    • C.

      /=

    • D.

      // -

    Correct Answer
    D. // -
    Explanation
    The operator "//" in Python is used to perform floor division. Floor division returns the largest integer that is less than or equal to the division of two numbers. It discards the decimal part of the division and only returns the whole number part.

    Rate this question:

  • 6. 

    Which function can add elements to the end of a list?

    • A.

      add()

    • B.

      insert()

    • C.

      Append()

    • D.

      Update()

    Correct Answer
    C. Append()
    Explanation
    The append() function is used to add elements to the end of a list. It takes a single argument, which is the element to be added, and appends it to the end of the list. This function is commonly used when you want to add new elements to an existing list without changing the order of the existing elements.

    Rate this question:

  • 7. 

    Give the output of the following code. for i in range(0,10,3):     print(i)  

    • A.

      1 4 7 10

    • B.

      0 3 6 9

    • C.

      1 3 5 7 9

    • D.

      Can’t Say

    Correct Answer
    B. 0 3 6 9
    Explanation
    The code uses a for loop to iterate through the range from 0 to 10 with a step of 3. The print statement inside the loop prints the current value of i. Since the range starts at 0 and increments by 3, the output will be 0, 3, 6, and 9.

    Rate this question:

  • 8. 

    Using the ________ statement, we can come out of a for loop in Python.

    • A.

      Break

    • B.

      continue

    • C.

      End

    • D.

      Stop

    Correct Answer
    A. Break
    Explanation
    The break statement in Python is used to exit a loop prematurely. When the break statement is encountered within a for loop, the loop is immediately terminated, and the program execution continues with the next statement after the loop. Therefore, using the break statement allows us to exit a for loop in Python.

    Rate this question:

  • 9. 

    What is the syntax of accessing a value using its key in Python?

    • A.

      dictionary_name(key)

    • B.

      Key-dictionary_name

    • C.

      Dictionary_name[key]

    • D.

      None of the above

    Correct Answer
    C. Dictionary_name[key]
    Explanation
    The correct syntax for accessing a value using its key in Python is dictionary_name[key]. This syntax allows you to retrieve the value associated with a specific key in a dictionary. By using the square brackets and the key inside them, you can access the corresponding value in the dictionary.

    Rate this question:

  • 10. 

    Give the output of the following code. lst = ['Mark','Jay',' Jack','Steve','Arnold'] print(lst[-2])

    • A.

      Jay

    • B.

      Steve

    • C.

      Arnold

    • D.

      Mark

    Correct Answer
    B. Steve
    Explanation
    The code is creating a list called "lst" with the values 'Mark', 'Jay', 'Jack', 'Steve', and 'Arnold'. The code then prints the value at index -2 of the list, which is 'Steve'.

    Rate this question:

  • 11. 

    How to make comments in Python?

    • A.

      //This is a comment

    • B.

      /*This is a comment

    • C.

      %This is a comment

    • D.

      #This is a comment

    Correct Answer
    D. #This is a comment
    Explanation
    In Python, comments can be declared using the "#" symbol. The given answer "#This is a comment" correctly demonstrates the declaration of a comment in Python.

    Rate this question:

  • 12. 

    Which operator has the highest precedence in the following?

    • A.

      * multiplication operator

    • B.

      + addition operator

    • C.

      & Bitwise AND

    • D.

      == Comparison Operator

    Correct Answer
    A. * multiplication operator
    Explanation
    The multiplication operator (*) has the highest precedence among the given operators. This means that when an expression contains multiple operators, the multiplication operator will be evaluated first before the addition operator (+), bitwise AND operator (&), and comparison operator (==).

    Rate this question:

  • 13. 

    Give the output of the following code. c = 2 ** 3 + 4 * 2 print(c)

    • A.

      26

    • B.

      16

    • C.

      14

    • D.

      12

    Correct Answer
    B. 16
    Explanation
    The code calculates the value of c using the mathematical operations in the expression. First, it performs the exponentiation operation 2 ** 3, which equals 8. Then, it multiplies 4 by 2, resulting in 8 as well. Finally, it adds the two results together, giving a final value of 16.

    Rate this question:

  • 14. 

    Which one of the following functions can sort a list in Python?

    • A.

      arrange()

    • B.

      Sorted()

    • C.

      Order()

    • D.

      None of the above

    Correct Answer
    B. Sorted()
    Explanation
    The sorted() function in Python can sort a list. It takes a list as input and returns a new list with the elements sorted in ascending order. Therefore, out of the given options, sorted() is the correct function to use for sorting a list in Python.

    Rate this question:

Samy Boulos |MSc (Computer Science) |
Computer Science
With over 25 years of expertise, Samy is a seasoned Senior Technology Consultant. His extensive background spans diverse areas such as software development, data migration, Apple and Office 365 integration, computer helpdesk support, data engineering, and cloud computing. A dedicated professional, Samy combines technical proficiency with a strategic mindset, ensuring optimal solutions for complex technological challenges. His vast experience positions him as a reliable and knowledgeable consultant in navigating the ever-evolving landscape of IT and technology.

Quiz Review Timeline +

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

  • Current Version
  • Jun 17, 2024
    Quiz Edited by
    ProProfs Editorial Team

    Expert Reviewed by
    Samy Boulos
  • Oct 06, 2021
    Quiz Created by
    Priyanshu Gupta

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.