Python Review

10 Questions | Attempts: 121
Share

SettingsSettingsSettings
Python Programming Quizzes & Trivia

This is a review quiz for the BAVC Open Source Software class. It contains questions about programming in python and open-ended questions about open source.


Questions and Answers
  • 1. 

    In programming, there are different data types...(in Python, they are stored as objects)Which one is an integer?

    • A.

      .02

    • B.

      "40"

    • C.

      67

    • D.

      12.2

    • E.

      Str(4)

    Correct Answer
    C. 67
  • 2. 

    In programming, there are different data types...(in Python, they are stored as objects)Which one is a string?

    • A.

      3.2

    • B.

      Int("642")

    • C.

      3

    • D.

      "821"

    • E.

      Apple

    Correct Answer
    D. "821"
  • 3. 

    ["abc", 123, party]The above is an example of a _______ data/object type.

    Correct Answer
    list
  • 4. 

    {"first_name":"Mary", "last_name":"Ann", "age":20}The above is an example of a _______ data/object type.

    Correct Answer
    dictionary
    dict
  • 5. 

    Fruits = ["apple","banana","coconut"]How do you print coconut, using above variable? (Python code only)

    Correct Answer
    fruits[2]
  • 6. 

    Weather_forecast = {"monday":"rainy","tuesday":"sunny","wednesday":"cloudy"}How do you print the weather for wednesday, using above variable? (Python code only)

    Correct Answer
    weather_forecast["wednesday"]
  • 7. 

    In Python, what do you get when you multiply 23.0 by 4?Also, what kind of data/object type is it?

    • A.

      92 => float

    • B.

      92.0 => integer

    • C.

      "92.0" => string

    • D.

      92 => integer

    • E.

      92.0 =>float

    Correct Answer
    E. 92.0 =>float
  • 8. 

    Briefly describe the following data/object types:1. Integers2. Floats3. Strings4. Lists5. Dictionaries(Hint: What kind of information do they each store?)

  • 9. 

    In programming, what is a function?Also, write a function in Python that returns "Hello World!" whenever it's called.

  • 10. 

    In programming, what is a class?Also, write a class in Python called "Person" that has a name, age, and can introduce itself (Hint: function).

Quiz Review Timeline +

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

  • Current Version
  • Jul 30, 2011
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 12, 2010
    Quiz Created by
    Zeromerk

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.