CS125 Quiz 4 Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is done to obtain a substring? A. Slicing. B. Segmenting. C. Sectioning. D. Separating. E. Severing.

A

Text files are stored in where? A. Primary memory B. Secondary memory C. Backup memory D. Hardened memory E. None of the above

B

Which is true of lists and strings? A. Strings are more general than lists. B. Lists are always sequences of characters, whereas strings can contain values of any type. C. Neither strings nor lists are more general. D. Strings are always sequences of characters, whereas lists can contain values of any type. E. All of the above

B

Which of the following is a kind of encryption system? A. Locked Key B. Private Key C. Access Key D. Quarantined Key E. Secure Key

B

Which of the following statements shows the correct syntax for invoking the square root function after having imported the math library? A. discRoot = sqrt(<expr>). B. discRoot = math.sqrt(<expr>). C. discRoot = sqrt.math(<expr>). D. discRoot = math%sqrt(<expr>). E. discRoot = math.sqrt"<expr>".

B

What character will be printed from the following command? night = "Goodnight" print(night[-4]) A. o B. d C. n D. i E. g

D

What statement is true about float values and int values? A. if you don't need fractional values, use an int. B. int values are always exact. C. float type can only represent approximations to real numbers. D. whole numbers are represented using the int data type while the ones with fractional parts are represented by floating-point values. E. all of the above.

E

When converting a float data value to an int data value, what happens to the fractional part of the float value? A. It stays with the int value but is not displayed. B. The float value is rounded up to the nearest whole number integer, eliminating the fractional part. C. The float value is rounded down to the nearest whole number integer, eliminating the fractional part. D. The fractional part is temporarily stored in a separate variable. E. The fractional part is truncated from the integer part.

E

A byte of memory can store how many different values? A. 256 B. 250 C. 265 D. 260 E. 266

A

A list can contain the following: A. numbers and strings B. only numbers C. only strings D. neither numbers or strings E. None of the above.

A

Accessing a single character out of a string is called? A. Indexing B. Slicing C. Concatenation D. Assignment E. None of the above

A

How is text represented in programs? A. string data B. print C. variables D. 1s and 0s E. None of the above.

A

In python programming what indicates slicing? A. ([:]) B. ([]) C. (+) D. (*) E. None of the above

A

Typically, how many bits do PC's use? A. 32 or 64 bits. B. 128 or 512 bits. C. 64 or 128 bits. D. 0 or 32 bits. E. 32 or 128 bits.

A

What are the two different types of encryption systems? A. Private key, public key B. ssh, cmd C. Locked, unlocked D. CTV, Digital E. Wireless, wired

A

What character will be printed out from indexing character 11 in the following prompt? >>> phrase = "Stay golden Ponyboy" >>> phrase[11] A. ' ' B. 'P' C. 'n' D. 'o' E. 'e'

A

What does ASCII stand for? A. American Standard Code for Information Interchange B. American Society of Coders for Information Interchange C. American Standard Code for Informative Interchange D. American Society of Coders for Informative Interchange E. Australian Standard of Coders for Information Interchange

A

What does it mean if lists are mutable? A. The value of an item in a list can be modified with an assignment statement. B. The value of an item in a list cannot be modified with an assignment statement. C. Lists can be shut off at any time using control and d. D. Nothing can be done to modify a list. E. None of the above.

A

What is one of the advantages to using ints rather than floats in an operation? A. Ints are exact numbers, while floats are approximations. B. Most data used in programming is in integer format. C. Modern processors cannot compute float operations as fast as int operations. D. Int operations are easier to program than float operations. E. Many programming languages do not support float operations.

A

What is size is typically considered the smallest recognized piece? A. 8 bits B. 16 bits C. 32 bits D. 256 bits E. 512 bits

A

What is the ASCII standard? A. It uses the numbers 0 through 27 to represent the characters found on a (American) computer keyboard. B. It uses the numbers 0 through 30 to represent the characters found on a (American) computer keyboard. C. It uses the numbers 0 through 20 to represent the characters found on a (American) computer keyboard. D. It uses the numbers 0 through 35 to represent the characters found on a (American) computer keyboard. E. It uses the numbers 0 through 25 to represent the characters found on a (American) computer keyboard.

