loops, programs, abstracts, Programming Essentials exam help

Anonymous
timer Asked: Jul 25th, 2016
account_balance_wallet $10

Question Description

Question 1

  1.  

    A loop can also be known as a

    Decision

    Sequence

    Iteration

    Structure

2 points  

Question 2

  1.  

    Abstracts a program’s various tasks or function into separate named blocks of code.

    Modularization

    Code blocks

    Subroutines

    Flowcharts

2 points  

Question 3

  1.  

    Boolean expressions are only true

2 points  

Question 4

  1.  

    Component of a function used to get an output directly from that function.

    for

    output

    return

    print

2 points  

Question 5

  1.  

    Considered the brain of the computer

    GPU

    CPU

    RAM

    HDD

2 points  

Question 6

  1.  

    Loops are similar to decisions in that they have a condition statement which evaluates to a TRUE or FALSE value.

2 points  

Question 7

  1.  

    Serves the same purpose as a list, but is considered less flexible.

    Iteration

    Arrays

    Flowchart

    Code

2 points  

Question 8

  1.  

    The Python Framework does inform you where an error occurred.

2 points  

Question 9

  1.  

    This programing element begins with the keyword def.

    variables

    functions

    keywords

    lists

2 points  

Question 10

  1.  

    Used to define the scope in Python

    { }

    sub

    indentation

    ( )

2 points  

Question 11

  1.  

    ____ within a list are identified by an index number, placed within square brackets after the name of the list. For example, names[0]

    Decisions

    Items

    Elements

    Code

2 points  

Question 12

  1.  

    Python requires the user to specify a variable’s data type during creation.

2 points  

Question 13

  1.  

    It is arguable that recursion is just another way to accomplish the same thing as a while loop.

2 points  

Question 14

  1.  

    Scope is defined the same way in all programming languages

2 points  

Question 15

  1.  

    In Python, this serve as an alternative to a lists which offer slightly different functionality by replacing index values with names.

    Dictionaries

    Encyclopedias

    Arrays

    Objects

2 points  

Question 16

  1.  

    Which of the following is NOT true about recursion

    It is usually studied at the advanced level

    It can accomplish the same tasks as a for loop

    Recursion is used to solve complex problems

    Recursion functions require more memory

2 points  

Question 17

  1.  

    Which is the following is NOT a basic programming concept listed in the lecture

    Objects

    Code Blocks

    Produce Output

2 points  

Question 18

  1.  

    Is an example of an exception object in Python

    Def

    ValueError

    Except

2 points  

Question 19

  1.  

    Incorporates the use of the three primary programming structures and logic strategies that create well organized, easy to read, and easy to understand program code.

    Flowchart

    Pseudocode

    Structured Programming

2 points  

Question 20

  1.  

    An example of declaring a new class object.

    pets = {}

    pets = Pet()

    elif menuSelection == 4:

2 points  

Question 21

  1.  

    while True: , in Python, can be used to create an infinite loop.

2 points  

Question 22

  1.  

    The Python Framework does inform you where an error occurred

2 points  

Question 23

  1.  

    ____ is a critical component to being able to store data and information long term.

    File Access

    Memory

    Print function

    with

2 points  

Question 24

  1.  

    Error handling is also known as ___ handling

    Recursion

    Exception

    Crash

2 points  

Question 25

  1.  

    We use a ______ block to handle thrown exceptions.

    except

    keywords

    lists

2 points  

Question 26

  1.  

    When does python limit access to global objects from within a scope?

    When there is the presence of a newly created local variable with a different name than the global variable.

    When there are no new variables.

    When there is the presence of any newly created variable.

2 points  

Question 27

  1.  

    Passes multiple values into a function for processing

    Code block

    Return

    Parameter list

2 points  

Question 28

  1.  

    There is no limit to the number of except blocks a program can have.

2 points  

Question 29

  1.  

    When we pass a variable into a function and then modify that variable inside of the function, it also modifies the variable outside of the function that we passed into the function.

2 points  

Question 30

  1.  

    def calcBMI(hgt, wgt);


      BMI = wgt * 703 / hgt ** 2


      return BMI


    What is wrong with the above code syntax

    The ; should be a :

    The ** should be a ^

    The function code block needs to be closed with enddef

