CSE Exam 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the value of the following Python expression? (7 + 6 * (2 - 4))

-5

What is the value of the following Python expression? 7 // 4

1

Detecting logical errors in code is responsibly of

the programmer

Which one of the following statements is FALSE about variables in python

A variable name can start with a digit is FALSE

which if the following is false about variables in Python programming language?

A variable name can start with a number is false

Python is a high-level language

True

Consider the following valid Python code fragment: if x > 4: if x < 9: print('W') else: print('X') else: if x < 9: print('Y') else: print('Z') For which one of the following ranges of integers would the code print Y?

any value less than or equal to 4

Every line of code inside a Python function must __.

be indented

Which one of the following would be an example of abstraction in computer programming

calling a function without knowing exactly how it works

The datât stored in main memory vanishes after the computer is turned off

true

Which of the following is the operator we use in Python to compute a total incrementally?

+=

Suppose you have written a program containing no typos, but it crashes when executed. What kind of error is program exhibiting?

A run-time error

Which of the following is NOT a python operator

#

Which of the following would be considered expressions in Python? 1)5 2)5+2 3)def 4)"Hello" 5)if

1,2,4

What is the final value of x after the given valid Python code has finished executing? x = 7 x += 9 x

16

What is the value of the following Python expression? 2 * 2 ** 3

16

What is the final value of x after the given valid Python code has finished executing? x = 20 / 8

2.5

What is the final value of x after the given valid Python code has finished executing? x = 10 // 3

3

What is the final value of x after the given valid Python code has finished executing? x = 2 + 2 * 2 - 2

4

What is the final value of x after the given valid Python code has finished executing? x = 3 x += 2

5

What is the final value of x after the given valid Python code has finished executing? x = 23 % 6

5(remember that means remainder)

What is the final value of x after the given valid Python code has finished executing? x = 3 x += x + 1 # not a typo x

7

What is the final value of x after the given valid Python code has finished executing? x = 1 + 2 * 3.0

7.0

which of the following statements is true about functions in python

A python function can take multiple arguments

Which of the following is a syntax error

Forgetting to type a closing quotation mark for a string

We wish to write a line of code the implements the mathematical expression 3x/4y using python varies of the same name as mathematical variables. Assumes that y never equals 0. Consider the following proposed Python implementations of the expression 3*/4*y Which of the following statements is true about this code

It contains a logic/semantic error

Which statement below is false for an algorithm

It is dependent on a programming language of choice

which statement below is FALSE regrading computer science

It is primarily the study of computers involves computational thinking

Given a valid algorithm for a task, which of the following is TRUE?

It might be completed either by manual or automatic labor.

Which of the following is a semantic/logic error?

Mistakenly diving a value by 100 instead of multiplying it by 100 in a formula.

What does Python do if you type 3 + * 5 , but you meant to type 3 + 4 * 5 ?

Python reports a syntax error

Which one of the following statements best describes conditional execution in programming

The truth value of a condition determines which instruction are executed next by a computer

Debugging is

Tracking down programming errors and correcting them running a grogram through a series of test

The concept of abstraction is applied in programming when __.

We call a function we design a function

which of the following would be a good example of an algorithm

a list of instructions for assembling a piece of furniture

A cell phone carrier charges $0.10 for each minute that a customer exceeds his/her mobile plan's monthly limit. We wish to write a function called overage that takes two arguments, plan_minutes and minutes_used, which represent the mobile plan's monthly limit and the number of minutes actually used by the customer. The function returns the overage charges for the month, if any. If the customer did not exceed his/her monthly limit, the function returns 0. Which of the following is a correct implementation of this function?

def overage(plan_minutes, minutes_used): if plan_minutes <= minutes_used: return 0 else: return 0.10 * (minutes_used - plan_minutes)

In a mathematical expression in Python, spacing before or after values can affect the value of the expression (e.g., 5 + 4 vs 5+4).

false

The data stored in a solid state drive vanishes after the computer is turned off

false

Which of the following is the correct way to include a module in a python program

import math

We wish to write a line of code that implements the mathematical expression 2x^3-4x using python variables of the same names as the mathematical variables. Consider the following proposed python implementation fo the expression 2*x*x-4*x

it contains alogical/semantic error

What is the value of the following Python expression? 2 == 9

none of these

A fictional country has 3 denominations of money: gold, silver and copper coins. 1 gold coin = 20 silver coins 1 silver coin = 4 copper coins Given a total number of copper coins (given in the variable copper), we want the computer to tell us how many gold coins (gold), silver coins (silver) and copper coins (copper) are needed to make change while minimizing the number of coins. Incomplete code is given below. Choose the option below that correctly completes the code segments marked A and B. copper=1000 #or any positive integer gold=copper//A copper = copper % A silver = copper // B copper = copper % B

replace A with 80, replace B with 4

Which of the following refers to the rules of a programming language that programmers must follow when writing codes?

syntax

Which one of the following refers to the rules of a programming language that a programmer must follow when developing software in that language?

syntax

which of the following refers to the rules of programming language that programmers must follow when writing code

syntax

Suppose we included the math.sqrt(5) in a code cell in Colba, but forget to import the math module first. What would happen when we run the code cell

the code will crash

consider the python expression 5.5+4 which of the following statements about this expression is true

the expression value is 9.5

which one of the following belongs to the "Big Ideas" related to computer science

the internet

Detecting syntax errors in code is the responsibilt of

the interpreter

Which of the following would replace x with 10 times the value of x?

x*=10

For which of the following values of x will x % 5 equal 0?

x=20

Assume that the variable x contains an integer. Which of the following is a valid Boolean condition?

x==10

Consider the following valid python code statement x=8. Which of the following lines of code would assign the integer value 2 to the variable y?

y=x-6


Set pelajaran terkait

Principles of Management: Chapter 15 (Wesson)

View Set

Reconstruction Study Guide Questions

View Set

Study guide #2 Genetics and Conservation

View Set

Section 3 Accrued Expenses ( Accrued Liabilities)

View Set

chapter 1-9, CH 10-16 excluding CH 12, Chapter 12, CH 18 19 17

View Set