A

What is the correct output of 20//9 ? A. 2 B. 2.22 C. .22 D. .02 E. 2.02

A

What is the result of "10//2" in the Python program? A. 5 B. 4.9 C. 4 D. 5.0 E. none of the above

A

Which of the following operations will successfully tell you how many characters are in a string? A. len(<string>) B. print(char C. <string> D. +characters E. None of the above.

A

Which operator builds a string by "gluing" two strings together? A. (+) , Concatenation. B. (-) , Repetition. C. <string>[] , Indexing. D. <string>[:] , Slicing. E. len(<string>), Length.

A

What function gives the unicode value of a character?

ASCII

<string> [ ] is a string operator which is: A. Concatenation. B. Indexing. C. Slicing. D. Repetition. E. Iteration through characters.

B

How do you copy a statement with all letters capitalized? A. s.capitalize() B. s.upper() C. s.uppercase() D. s.capital() E. s.capitol()

B

The string "slots" that are filled in by the format method in python? A. [] B. {} C. $ D. % E. All of the above

B

What does a string look like in Python? A. *string* B. <string> C. %string% D. print("string") E. string

B

What does ceil(x) mean in python code? A. Find (x) B. Ceiling of (x) C. Find the logarithm of (x) D. The absolute value of (x) E. The value closest to negative infinity of (x)

B

What does the * symbol do with string data? A. Concatenation B. Repetition C. Slicing D. Indexing E. Processing

B

What is a string? A. an algorithm B. a sequence of characters C. a greeting from Python D. a program for printing exact words E. None of the above

B

What is indexing? A. Tells how many characters are in a string. B. Accessing how many characters are in a string. C. Concentrating. D. Mutable lists. E. Control codes.

B

What is not a python operation? A. * B. <= C. / D. - E. +

B

What is the character \n called? A. New B. Newline C. Newprint D. Newspace E. None of the above

B

What is the correct output of 100%3 A. 33 B. 1 C. 11 D. 33.33 E. 33%

B

What is the difference between using / for division versus //? A. We don't use // for division. B. Using / will always return a float, // will show an integer. C. // is actually used for exponentiation. D. Using / will show an integer, using // will return a float. E. There is no difference.

B

What is the output of the following interactive Python session? >>> sentenceOne = "Python is Fun! " >>> sentenceTwo = "Python is Difficult!" >>> sentenceOne * 3 + sentenceTwo * 2 A. 'Python is Fun!Python is Fun!Python is Fun!Python is Difficult! Python is Difficult!' B. 'Python is Fun! Python is Fun! Python is Fun! Python is Difficult!Python is Difficult!' C. 'Python is Fun! Python is Difficult!Python is Fun! Python is Difficult!Python is Fun!' D. 'Python is Fun!!! Python is Difficult!!' E. None of the Above

B

What is the solution of ((8 * 8)//(9 + 20)) A. 93 B. 2 C. 64 D. 29 E. 2.2068

B

What statement is true about converting float to an int? A. it is safe to do it. B. is a dangerous step because some information will be lost. C. you cannot convert a float into an int. D. always convert float to an int to make the calculations correctly. E. none of the above.

B

Which operator builds a string by multiple concatenations of a string with itself? A. (+) , Concatenation. B. (-) , Repetition. C. <string>[] , Indexing. D. <string>[:] , Slicing. E. len(<string>), Length.

B

Which operator is used for slicing? A. <string>[ ] B. <string>[ : ] C. len(<string>) D. for <var> in <string> E. none of the above

B

A list is mutable, meaning: A. It can not be changed B. It can not be added to C. It can be changed D. It can not be subtracted from E. All of the above.

C

Another phrase for a shared key system is A. Public key system. B. Linked system. C. Private key system. D. Mutual key system. E. Common key system.

C

Copy of s with leading white space removed. The function for this meaning: A. s. rjust. B. s. replace. C. s. 1strip (). D. s. upper (). E. s. rstrip.

C

Text is represented by the ____ data type. A. line B. char C. string D. word E. None of the above.

C

The process of encoding data to keep it private is called? A. Designing B. Unicode C. Encryption D. ASCII E. None of the above

C

The process of encoding information for the purpose of keeping it secret or transmitting it privately is called A. Privatization B. Hiding C. Encryption D. Deletion E. None of the above

C

What does ASCII stand for? A. Amnesia Scotland Cube Ice Igloo B. Apple Security Computer International Incorporated C. American Standard Code for Information Interchange D. Augmented Selective Code for Information International E. Arctic Section Calligraphy for International Inquires

C

What does the function len do? A. allows you to see how the code will work B. tells the program to repeat itself C. calculates the amount of characters in a string D. lets the user print things freely E. none of the above

C

What is the error in the following code? >>> ord(97) >>> a A. In ASCII, a is not 97. B. There aren't more than 50 values for letters in ASCII. C. Using the ord function gives you the values of letters, not letters for values. D. The value of 97 is actually associated with capital A. E. There is no error.

C

What is the name of an expression in Python that contains both float and int numeric data types? A. Combined Expression. B. Complex Expression. C. Mixed-typed Expression. D. Mixed Expression. E. None of the above.

C

What is the name of numbers that have decimals? A. Point B. Decimal C. Float D. Integer E. Literal

C

What is the output of the following code: "George Quinn"[-7] A. e B. 'g' C. 'e' D. g E. None of the above.

C

What is the problem in this exercise: " math.sqrt (b**2 - 4ac) < 0"? A. computers cannot understand difficult mathematical problems like this one. B. we don't know the values of a, b and c. C. the sqrt function is unable to compute the square root of a negative number. D. the sqrt function is not a real function in Python programming. E. none of the above.

C

What operation do we use to access the individual characters that make up a string? A. Accounting B. Compiling C. Indexing D. Inputting E. None of the above

C

What operator allows the access of the individual characters of a string? A. (+) , Concatenation. B. (-) , Repetition. C. <string>[] , Indexing. D. <string>[:] , Slicing. E. len(<string>), Length.

C

When importing a prexsisting program where do you put the import command? A. After the main() B. In a print statement C. Before the def main(): D. As an input statement E. Behind a #

C

Which of these numbers are int statements? A. 0.5 B. 5.0 C. 5 D. 285.6 E. None of the above.

C

Which of these numbers is a float statement? A. -3 B. 5 C. 5.0 D. 27 E. None of the above.

C

Which of these operations will find the remainder? A. + B. / C. % D. // E. **

C

A special character or sequence of characters is used: A. To break the statement across two lines. B. To print out in two different formats. C. To add an extra keyword parameter. D. To mark the end of each line. E. All of the above.

D

Accessing the individual characters that make up a string can be done by A. Indicating. B. Number assessment. C. Assignment. D. Indexing. E. Plucking.

D

Before reading or writing to a file, a file object must be created via? A. None of the following B. Folder C. File D. Open E. Create

D

Cryptography can be described as: A. The study of crypts B. The study of printing C. The study of electricity D. The study of encryption methods E. None of the above.

D

How would python convert 3.9 into an int? A. 4 B. 4.0 C. 3.0 D. 3 E. None of the above.

D

In python "4" + "5" is ? A. "9" B. 45 C. 9 D. "45" E. None of the above

D

Strings are represented in python by which of the following? A. Files B. Elements C. Variable D. Numerical codes E. All of the above

D

The constant pi means what in python code? A. It creates a picture of a Pie B. It imports the full number of Pi C. Mathematic constant of i D. Mathematical constant Pi E. Returns a value of pi

D

The ord function is used to do what? A. Returns the numeric ("ordinal") code of a single-character string. B. The exact opposite of the chr function. C. Transitions the user between the ASCII Standard and the Unicode Standard. D. Both "A" and "B". E. None of the above.

D

The positions in a string are ordered starting from what number? A. 1 B. 2 C. 3 D. 0 E. None of the above.

D

The process of encoding information for the purpose of keeping it secret or transmitting it privately is called: A. indexing B. floating C. unicode D. encryption E. None of the above

D

What does ceil(x) represent in English? A. The largest whole number <=x B. The square root of x C. The exponent of x D. The smallest whole number >=x E. the inverse of tangent x

D

What does the symbol % represent? A. Subtract B. Divide C. Add D. Remainder E. Multiply

D

What should the output be for this string operation? >>> 6 * "banana" A. bananabananabananabananabananabanana B. banana banana banana banana banana banana C. ' banana banana banana banana banana banana ' D. ' bananabananabananabananabananabanana ' E. " banana banana banana banana banana banana "

D

What step must be completed before creating the loop in the accumulator programming pattern? A. The math library must be imported. B. The loop index must be assigned. C. All int data types must be converted to float data types. D. The accumulator variable must be initialized to the correct value. E. The accumulator function must be defined.

D

What symbol is used to slice in Python? A. ; B. ? C. { D. : E. None of the above

D

What's a common scheme for generating usernames. A. Using the user's first name and last initial B. Using the user's last name and first initial C. Using the user's full first and last name D. Using the first initial and seven letters of the last name E. All of the above

D

Which of the following is the correct syntax for indexing A. len(<string>) B. <string>([]) C. <string>[:] D. <string>[] E. None of the Above

D

Which operator allows the access to a contiguous sequence of characters? This operator also allows for subtracting from a string. A. (+) , Concatenation. B. (-) , Repetition. C. <string>[] , Indexing. D. <string>[:] , Slicing. E. len(<string>), Length.

D

How do you format strings to the center? A. > B. < C. % D. & E. ^

E

How many different values can a single byte store? A. 512 B. 1024 C. 8 D. 128 E. 256

E

The number of distinct values that can be represented using 8 bits is A. 8 B. 16 C. 2*2*2*2 D. 45 E. 2*2*2*2*2*2*2*2

E

These are some examples illustrating the two forms string literals: A. >>> str1= "Hello" B. >>> print (str1, str2) C. Hello spam D. < class 'str'> E. All of the above.

E

What are some examples of Python string operations? A. + B. * C. <string>[] D. <string>[:] E. All of the above

E

What are some examples of string functions? A s.capitalize() B. s.lower() C. s.split() D. s.upper() E. All of the above

E

What are some examples of type conversion functions? A. float<expr> B. int<expr> C. str<expr> D. eval<expr> E. None of the above

E

What does it mean if a list is mutable? A. the list will not appear in a print statement B. the list will not work correctly if turned off C. everything after the list will only run through one time D. the list is small enough to be deleted E. none of the above

E

What function gives the unicode value of a character? A. Abs B. Eval C. Ascii D. Chr E. Ord

E

What is a integer? A. A number that can have a fractional part B. A positive fraction C. A positive whole number D. A negative whole number E. positive or negative whole numbers

E

What is the process of encoding information for the purpose of keeping it secret or transmitting it privately? A. Decryption. B. Encoding. C. Ciphering. D. Inscribing. E. Encryption.

E

What kinds of things can strings do? A. Access individual characters in a string B. Have characters in a string associated with a number C. Shows string value in single quotes D. Access the last character with n - 1 E. All of the above.

E

Which of the following is true about Python file reading method? A. strings() B. stringline() C. readingline() D. lines() E. readlines()

E

Which of these can manipulate a string A. + B. * C. [] D. [:] E. all of the above

E

Which of these statements is true: A. Strings are sequences of characters. B. Strings and lists can be manipulated with the built-in sequence operations. C. Strings are always sequences of characters. D. Strings are represented in the computer as numeric code. E. All of the above.

E

In python "4" + "5" = "45"

False

True or false: strings are more general than lists

False

True or false: python string and list objects include many useful built-in methods for string and list processing.

True

Why are there two different data types for numbers? A. Values that represent counts can't be fractional. B. Using an int value tells the reader of a program that the value can't be a fraction. C. We can't have 3 1/2 quarters. D. The underlying algorithms that perform computer arithmetic are simpler for ints than floats. E. All of the above.

idk what the answer was they didn't put it and I don't feel like finding it this probably won't be on the test but if you find the answer lmk and I'll add it


Kaugnay na mga set ng pag-aaral

6-cerebrovascular accidents (CVA, brain attack, stroke)

View Set

C720 - Operations and Supply Chain Management (10-11)

View Set

Life & Health License Test Texas Exam FX

View Set

Chapter 12 - Listing Agreement (REPI)

View Set

Chapter 2: Word Analysis and Communication

View Set

101 Data Science Interview Questions

View Set