GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

CS 1101 Week 4

Gelöschter Nutzer 14 Fragen Aktualisiert am 15 Nov 2016

Quiz starten

Fragen in diesem Quiz (14)

  1. 1One of the advantages of a function is that it allows the programmer to alter the flow of the execution in the program
    1. ARichtig
    2. BFalsch
  2. 2A stack diagram shows the value of each variable and the function to which each variable belongs
    1. ARichtig
    2. BFalsch
  3. 3The graphical representation of a stack of functions, their variables, and the values to which they refer is called a traceback.
    1. ARichtig
    2. BFalsch
  4. 4A local variable is a variable defined inside a function that can only be used inside its function.
    1. ARichtig
    2. BFalsch
  5. 5What will the output of this python program be?
    def test_function(length, width, height):
    print ("the area of the box is ",length*width*height)
    return length*width*height

    l = 12.5
    w = 5
    h = 2
    test_function(l,w,h)
    1. AThe area of the box is 125
    2. BThe area of the box is 125.0
    3. CThe area of the box is 120
    4. D125.0
  6. 6What will the output of this program be when it is executed?

    def test_function( length, width, height):
    print ("the area of the box is ", length*width*height)
    return length*width*height

    l = 12.5
    w = 5
    h = 2
    test_function(l, w, h)

    print ("The area of the box is ", length*width*height)
    1. AA NameError because a variable is not defined
    2. BThe area of the box is 125.0
    3. CThe are of the box is 0
    4. DA SyntaxError due to illegal function call
  7. 7What will the output of the following code be?

    def recursive( depth ):
    depth+=1
    while (depth < 5):
    ret = recursive(depth)
    return depth

    ret = recursive( 0 )
    print ("the recursive depth is ", ret)
    1. AThe recursive depth is 5
    2. BThe recursive depth is 4
    3. CError due to depth of recursive calls
    4. DNone
  8. 8What will the output of the following program be?

    i=0
    while (i < max(1, 22-4*5, 3*5-3*4, 2**2)):
    i+=1
    print (i)
    1. A0
    2. B5
    3. C3
    4. D4
  9. 9What output will the following Python script produce?

    def function2(param):
    print (param, param)

    def function1(part1, part2):
    cat = part1 + part2
    function2(cat)

    chant1 = "See You"
    chant2 = "See Me"
    function1(chant1, chant2)
    1. ASee You See Me
    2. BSee You See Me See You See Me
    3. CSee Me See Me See You See You
    4. DNone it would generate an error
  10. 10What does the import statement in the following script do?

    import StringIO
    output = StringIO.StringIO()
    output.write('First line.\n')
    output.close()
    1. AIt imports data into the script
    2. BIt changes the format of the string in the script
    3. CIt opens a file for StringIO functions to read
    4. DIt includes a Python module called StringIO into the script

Informationen

Beschreibung
Der Nutzer hat seine Fachbereichs-Information gelöscht. Quiz am CS 1101 Week 4 , erstellt von Gelöschter Nutzer am 22/09/2016.
Autor
Gelöschter Nutzer
Sprache
English
Aufrufe
47
Verlauf
Erstellt am 22 Sep 2016 · aktualisiert am 15 Nov 2016

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck