Intro to prog ch 3

Ace your homework & exams now with Quizwiz!

In modern Python, an int value that grows larger than the underlying hardware int A. causes an overflow B. converts to float C. breaks the computer D. uses more memory

uses more memory

The most appropriate data type for storing the value of pi is A. int B. float C. irrational D. string

float

In a mixed-type expression involving ints and floats, Python will convert A. floats to ints B. ints to strings C. both floats and ints to strings D. ints to floats

ints to floats

The value of 4! is A. 9 B. 24 C. 41 D. 120

24

The number of distinct values that can be represented using 5 bits is A. 5 B. 10 C. 32 D. 50

32

In Python, 4+5 produces the same result type as 4.0+5.0. t/f

False. 4+5 produces in integer result, while 4.0+5.0 produces a floating point result.

Operations like addition and subtraction are defined in the math library. t/f

False. Addition and subtraction are built in to Python, while the math library defines additional math functions such as pi, sqrt(x), log(x), etc. If you want to use the math library, be sure to import it with an import math statement at the beginning of the program.

A Python int can represent indefinitely large numbers. t/f

False. Python is flexible in handling large int values, but it is ultimately limited by the amount of computer memory available.

Since floating point numbers are extremely accurate, they should generally be used instead of ints. t/f

False. There are advantage to using floats--they can represent fraction or decimal values--but they have the disadvantage of being slower to calculate with, and unnecessary for some types of calculations.

The sqrt function computes the squirt of a numb t/f

False. sqrt(x) returns the square root of x.

Which of the following is not a Python type-conversion function? A. float B. round C. int D. abs

abs

The pattern used to computer factorial is A. accumulator B. input, process, output C. counted loop D. plaid

accumulator

In order to use functions in the math library, a program must include A. a comment B. a loop C. an operator D. an import statement

an import statement

What of the following is not a Python data type? A. int B. float C. rational D. string

rations

Which of the following is not a built-in operation? A. + B. % C. abs() D. sqrt()

sqrt()

A hardware float can represent a larger range of values than a hardware int. t/f

true

Computers represent numbers using base 2 representations. t/f

true

Information that is stored and manipulated by computers is called data. t/f

true

The int data type is identical to the mathematical concept of integer. t/f

true

The number of possible rearrangements of n items is equal to n!. t/f

true


Related study sets

Accounting Chapter 12 Vocabulary

View Set

Bates' Advanced Health Assessment Chapters 1-4, & 7 (Health History, HEENT)

View Set

TestOut Security Pro Semester 1 Review (Thorough version)

View Set

Microbiology by Body System - Bauman - Ch 13 Objectives

View Set

Compensation: Chapter 8: Designing Pay Levels, Mix, and Pay Structures

View Set

ACC 205 Business Law NAU Final Exam Review

View Set

Exam Review for Chapter 14: Lymphatic system and Immunity

View Set

(Exam 2) Chapter 8 Study Questions

View Set