Python 3 Basic Programming Test

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 Cripstwick
C
Cripstwick
Community Contributor
Quizzes Created: 636 | Total Attempts: 795,498
Questions: 10 | Attempts: 940

SettingsSettingsSettings
Python 3 Basic Programming Test - Quiz

Python is one of the most popular programming languages in the world today. Python 3.0 was released in the late 2000s as a backwards-incompatible release. If you're just learning Python 3 or want to know how it works, take this basic programming test to assess your knowledge.


Questions and Answers
  • 1. 

    Python has how many standard data types?

    • A.

      3

    • B.

      4

    • C.

      5

    • D.

      6

    Correct Answer
    C. 5
    Explanation
    Python has five standard data types. These data types include numbers, strings, lists, tuples, and dictionaries. Each data type has its own characteristics and uses in programming. Numbers are used for mathematical calculations, strings are used for text manipulation, lists are used to store multiple items, tuples are used to store immutable sequences, and dictionaries are used to store key-value pairs. These data types provide flexibility and functionality to Python programmers for various tasks and operations.

    Rate this question:

  • 2. 

    What is the output of print str[0] if str = ‘Hello World!’?

    • A.

      Hello

    • B.

      Hello World

    • C.

      H

    • D.

      W

    Correct Answer
    C. H
    Explanation
    The correct answer is "H" because when we access the element at index 0 of the string "Hello World!", it returns the first character of the string which is "H".

    Rate this question:

  • 3. 

    What is the difference between tuples and lists?

    • A.

      Tuples are enclosed within parentheses while list are not.

    • B.

      Tuples are enclosed with brackets while lists are not

    • C.

      Tuples are bullet points while lists are numbers

    • D.

      Tuples are in Roman figures while lists are alphabetical

    Correct Answer
    A. Tuples are enclosed within parentheses while list are not.
    Explanation
    Tuples and lists are both used to store multiple items in Python. The main difference between them is that tuples are immutable, meaning their values cannot be changed once they are created, while lists are mutable and can be modified. Tuples are enclosed within parentheses, while lists are not. This difference in syntax allows for easy identification and differentiation between the two data types.

    Rate this question:

  • 4. 

    What is the process of retrieving original Python objects from the stored string representation?

    • A.

      Picking

    • B.

      Selecting

    • C.

      Retrieving

    • D.

      Unpicking

    Correct Answer
    D. Unpicking
    Explanation
    The process of retrieving original Python objects from the stored string representation is called unpicking.

    Rate this question:

  • 5. 

    What manages memory in Python?

    • A.

      Memory cache

    • B.

      Development space

    • C.

      Private heap space

    • D.

      Collector

    Correct Answer
    C. Private heap space
    Explanation
    Private heap space manages memory in Python. In Python, every object is stored in a private heap, and the interpreter takes care of allocating and deallocating the memory for these objects. The private heap space is where all the objects and data structures are stored during the execution of a Python program. The garbage collector, which is responsible for freeing up memory that is no longer in use, also operates within the private heap space.

    Rate this question:

  • 6. 

    Which of these statements is true for lists and tuples? 

    • A.

      Lists are mutable, tuples are not

    • B.

      Tuples are mutable, lists are not

    • C.

      Tuples are numerical figures, lists are not

    • D.

      Lists are numerical figures, tuples are not

    Correct Answer
    A. Lists are mutable, tuples are not
    Explanation
    Lists and tuples are both types of data structures in Python. The correct statement is that lists are mutable, while tuples are not. This means that elements in a list can be modified, added, or removed after the list is created. On the other hand, elements in a tuple cannot be changed once the tuple is created. Tuples are considered immutable because they provide data integrity and are often used to store related pieces of information that should not be modified.

    Rate this question:

  • 7. 

    Which of these is not a mutable built-in type Python? 

    • A.

      Lists

    • B.

      Sets

    • C.

      Strings

    • D.

      Dictionaries

    Correct Answer
    C. Strings
    Explanation
    In Python, strings are immutable, which means that once a string is created, it cannot be changed. This is in contrast to lists, sets, and dictionaries, which are mutable and can be modified after creation. Therefore, the correct answer is strings.

    Rate this question:

  • 8. 

    What command can you use to delete a file in Python? 

    • A.

      Os.remove (filename)

    • B.

      Os.delete (filename)

    • C.

      Os.clean (filename)

    • D.

      Os.terminate (filename)

    Correct Answer
    A. Os.remove (filename)
    Explanation
    The correct answer is os.remove (filename). This command is used in Python to delete a file. The os module provides various functions for interacting with the operating system, and os.remove() specifically allows you to delete a file by specifying its filename as an argument.

    Rate this question:

  • 9. 

    What is the use of // operator in Python?

    • A.

      Or

    • B.

      Division

    • C.

      Separation

    • D.

      List

    Correct Answer
    B. Division
    Explanation
    The // operator in Python is used for division. It performs floor division, which means it returns the largest integer that is less than or equal to the result of the division. This is different from the / operator, which returns the exact quotient as a float. The // operator can be useful when you want to divide two numbers and obtain an integer result without any decimal places.

    Rate this question:

  • 10. 

    What is the output of print tuple[0] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?

    • A.

      John

    • B.

      Abcd

    • C.

      786

    • D.

      70.2

    Correct Answer
    B. Abcd
    Explanation
    The correct answer is "abcd" because in Python, tuples are ordered and indexed starting from 0. Therefore, when we access the element at index 0 of the tuple, we get the first element, which is "abcd".

    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
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 29, 2018
    Quiz Created by
    Cripstwick

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.