Kategori arşivi: Pluralsight Assessment

Çoktan seçmeli minimum 20 sorunun sorulduğu, süresiz geçerliliği olan ve yüzde 80 doğru ile sınavın tamamen geçerli olan pluralsight deneme sınavlarıdır.

Pluralsight Skill IQ Python Core Language Assessment Cevapları

Soru 1: The update function in the following code is supposed to add a new user to your dictionary:

Users = {}
def add_users(new_user):
    Users.update(new_user)

add_users('User1')

What is wrong with this code?

  • The new_user is an instance of a str data structure. Also, inserting a new user with matching keys will overwrite the already existing one.
  • The def function does not return the dictionary Users so that just exists locally.
  • You must specify how many elements you want to store in the dictionary, otherwise it will not work.
  • ‘User1’ must be enclosed in curly brackets.
  • I don’t know yet.

Soru 2: What is the output of the following code?

class test():
    a = 8
    def __init__(self, a=5):
        self.a = a
        print(self.a)

foo = test(2)
  • 5
  • 8
  • None
  • 2
  • I don’t know yet.

Soru 3: What special methods do immutable containers use?

  • len() and getitem()
  • getitem(), setitem(), and __del__item()
  • len(), getitem(), setitem(), and __del__item()
  • getitem() and setitem()
  • I don't know yet.

Soru 4: Why would you use nested comprehensions instead of comprehensions with multiple iterables?

  • To save memory
  • To iterate over two sequences at the same time
  • To convert output to the same type
  • To use the output of one comprehension as an expression for the next
  • I don’t know yet.

Soru 5: You must collaborate on a Python script that needs to add an element to an existing set and then output the updated set. Given the following code, Colors = set(['black','red']), what option successfully adds the element blue to the set Colors and prints the updated set?

  • A
Colors.append('blue')
print('Colors')
  • B
Colors.add('blue')
print('Colors: ', Colors)
  • C
Colors.addElement("blue")
print(set.Colors)
  • D
Colors.push('blue')
print(Colors, "Colors: ")
  • E
I don't know yet.

Soru 6: Which module is most beneficial if you are working on a Python 2 application and planning on having Python 3 support for your code?

  • _testmultiphase module
  • pip module
  • sys module
  • __future__ module
  • I don’t know yet.

Soru 7: You are working on a Windows system and you must use the sys module to add a module from a custom location. The following script fails when you try to import the module. The custom location is: “D:\Projects\”. Assume pydot is in the folder.

import sys 
sys.path.append("D:\Projects\")
import pydot


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pydot'

Why is the script failing?

  • You must specify the path with raw string or escape the backslashes.
  • You must start with import statements and then with the append.
  • The module is not in that folder.
  • You can only set the path in the PYTHONPATH environment variable.
  • I don’t know yet.

Soru 8: What special syntax in Python passes a keyword and a variable-length argument list to a function?

  • *args
  • *kwarg
  • argw
  • **kwargs
  • I don’t know yet.

Soru 9: What statement unbinds names?

  • break
  • pass
  • nonlocal
  • del
  • I don’t know yet.

Soru 10: What list in Python contains arguments passed to a script?

  • sys.argv
  • list.argv
  • arguments.list()
  • stdout()
  • I don’t know yet.

Soru 11: Which module must be imported when you want to perform unit tests in Python?

  • unittest
  • test
  • nose
  • pytest
  • I don’t know yet.

Soru 12: While producing a packaged Python code, which file can you leave empty?

  • __str__.py
  • init.py
  • __main__.py
  • __root__.py
  • I don’t know yet.

Soru 13: If you don’t use contextlib.ContextDecorator, which statement will you always use when working with a context manager?

  • with
  • nonlocal
  • assert
  • as
  • I don’t know yet.

Soru 14: What is the Python syntax for defining an empty set literal?

  • ()
  • set()
  • {}
  • []
  • I don’t know yet.

Soru 15: What is the output of the following Python code?

def call_obj(arg1, arg2):
    return arg1 ** arg2, arg2 ** arg1

a1, a2 = 5, 2
print(call_obj(a1, a2))
  • (25, 32)
  • [32, 25]
  • [25, 32]
  • (32, 25)
  • I don’t know yet.

Soru 16: What is the issue with using the following shebang line?

#!/usr/bin/env python
  • It requires an asterisk to run dynamically.
  • It won’t run without identifying a version.
  • It could run in an incompatible version of Python.
  • If a system has Python 2, it will try to run on Python 3.
  • I don’t know yet.

Soru 17: Why does the following logical expression return a value of False?

'b' == ('a' or 'b')
  • The first letter ‘b’ when compared to the letter ‘a’ returns False which when compared to the last letter ‘b’ returns False
  • Starting with the parenthesis, the logical operation (‘a’ or ‘b’) results in ‘ab’ and the letter ‘b’ is not equal to ‘ab’
  • Starting with the parenthesis, the logical operation (‘a’ or ‘b’) returns False and the letter ‘b’ is not equal to the boolean False
  • Starting with the parenthesis, the letter ‘a’ short-circuited the logical operation (‘a’ or ‘b’) resulting in ‘b’ == ‘a’ which is False
  • I don’t know yet.

Soru 18: After downloading and unpacking the source distribution of a Python package from a source, which script installs the package?

  • install.py
  • setup.py
  • config.py
  • make
  • I don’t know yet.

Soru 19: What takes place when a generator function calls yield?

  • The generator function exits and the variables are all initialized to 0.
  • The generator function iterates through a nested for loop and saves each iterator into a new temporary variable.
  • The generator function continues execution as normal until the yield function no longer can return positive integers.
  • The generator function will save all variable values and pause. The code to be executed next is saved and will execute when the next() function is called.
  • I don’t know yet.

Soru 20: What will the result of the following code be?

from itertools import zip_longest
a = [1,2,3]
b = [4,5,6, 10]
c = [7,8,9, 10]

for i in zip_longest(a,b,c):
     print(i)
  • (1, 4, 7)(2, 5, 8)(3, 6, 9)(None, 10, 10)
  • (1, 2, 3)(4, 5, 6)(7, 8, 9)
  • (1, 2, 3)(4, 5, 6)(7, 8, 9)(10, 10)
  • (1, 4, 7)(2, 5, 8)(3, 6, 9)(10, 10)
  • I don’t know yet.

Soru 21: You must create a Python script that uses bitwise operators to determine binary values for two numbers with the XOR operator. What expression would successfully find the XOR value for variables A and B?

  • A&B
  • A<<B
  • A|B
  • A^B
  • I don’t know yet.

Soru 22: What can you expect first_array and second_array to be, given the following?

first_array = [1,2,3,4]
second_array = first_array

second_array.pop()
  • A
first_array = [1,2,3,4]
second_array = [1,2,3]
  • B
first_array = [1,2,3,4]
second_array = [1,2,3,4]
  • C
first_array = [1,2,3]
second_array = [1,2,3]
  • D
first_array = [1,2,3]
second_array = [1,2,3,4]
  • I don’t know yet.

Soru 23: When using the contextmanager from the contextlib module, what decorator do you use?

  • !#contextmanager
  • dec contextmanager
  • contextlib.manager
  • @contextmanager
  • I don’t know yet.

Soru 24: You are using the command line to iterate through a list using the next() command. What does it mean when you receive this error on your last execution of the next() command?

Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    next(list)
StopIteration
  • The list items are outside the bounds of what the list was initialized at.
  • The list contains integers that cannot be iterated.
  • There are no more items left in the list to iterate through.
  • The list is empty.
  • I don’t know yet.

Soru 25: What method could you apply to convert the complex number (5.74895+7j) into the integer 5?

  • int((5.74895+7j).rshift())
  • int((5.74895+7j).real)
  • int((5.74895+7j).conjugate())
  • int((5.74895+7j).round)
  • I don’t know yet.