For the multiple-choice questions, type your answer into the _highlighted blank (like this)____ In the while loop below, given that k = 0 initially, what is the value of k after execution of the loop? ­­­­­­­­­­­­­­­­___e__ while (k <= 5) { k = k + 1; } 0 1 4 5 6 none of the above

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For the multiple-choice questions, type your answer into the _highlighted blank (like this)____

  • In the while loop below, given that k = 0 initially, what is the value of k after execution of the loop?  ­­­­­­­­­­­­­­­­___e__

          while (k <= 5) 

              { 

                           k = k + 1; 

              }

         

  1. 0
  2. 1
  3. 4
  4. 5
  5. 6
  6. none of the above

 

2) A _____is a sequence of instructions with a name.

  1. variable
  2. argument
  3. parameter
  4. function

 

3) Consider the following function call round(3.14159, 3) what is the return value? _____

  1. 3.14159
  2. 3.141
  3. 3.14
  4. 3.1

 

 

 

4) Operators such as greater-than and less-than, used to compare data for conditions, are called _____operators.

  1. logical
  2. arithmetic
  3. relational
  4. smooth

 

 

5) The Python syntax to assign the value 10 to the variable count is _____.

  1. count = 10;
  2. count == 10;
  3. count is = 10;
  4. 10 == count;

 

6) Consider the following function.

def factorial(n) :

                 result = 1

                 for i in range(1, n + 1) :

                 result = result * i

                 return result

What is the parameter for this function? _____

  1. factorial
  2. i
  3. n
  4. result

 

 

7) A condition such as "pcount < 20" has a _____value.

  1. numeric
  2. alphanumeric
  3. character
  4. boolean

 

8) The Python condition to test the value of count to be equal to the value 10 is _____.

  1. (count = 10)
  2. (count == 10)
  3. (count.equal(10))
  4. (count is = 10)

 

9) Corrections to syntax to eliminate syntax, runtime, or logic errors must be made to the _____.

  1. compile code
  2. executable code
  3. object code
  4. source code
  5. none of the above

 

10) What are supplied to a function when it is called? _____

 

  1. arguments
  2. numbers
  3. return values
  4. sentinals

 

11)  “Fix” the following 3 lines of code so that the print the last line of code correctly:

 

age == input(How old are you?)

age == age + 1

print["Happy birthday!  You are" + age + years old!]

 

 

 

 

 

 

 

12)  Consider the following function:

 

def squareArea(sideLength) :

   return sideLength ** 2

 

What is the value of squareArea(3)? _____

a.2

b.3

c.6

d.9

 

 

13) Using one line or two of Python code, declare a one-dimensional list called cityNames, and assign the values: Providence, Denver, Miami, Chicago, Seattle

 

 

 

14) Given the array you created above, what is the output of the line of Python below:

print(cityNames[3])    ________________

 

 

15) Given the array above, write a for statement (using Python syntax) that will output all of the entries in the array, one name at a time (one name per line)

 

 

 

 

 

 

16) Assume you are working in a Python program and you have been given the following lines of Python code

studentFirstName = “Pat”

studentLastName = “Brown”

studentFullName = concatNames(studentFirstName, studentLastName)

 

Assume there is currently no method called concatNames in the file you are working on.  In the space below, write the Python code to create a method called concatNames that will take in two values called fName and lName.  The method should concatenate the names and return the full name of the student as one String called totalName.

 

 

17)  In the space below, write a function

              Def countVowels(wordPhrase):

that returns a count of all vowels in wordPhrase.  Vowels are the letters a, e, i, o, u, and their uppercase variants. 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education