hich of the following correctly matches a function to its purpose?(1 point)

Responses

data.info()

displays the count, mean, min, max, standard deviation, and quartiles for all numerical data

data.info() displays the count, mean, min, max, standard deviation, and quartiles for all numerical data

data.shape()

displays the number of rows and columns in the data

data.shape() displays the number of rows and columns in the data

data["column"].value_counts()

displays the number of columns

data["column"].value_counts() displays the number of columns

data.describe()

displays the type of data in each column

11 answers

The correct matches of functions to their purposes are as follows:

  1. data.info():

    • Correct Purpose: Displays a summary of the DataFrame, including the number of non-null entries, data types of columns, and memory usage. (However, it does not display statistics like mean, min, max, etc.)
  2. data.shape():

    • Correct Purpose: Displays the number of rows and columns in the data. (This statement is correctly matched.)
  3. data["column"].value_counts():

    • Correct Purpose: Displays the counts of unique values in the specified column (not the number of columns).
  4. data.describe():

    • Correct Purpose: Displays descriptive statistics like count, mean, std, min, max, and quartiles for numerical columns in the DataFrame. (It does not display the type of data in each column—that's the role of data.info().)

Based on this breakdown, the only correct and complete match is:

  • data.shape() displays the number of rows and columns in the data.
Which is a type of error within the sequence of characters that is written in a programming language?(1 point)
Responses

syntax error
syntax error

processing error
processing error

data error
data error

print error

The correct response is:

  • syntax error

A syntax error occurs when the code written does not conform to the rules of the programming language, preventing it from being executed.

If you were creating code to extract data and you needed to access an established collection of resources to acquire pre-written code and routines or modules, what might you be using to extract this data to reduce code and implement an already known working code that operates correctly?(1 point)
Responses

data structure
data structure

script
script

Boolean
Boolean

library

The correct response is:

  • library

A library is a collection of pre-written code, routines, or modules that can be used to perform specific tasks, allowing you to avoid rewriting code that has already been implemented and tested.

What is the output of calling n2.calculate()?

class Addition:
def __init__(self, f, s):
self.first = f
self.second = s

def calculate(self):
self.answer = self.first + self.second
print("Addition of two numbers = " + str(self.answer))

n1 = Addition(1000, 2000)
n2 = Addition(3000,1000)
n3 = Addition(2000, 4000)
n4 = Addition(3000,4000)

(1 point)
Responses

Addition of two numbers = 6000
Addition of two numbers = 6000

Addition of two numbers = 3000
Addition of two numbers = 3000

Addition of two numbers = 7000
Addition of two numbers = 7000

Addition of two numbers = 4000

To determine the output of calling n2.calculate(), let's analyze the code provided.

  1. Class Definition:

    • The Addition class has an __init__ method that initializes two attributes: self.first and self.second.
    • The calculate method adds these two attributes (self.first and self.second) and prints the result.
  2. Object Creation:

    • n2 = Addition(3000, 1000) creates an instance of the Addition class with self.first set to 3000 and self.second set to 1000.
  3. Calculation:

    • When n2.calculate() is called, it computes self.answer as 3000 + 1000, which results in 4000.

Therefore, the output of calling n2.calculate() will be:

Addition of two numbers = 4000

The built-in Python function slice allows the programmer to select portions of the input that they want to slice out. It has two possible syntaxes, slice(stop) or slice(start, stop, step). In the single parameter version, start and step default to none. The following code will print “Str”.

String = 'String slicing'
s1 = slice(3)
print(String[s1])

Which of the following will result in the string “ti”?

(1 point)
Responses

s1 = slice(2, 6, 2)
s1 = slice(2, 6, 2)

s1 = slice(2,6)
s1 = slice(2,6)

s1 = slice(1, 5)
s1 = slice(1, 5)

s1 = slice(1, 5, 2)

To obtain the substring “ti” from the string 'String slicing', we need to analyze the options provided:

The string is 'String slicing', and we can look at the indices:

Index:     0 1 2 3 4 5 6 7 8 9 10 11 12
String:   'S t r i n g   s l i c i n g'

We want to extract the characters at index 1 and 3, which are 't' and 'i', respectively.

Now, let's evaluate each option:

  1. s1 = slice(2, 6, 2):

    • This creates a slice from index 2 to 6 with a step of 2.
    • Characters selected:
      • Index 2 → 'r'
      • Index 4 → 'n'
    • Result: 'rn'
  2. s1 = slice(2,6):

    • Creates a slice from index 2 to 6 with a default step of 1.
    • Characters selected:
      • Index 2 → 'r'
      • Index 3 → 'i'
      • Index 4 → 'n'
      • Index 5 → 'g'
    • Result: 'ring'
  3. s1 = slice(1, 5):

    • Creates a slice from index 1 to 5 with a default step of 1.
    • Characters selected:
      • Index 1 → 't'
      • Index 2 → 'r'
      • Index 3 → 'i'
      • Index 4 → 'n'
    • Result: 'trin'
  4. s1 = slice(1, 5, 2):

    • Creates a slice from index 1 to 5 with a step of 2.
    • Characters selected:
      • Index 1 → 't'
      • Index 3 → 'i'
    • Result: 'ti'

Based on this analysis, the slice that results in the string “ti” is:

s1 = slice(1, 5, 2)

If you are a programmer who needs to conduct tests to uncover errors and bugs, and are provided with special software tools to control the execution of these tests, what would be the best form of testing that would allow you to compare the test results with the perceived expected ones?(1 point)
Responses

test case
test case

beta testing
beta testing

alpha testing
alpha testing

automated testing

The best form of testing that allows you to compare the test results with the perceived expected ones is:

  • test case

A test case is a specific set of conditions or variables under which a tester will determine whether a system or software application is functioning correctly. It includes the input data, execution conditions, testing procedure, and the expected results, allowing for a direct comparison between the actual output and the expected output.