GoConqr has a new look! Let us know what you think.

Quiz

CP1404

Alex Von Kurtz 42 questions

Take the quiz

This quiz has question types that open in the usual player.

Questions in this quiz (42)

  1. 1Which one of the following correctly increments by 1 the value referred to by the key ‘a’?
    d = {'a': 123, 'b': 234}
    1. Ad.values('a') += 1
    2. Bd.keys('a') += 1
    3. Cd['a'] += 1
    4. Dd.get('a') += 1
  2. 2What is the correct error message for the following code?
    x = str(1.0)
    x[-1] = '2'
    1. AValueError: invalid literal for int() with base 10: '1.0'
    2. BIndexError: string index out of range
    3. CTypeError: 'str' object does not support item assignment
    4. DNameError: name 'x' is not defined
  3. 3One great tool used in IDEs like Python is the ability to rename variables/functions/classes/etc. throughout a project, which is called [blank_start]refactoring[blank_end]
    1. Arefactoring
  4. 4Given the code:

    vehicle = Taxi('Prius')
    print(vehicle.fuel)
    vehicle.drive(50)

    Identify the names of the parts by matching them up.

    Taxi - [blank_start]class[blank_end]
    vehicle - [blank_start]object[blank_end]
    drive - [blank_start]method[blank_end]
    fuel - [blank_start]attribute/field[blank_end]
    'Prius' - [blank_start]argument[blank_end]
    1. Aclass
    2. Bobject
    3. Cmethod
    4. Dattribute/field
    5. Eargument
  5. 5Write the function name (not including the brackets/parameters) for the function that Python calls when you print an object or convert it to a str:
    [blank_start]__str__[blank_end]
    1. A__str__
  6. 6Which method does a programmer need to define in a class in order to specify the behaviour for when the == operator is used with objects of that class?
    1. A__eq__
    2. B__cmp__
    3. C__equals__
    4. D__==__
  7. 7What is the correct error message for the following code?

    x = str(int('1.0'))
    x[-1] = '2'
    1. AIndexError: string index out of range
    2. BValueError: invalid literal for int() with base 10: '1.0'
    3. CTypeError: 'str' object does not support item assignment
    4. DNameError: name 'x' is not defined
  8. 8def process(x, y=2, z=3):
    return x + y + z

    The code above demonstrates:
    1. Akeyword arguments
    2. Bdefault argument values
    3. Cmultiple return values
    4. Dboth a and b
  9. 9Which one of the following is the correct class header for a Student class that extends (inherits from) the Person class?
    1. Aclass Student(Person):
    2. Bclass Student extends Person:
    3. Cclass (Student, Person):
    4. DNone of the above
  10. 10Write the function name (not including the brackets/parameters) for the standard Python class constructor.
    [blank_start]__init__[blank_end]
    1. A__init__

Information

Description
ICFES/Saber 11 programming Quiz on CP1404, created by Alex Von Kurtz on 12/11/2016.
Language
English
Views
0
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?