Skip to content
  • Home
  • CCNA Labs
    • CCNA 1 LAB Activities (v6 & v7)
    • CCNA 2 LAB Activities (v6 & v7)
    • CCNA 3 LAB Activities (v6 & v7)
    • CCNA 4 Lab Activities
  • Linux
    • Linux Unhatched
    • Linux Essentials 2.0
    • Linux Essentials
    • Introduction to Linux I
    • Introduction to Linux II
  • Programming
    • PCAP – Programming Essentials in Python
    • CLA – Programming Essentials in C
    • CPA Programming Essentials in C++
  • About
    • Contact Us
    • Privacy Policy

CCNA 7 Exam Answers 2023

Go with our CCIE, Passed 100%

  • ITE
    • ITE - IT Essentials v7.0
    • ITE - IT Essentials v6.0
      • IT Essentials Lab 2019
    • ITE v5.0 Exam
    • Virtual Activity Laptop
    • Virtual Activity Desktop
  • NE
    • MF
  • CCNA
    • CCNA1
      • CCNA1 v7.0 – ITN
      • CCNA1 v6.0
    • CCNA2
      • CCNA2 v7.0 – SRWE
      • CCNA2 v6.0
    • CCNA3
      • CCNA3 v7.0 – ENSA
      • CCNA3 v6.0
    • CCNA4
      • CCNA4 v6.0
  • Cyber-Security
    • ITC – Introduction to Cybersecurity 2.1 (Level 1)
    • CE – Cybersecurity Essentials 1.1 (Level 2)
    • CCNA CyberOps 1.1 (Level 3)
  • Security
    • CCNA Security v2
  • DevNet
  • CCNA PT Lab 2023

PCAP – Programming Essentials in Python Quizzes Module 3 Test Answers

Last Updated on May 20, 2021 by Admin

PCAP – Programming Essentials in Python Quizzes Module 3 Test Answers

  1. Which of the following lines properly starts a parameterless function definition?

    • function fun():
    • def fun:
    • fun function():
    • def fun(): 
  2. A function defined in the following way:

    def function(x=0):
    return x

    • may be invoked without any argument, or with just one
    • must be invoked without arguments
    • must be invoked with exactly one argument
    • may be invoked with any number of arguments (including zero)
  3. A built‑in function is a function which:

    • has to be imported before use
    • is hidden from programmers
    • has been placed within your code by another programmer
    • comes with Python, and is an integral part of Python 
  4. The fact that tuples belong to sequence types means:

    • they can be modified using the del instruction
    • they can be indexed and sliced like lists
    • they are actually lists
    • they can be extended using the .append() method
  5. What is the output of the following snippet?

    def f(x):
    if x == 0:
    return 0
    return x + f(x – 1)

    print(f(3))

    • the code is erroneous
    • 3
    • 1
    • 6 
  6. What is the output of the following snippet?

    def fun(x):
    x += 1
    return x

    x = 2
    x = fun(x+1)
    print(x)

    • the code is erroneous
    • 4
    • 5
    • 3
  7. What code would you insert into the commented line to obtain the output that reads:

    a
    b
    c

    Code:

    dct = { }
    lst = [‘a’,’b’,’c’,’d’]
    for i in range(len(lst) – 1):
    dct[lst[i]] = ( lst[i], )
    for i in sorted(dct.keys()):
    k = dct[i]
    # insert your code

    • print(k[0])
    • print(k)
    • print(k[“0”])
    • print(k[‘0’])
  8. The following snippet:

    def func(a,b):
    return a ** a

    print(func(2))

    • will output 2
    • is erroneous
    • will return None
    • will output 4
  9. The following snippet:

    def func1(a):
    return a ** a
    def func2(a):
    return func1(a)*func1(a)
    print(func2(2))

    • is erroneous
    • will output 2
    • will output 4
    • will output 16 
  10. Which of the following lines properly starts a function using two parameters, both with zeroed default values?

    • def fun(a=b=0):
    • fun fun(a,b=0):
    • fun fun(a=0,b):
    • def fun(a=0,b=0): 
  11. Which of the following statements is false?

    • The None value cannot be used as an argument of arithmetic operators
    • The None value can be assigned to variables
    • The None value may not be used outside functions
    • The None value can be compared with variables
  12. What is the output of the following snippet?

    def fun(x):
    if x % 2 == 0:
    return 1
    else:
    return

    print(fun(fun(2)) + 1)

    • the code will cause a runtime error
    • 1
    • None
    • 2
  13. What is the output of the following snippet?

    def fun(x):
    global y
    y = x * x
    return y

    fun(2)
    print(y)

    • 2
    • 4
    • None
    • the code will cause a runtime error
  14. What is the output of the following snippet?

    def any():
    print(var + 1,end=”)
    var = 1
    any()
    print(var)

    • 22
    • 21
    • 11
    • 12
  15. Assuming that tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction:

    tuple[1] = tuple[1] + tuple[0]

    • is illegal
    • is fully correct
    • can be executed if and only if the tuple contains at least two elements
    • may be illegal if the tuple contains strings
  16. What is the output of the following snippet?

    list = [‘Mary’, ‘had’, ‘a’, ‘little’, ‘lamb’]
    def list(L):
    del L[3]
    L[3] = ‘ram’
    print(list(list))

    • [‘Mary’, ‘had’, ‘a’, ‘ram’]
    • [‘Mary’, ‘had’, ‘a’, ‘little’, ‘lamb’]
    • the snippet is erroneous
    • [‘Mary’, ‘had’, ‘a’, ‘lamb’]
  17. What is the output of the following snippet?

    def fun(x,y,z):
    return x+2*y+3*z

    print(fun(0,z=1,y=3))

    • 3
    • the snippet is erroneous
    • 0
    • 9 
  18. What is the output of the following snippet?

    def fun(inp=2,out=3):
    return inp * out
    print(fun(out=2))

    • 6
    • 4
    • 2
    • the snippet is erroneous
  19. What is the output of the following snippet?

    dct = { ‘one’:’two’, ‘three’:’one’, ‘two’:’three’ }
    v = dct[‘one’]
    for k in range(len(dct)):
    v = dct[v]
    print(v)

    • two
    • three
    • (‘one’, ‘two’, ‘three’)
    • one
  20. What is the output of the following snippet?

    tup = (1, 2, 4, 8)
    tup = tup[1:-1]
    tup = tup[0]
    print(tup)

    • the snippet is erroneous
    • (2)
    • (2,)
    • 2
  • CCNA1 v7
  • CCNA2 v7
  • CCNA3 v7
System Test Exam Answers
Modules 1 – 3 Exam Answers
Modules 4 – 7 Exam Answers
Modules 8 – 10 Exam Answers
Modules 11 – 13 Exam Answers
Modules 14 – 15 Exam Answers
Modules 16 – 17 Exam Answers
Practice Final – ITN Answers
Course Feedback
ITN Practice PT Skills Assessment (PTSA)
Final Exam Answers
Modules 1 – 4 Exam Answers
Modules 5 – 6 Exam Answers
Modules 7 – 9 Exam Answers
Modules 10 – 13 Exam Answers
Modules 14 – 16 Exam Answers
ITN Practice Skills Assessment – PT Answers
SRWE Practice Skills Assessment – PT Part 1 Answers
SRWE Practice Skills Assessment – PT Part 2 Answers
SRWE Hands On Skills Exam Answers
SRWE Practice Final Exam Answers
SRWE Final Exam Answers 
Modules 1 – 2 Exam Answers
Modules 3 – 5 Exam Answers
Modules 6 – 8 Exam Answers
Modules 9 – 12 Exam Answers
Modules 13 – 14 Exam Answers
ITN Practice PT Skills Assessment (PTSA) Answers
SRWE Practice PT Skills Assessment (PTSA) – Part 1 Answers
SRWE Practice PT Skills Assessment (PTSA) – Part 2 Answers
ENSA Practice PT Skills Assessment (PTSA) Answers
ENSA Hands On Skills Exam Answers
Practice Final – ENSA Answers
ENSA Final Exam Answers
CCNA Certification Practice Exam Answers

Copyright © 2023 PressExam.