Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

CS 1400 EXAM 2 QUESTIONS WITH VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 5 pages

CS 1400 EXAM 2 QUESTIONS WITH VERIFIED ANSWERS

Content preview

CS 1400 EXAM 2 QUESTIONS WITH VERIFIED
ANSWERS


___ addVals(val 1, val 2)
return val 1, val 2

what's missing - Answers - def

if a function definition has the keyword return in it then it can't be a void function -
Answers - False

void function - Answers - does not have a return value

it can call return but have nothing after it so nothing returns

myFunc(val1=5, val2="Hello")

this is an example of calling a function using - Answers - keywords

when a function is called the actual parameters are pass to the function. python uses an
approach called Pass By - Answers - Value

three main purposes of using functions - Answers - make code simpler
organize code
reuse the same code

what is another term for parameters of a function when it is called - Answers -
arguments

modules - Answers - another name for files

naming convention is all lower case

2 main purposes for modules - Answers - code organization easier so it's easier to fix or
debug

it's easy to reuse

is this a valid way to call a function that has default arguments

result = addManyNum(val1 = 2, val3= 10, 40) - Answers - False

where are default arguments specified for a function - Answers - as a formal parameter

, if a function is called with parameters that do not include any keywords then the function
call only uses ___________ actual parameters - Answers - positional

a _____________ stores parameters and local variables and is a part of the program
execution management when a function is called - Answers - activation record

A _________ is a template or blueprint that is used to create an __________ of the
same type. - Answers - class , object

A __________ is used to create an instance of a class - Answers - constructor

Class A:
def _int_(self):
self.x = 1
self.__y = 2

def getY(self):
return self.__y

a= A()
print(a.__y)

what's printed - Answers - nothing bc Y is private

function vs method - Answers - functions:
defined inside a file
no required parameters
called as a stand alone code
custom data passed in a parameter

methods:
defined in a class
first parameter must be self
called after an access operator on an object
custom data obtained from instance variables and or parameters

_________ is way to diagram classes to give a visual representation - Answers - UML
unified modeling language

Encapsulation and abstraction - Answers - separation of class implementation from the
use of a class

the implementation details are hidden from user

the user knows what the result is but not how it happens

Document information

Uploaded on
July 24, 2026
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GEEKA
3.8
(361)
Sold
2138
Followers
1448
Items
58663
Last sold
11 hours ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions