PCAP : Certified Associate in Python Programming : Part 03

  1. Which of the following words can be used as a variable name? (Choose two.)

    • for
    • True
    • true
    • For

    Explanation:

    Reference: https://www.pluralsight.com/guides/python-basics-variables-assignment

  2. Python strings can be “glued” together using the operator:

    • .
    • &
    • _
    • +
    Explanation:
    Reference: https://docs.python.org/3/tutorial/introduction.html
  3. A keyword (Choose two.)

    • can be used as an identifier
    • is defined by Python’s lexis
    • is also known as a reserved word
    • cannot be used in the user’s code
    Explanation:
    Reference: https://www.programiz.com/python-programming/keywords-identifier
  4. How many stars (*) does the snippet print?

    PCAP Certified Associate in Python Programming Part 03 Q04 039
    PCAP Certified Associate in Python Programming Part 03 Q04 039
    • the code is erroneous
    • five
    • four
    • two
  5. Which line can be used instead of the comment to cause the snippet to produce the following expected output? (Choose two.)

    Expected output:
    1 2 3

    Code:

    PCAP Certified Associate in Python Programming Part 03 Q05 040
    PCAP Certified Associate in Python Programming Part 03 Q05 040
    • c, b, a = b, a, c
    • c, b, a = a, c, b
    • a, b, c = c, a, b
    • a, b, c = a, b, c
  6. Assuming that the V variable holds an integer value to 2, which of the following operators should be used instead of OPER to make the expression equal to 1?

    V OPER 1

    • <<<
    • >>>
    • >>
    • <<
  7. How many stars (*) does the following snippet print?

    PCAP Certified Associate in Python Programming Part 03 Q07 041
    PCAP Certified Associate in Python Programming Part 03 Q07 041
    • the code is erroneous
    • five
    • three
    • four
    Explanation:
    PCAP Certified Associate in Python Programming Part 03 Q07 042
    PCAP Certified Associate in Python Programming Part 03 Q07 042
  8. UNICODE is:

    • the name of an operating system
    • a standard for encoding and handling texts
    • the name of a programming language
    • the name of a text processor
    Explanation:
    Reference: https://docs.python.org/2/howto/unicode.html
  9. What is the expected output of the following snippet?

    PCAP Certified Associate in Python Programming Part 03 Q09 043
    PCAP Certified Associate in Python Programming Part 03 Q09 043
    • *- **-**-**-*
    • *-**-**-**-**-**-**-**-*
    • *-*
    • *-**-*
    Explanation:
    PCAP Certified Associate in Python Programming Part 03 Q09 044
    PCAP Certified Associate in Python Programming Part 03 Q09 044
  10. Which of the listed actions can be applied to the following tuple? (Choose two.)

    PCAP Certified Associate in Python Programming Part 03 Q10 045
    PCAP Certified Associate in Python Programming Part 03 Q10 045
    • tup [:]
    • tup.append (0)
    • tup [0]
    • del tup
  11. Executing the following snippet

    PCAP Certified Associate in Python Programming Part 03 Q11 046
    PCAP Certified Associate in Python Programming Part 03 Q11 046

    will cause the dct:

    • to hold two keys named ‘pi’ linked to 3.14 and 3.1415 respectively
    • to hold two key named ‘pi’ linked to 3.14 and 3.1415
    • to hold one key named ‘pi’ linked to 3.1415
    • to hold two keys named ‘pi’ linked to 3.1415
  12. How many elements will the list1 list contain after execution of the following snippet?

    PCAP Certified Associate in Python Programming Part 03 Q12 047
    PCAP Certified Associate in Python Programming Part 03 Q12 047
    • two
    • zero
    • one
    • three
  13. Which of the equations are True? (Choose two.)

    • chr (ord (x)) = = x
    • ord (ord (x)) = = x
    • chr (chr (x)) = = x
    • ord (chr (x)) = = x
  14. If you want to transform a string into a list of words, what invocation would you use? (Choose two.)

    Expected output:

    PCAP Certified Associate in Python Programming Part 03 Q14 048
    PCAP Certified Associate in Python Programming Part 03 Q14 048

    Code:

    PCAP Certified Associate in Python Programming Part 03 Q14 049
    PCAP Certified Associate in Python Programming Part 03 Q14 049
    • s.split ()
    • split (s, ‘ ‘)
    • s.split (‘ ‘)
    • split (s)
  15. Assuming that 1st is a four-element list is there any difference between these two statements?

    PCAP Certified Associate in Python Programming Part 03 Q15 050
    PCAP Certified Associate in Python Programming Part 03 Q15 050
    • yes, there is, the first line empties the list, the second line deletes the list as a whole
    • yes, there is, the first line deletes the list as a whole, the second line just empties the list
    • no, there is no difference
    • yes, there is, the first line deletes the list as a whole, the second line removes all the elements except the first one
  16. What should you put instead of XXX to print out the module name?

    PCAP Certified Associate in Python Programming Part 03 Q16 051
    PCAP Certified Associate in Python Programming Part 03 Q16 051
    • main
    • _main_
    • __main__
    • ___main___
    Explanation:
    Reference: https://www.geeksforgeeks.org/__name__-special-variable-python/
  17. Files with the suffix .pyc contain:

    • Python 4 source code
    • backups
    • temporary data
    • semi-compiled Python code
  18. Package source directories/folders can be:

    • converted into the so-called pypck format
    • packed as a ZIP file and distributed as one file
    • rebuilt to a flat form and distributed as one directory/folder
    • removed as Python compiles them into an internal portable format
  19. What can you deduce from the line below? (Choose two.)

    PCAP Certified Associate in Python Programming Part 03 Q19 052
    PCAP Certified Associate in Python Programming Part 03 Q19 052
    • import a.b.c should be placed before that line
    • f () is located in subpackage c of subpackage b of package a
    • the line is incorrect
    • the function being invoked is called a.b.c.f ()
  20. A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

    • lambda (x, y) = x ** y
    • lambda (x, y): x ** y
    • def lambda (x, y): return x ** y
    • lambda x, y: x ** y
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments