Binary to Decimal Conversion Quiz
16 Questions
1 Views

Binary to Decimal Conversion Quiz

Created by
@PlushSchrodinger

Questions and Answers

What is the decimal equivalent of binary number 10111101?

189

What is the binary equivalent of the decimal number 207?

11001111

What is the decimal equivalent of the following base 9 number? 235

194

What is the octal (base-8) equivalent of the decimal number 242?

<p>362</p> Signup and view all the answers

What is the decimal equivalent for the octal number 507?

<p>327</p> Signup and view all the answers

What is the value of the following arithmetic expression? (20 - 5) * (2 + 4) / 3 - 10

<p>20</p> Signup and view all the answers

What is the value of variable result given a, b, c, d = 1, 7, 2, 9; result = a + b // c * d?

<p>28</p> Signup and view all the answers

What is the value of len(s) when s = 'Fundamentals'?

<p>12</p> Signup and view all the answers

What is the highest base for which the numerical values are valid?

<p>172</p> Signup and view all the answers

What is the lowest base for which the numerical values are valid?

<p>6</p> Signup and view all the answers

What is the result of the boolean expression -5 < -5?

<p>False</p> Signup and view all the answers

What code assigns the result of 5 plus 2 multiplied by var1 to the power of var2?

<p>answer = 5 + 2 * (var1 ** var2)</p> Signup and view all the answers

How is total_price calculated from price_per_ball, num_boba_balls, and extra_weekend_rate?

<p>total_price = price_per_ball * num_boba_balls + (price_per_ball * num_boba_balls * weekend_rate)</p> Signup and view all the answers

What is the code to get the type of the variable data?

<p>information = str(type(data))</p> Signup and view all the answers

What code prints every third character from data starting from the 4th index?

<p>print(data[4:40:3])</p> Signup and view all the answers

What code prints 'Good', 'Okay', or ':(' based on the number of study_hours?

<p>if study_hours &gt;= 10: print('Good') elif study_hours &gt;= 5 and study_hours &lt; 10: print('Okay') else: print(':(')</p> Signup and view all the answers

Study Notes

Quiz Overview

  • Duration: 22 minutes and 49 seconds
  • Marks achieved: 16.32 out of 21.00
  • Grade: 77.72 out of 100.00
  • Designed for revision purposes, not a mock exam.

Key Questions and Answers

  • Decimal of binary 10111101 is 189.
  • Binary of decimal 207 is 11001111.
  • Decimal of base 9 number 235 is 194 (incorrectly answered 162).
  • Octal equivalent of decimal 242 is 362 (incorrectly answered 162).
  • Decimal of octal number 507 is 327 (incorrectly answered 377).

Data Types and Expressions

  • Internal data types for given values:
    • 42: int
    • 17.29: float
    • "Futurama": str
    • (5 > 3): bool
    • 2 + 3 * 4: int
    • 7 / 3: float
    • 17 // 5: int
    • 'g': str

Arithmetic Calculations

  • Value of (20 - 5) * (2 + 4) / 3 - 10 is 20.
  • For variables a, b, c, d assigned as 1, 7, 2, 9 respectively, result = a + b // c * d equals 28.

String Manipulation

  • Length of string s = "Fundamentals" is 12.
  • Slicing results:
    • s[:4] is 'Funda' (incorrectly answered).
    • s[-3] is 't' (incorrectly answered).

Base Validity

  • Highest valid base for given values:

    • 172 decimal: 172 valid.
    • 10110 binary: invalid (incorrectly answered).
    • ACDC hexadecimal: valid.
    • 6012 base-8: valid.
  • Lowest valid base for given values:

    • 172 decimal: invalid (incorrectly answered).
    • 10110 binary: invalid (incorrectly answered).
    • ACDC hexadecimal: valid.
    • 4012 base-6: invalid (incorrectly answered).

Boolean Expressions

  • Evaluated boolean expressions with results:
    • -5 < -5: False
    • -5 >= -5: True
    • -5 > -5: False
    • 10 == 70: False
    • 20 != 90: True
    • 10 == 10.0: True

Assignments and Calculations

  • Code for complex assignment:

    • answer = 5 + 2 * (var1 ** var2) for varying var1 and var2.
  • Total price calculation for boba balls:

    • total_price = price_per_ball * num_boba_balls + (price_per_ball * num_boba_balls * weekend_rate).

String Processing

  • Cleaned string variable:
    • cleaned = text.upper().strip() to capitalize and trim spaces.

Character Selection

  • Print every third character from index 4 to 40:
    • Use data[4:40:3] for extraction.

Conditional Statements

  • Study hours evaluation:
    • “Good” if 10 or more hours.
    • “Okay” if hours are between 5 and 10 (exclusive).
    • ":(" for fewer than 5 hours.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge on converting binary numbers to their decimal equivalents. This quiz is designed as a revision tool and will help reinforce your understanding of the topic. Remember, this quiz is not an accurate reflection of your actual exam.

Use Quizgecko on...
Browser
Browser