2 points  

Question 31

  1.  

    The function that can be used to generate a list of index values, useful in controlling a for loop:

    range()

    rand()

    str()

2 points  

Question 32

  1.  

    The function used to import python code and objects from other python files.

    add

    import

    print

2 points  

Question 33

  1.  

    An interpreter converts the entire source code into an executable.

2 points  

Question 34

  1.  

    Compilers and interpreters have the following in common:

    Translates machine code into byte code.

    Reads the course code one line at a time.

    Translates source code into machine code.

2 points  

Question 35

  1.  

    The _______ block is used to perform normal operations, but allow an exception to be thrown, thus ending the _______ block.

    Except

    Throw

    Catch

2 points  

Question 36

  1.  

    def setPhone(self,
    phone):


        self.phone
    = phone


    The above code is an...

    Mutator method

    Accessor method

    Global function

    Except Function

2 points  

Question 37

  1.  

    What does this operator mean <=

    Approximately

    Greater than or equal to

    Less than or equal to

2 points  

Question 38

  1.  

    Write a 4 element Python dictionary object that contains four colors as the names and their values as examples of something that is that color. Example: “red”: “apple”

    For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

    Use arrow keys to select functions

    Path:

    Words:0

    2 points  

    Question 39

    1.  

      Write a Python class definition for an Employee object that contains the following elements:


      Attributes:


      • id
      • name
      • wage
      • department

      Methods:


      • Initializer which sets ID, name, and wage
      • Set Name
      • Set Department
      • Get Id
      • Get Name
      • Get Wage
      • Get Department

      For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Content Editor

      Use arrow keys to select functions

      Path:

      Words:0

      2 points  

      Question 40

      1.  

        In Python, all exceptions must be instances of a class that derives from BaseException.

      2 points  

      Question 41

      1.  

        Attributes are to variables, as methods are to ______________.

        objects

        functions

        exceptions

      2 points  

      Question 42

      1.  

        Programming method of solving a problem by solving a smaller version of the same problem, repeatedly

        Problem Solving

        Debugging

        Recursion

      2 points  

      Question 43

      1.  

        Function used to close a file once the program is done with that file.

        close()

        finish()

        detach()

      2 points  

      Question 44

      1.  

        The len() function accepts an object and returns:

        the number of elements in the object.

        part of the object.

        number of parameters in the object

      2 points  

      Question 45

      1.  

        _____ are part of the UML and is used to illustrate how your program’s functions will relate and support your organization’s various functions.

        Use case diagrams

        Class diagrams

        Communication diagrams

      2 points  

      Question 46

      1.  

        Comments in Python begin with:

        //

        />

        *

        #

      2 points  

      Question 47

      1.  

        A UML diagram used to examine the various states that any objects will go through at various points in time

        Use case diagrams

        Communication diagrams

        Object diagrams

      2 points  

      Question 48

      1.  

        The simplest way to produce output is using the _____ statement

        Try

        Print

        Use

      2 points  

      Question 49

      1.  

        Separates the keys when defining the contents of a dictionary.

        {

        :

        [

      2 points  

      Question 50

      1.  

        Statement used to delete a dictionary element

        del

        erase

        terminate

      2 points  

      Question 51

      1.  

        Which of the following is NOT a number type supported by python

        char

        int

        long

        float

      2 points  

      Question 52

      1.  

        What is the output of the following Python code:


        SIZE = 10


        numbers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]


        index = 0


        while index < SIZE:


          numbers[index] = index * 10


          index = index + 1


        while index > 0:


          index = index - 1


         print(numbers[index])


Tutor Answer

DrCS
School: Carnegie Mellon University

Done. Let me know how it goes. Bye

Q1) Iteration
Q2) Modularization
Q3) False
Q4)return
Q5)CPU
Q6) True
Q7) Arrays
Q8) True
Q9) functions
Q10) indentation
Q11)Items
Q12) False
Q13) True
Q14) False
Q15) Dictionaries
Q16) Recursion is used to solve complex problems
Q17) Produce Output
Q18) valueError
Q19)...

flag Report DMCA
Review

Anonymous
Goes above and beyond expectations !

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors