Wednesday , December 18 2024
Breaking News

CS105: Introduction to Python Final Exam Answers | Saylor Academy

Saylor Academy CS105: Introduction to Python Final Exam Answers

  • The number 4 will be echoed to the screen
  • The character a will be echoed to the screen
  • <class ‘int’> will be echoed to the screen
  • An error will occur because type is not a valid command
  • 34
  • 3.0
  • 3.4
  • 34.0
  • 5=b+b
  • b=b+5
  • b=b*5
  • b+5=b
  • ‘value 1 = 25 , value 2 = 30’
  • ‘value 1 = 125 , value 2 = 20’
  • ‘value 1 = 140 , value 2 = 150’
  • ‘value 1 = 150 , value 2 = 140’
  • 213
  • ‘vwyza’
  • ‘t+s[0]’
  • ‘vawayaza’
  • x == not y
  • x>y or x<y
  • x not == y
  • x>y and x<y
  • The logical operators are disregarded
  • The relational operators are disregarded
  • Logical operators have higher precedence than relational operators
  • Relational operators have higher precedence than logical operators
  • 1
  • 1.5
  • True
  • False
  • An empty string
  • A user input variable
  • A variable of type int
  • A programmer-initialized variable
  • The string ‘z12’
  • 12 times the value input into the variable z
  • z copies of ’12’ will be concatenated together and output
  • An error, because the print expression mixes a string with a numeric value
  • 1
  • 2
  • 3
  • 4
  • c=2
  • c=4
  • c=8
  • c=10
  • Stopping a program from terminating
  • Disregarding a variable assignment within a loop
  • Allowing a program to continue when an input error occurs
  • Skipping over a set of commands within a loop and beginning the next iteration
  • Container
  • Index
  • Operator
  • Sequence
  • a.append(i+i)
  • a.append(a[i]+i)
  • a.append(a[i]-i)
  • a.append(a[i]+2*i)
  • -1
  • 8
  • [8, 7, 6, 5, -4, -3, -2, -1]
  • An error, because a negative index has been used
  • The operation 2*x is invalid
  • plt is not an allowed object name
  • matplotlib cannot be used to plot functions
  • The list defined by x does not contain enough data
  • By replacing the for loop with print(a)
  • By replacing the for loop with s=len(a)
  • By replacing the for loop with s=max(a)
  • By replacing the for loop with s=sum(a)
  • Colon
  • Comma
  • Period
  • Semicolon
  • 0
  • 1
  • 7
  • 12
  • The cosine function over the interval 0 to pi
  • The cosine function over the interval 0 to 2*pi
  • The cosine function over the interval n to pi
  • The cosine function over the interval n to 2*pi
  • -1e300
  • -1.0
  • 0.0
  • 1.0
  • Because tuples are not mutable
  • Because an index cannot be used to access tuple elements
  • Because tuple elements must be separated by a semi-colon
  • Because tuple elements must be contained within curly brackets, not parentheses
  • Sets are an ordered collection of elements and are mutable
  • Sets are an unordered collection of elements and are mutable
  • Sets are an ordered collection of elements and are not mutable
  • Sets are an unordered collection of elements and are not mutable
  • xdict[‘k1’] refers to a set
  • xdict[‘k1’] refers to a tuple
  • xdict[‘k3’] refers to a se
  • xdict[‘k3’] refers to a tuple
  • for d in key:
  • for v in key:
  • for key in v:
  • for key in d:
  • a
  • r
  • r+
  • w
  • float
  • int
  • list
  • str
  • myfile = open(‘source.txt’)

for line in myfile:

    print(myfile.readlines())

myfile.close()

  • myfile = open(‘source.txt’)

for line in myfile:

    print(readlines())

myfile.close()

  • myfile = open(‘source.txt’)

for line in myfile:

    print(line)

myfile.close()

  • myfile = open(‘source.txt’)

for line in myfile:

    print(myfile.read())

myfile.close()

  • -3
  • 2
  • 7
  • 8
  • Store the pattern to a file
  • Convert the pattern into machine code
  • Increase the efficiency of pattern matching
  • Enable pattern matching using other programming languages
  • ‘.[A-Z]\s’
  • ‘.\s[A-Z]’
  • ‘[A-Z]\.\s$’
  • ‘[A-Z]\.\s’
  • pattern = ‘[A-Z]\.\s[a-z]*’
  • pattern = ‘[A-Z]*\.\s[a-z]’
  • pattern = ‘[A-Z]*\.\s[a-z]*’
  • pattern = ‘[A-Z]+\.\s[a-z]+’
  • a.Multiple errors can be handled within a single ‘except’ block
  • b.Each ‘try’ block must be associated with exactly one ‘except’ block
  • c.The ‘except’ block will not execute unless the type of error is specified
  • d.An ‘else’ block must be included for handling the case where no error occurs
  • except NameError:

    print(‘NameError’)

  • except TypeError:

    print(‘TypeError’)

  • except ArithmeticError:

    print(‘ArithmeticError’)

  • except ValueError:

    print(‘ValueError’)

  • Dictionaries
  • Functions
  • Snippets
  • Variables
  • Their methods must be different
  • They will have different attributes
  • Their data attributes can take on different values
  • They cannot both be used as inputs to a function
  • def __ge__(self,other):

    return self.radius&gt;other.radius

  • def __geq__(self,other):

    return self.radius&gt;other.radius

  • def ge(self,other):

    return self.radius&gt;other.radius

  • def geq(self,other):

    return self.radius&gt;other.radius

Answer:

Answer:

def listprod(x):

    p=1

    for i in x:

        p=p*i

    return p

Answer:

def distprop(A,B,C):

    if A.union(B.intersection(C)) == (A.union(B)).intersection(A.union(C)):

        return True

    else:

        return False

About Clear My Certification

Check Also

Information Technology Management Professional CertificatioN

Information Technology Management Professional Certification

Information Technology Management Professional Certification Information Technology Management involves overseeing and directing the use of …

Leave a Reply

Your email address will not be published. Required fields are marked *