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 3 out of 17 pages
Exam (elaborations)

Scripting and Programming - Foundations - C173 questions with verified answers

Document preview thumbnail
Preview 3 out of 17 pages

- Ans-subtract * Ans-multiply / Ans-divide % Ans-Modulos, does division and returns the remainder + Ans-concatenate or add Ans-less than = Ans-less than or equal to = Ans-assignment == Ans-comparisons equality Ans-greater than

Content preview

Scripting and Programming - Foundations - C173
questions with verified answers
- Ans✓✓✓-subtract


* Ans✓✓✓-multiply


/ Ans✓✓✓-divide


% Ans✓✓✓-Modulos, does division and returns the remainder


+ Ans✓✓✓-concatenate or add


< Ans✓✓✓-less than


<= Ans✓✓✓-less than or equal to


= Ans✓✓✓-assignment


== Ans✓✓✓-comparisons equality


> Ans✓✓✓-greater than


>= Ans✓✓✓-greater than or equal to

,Boolean is a true or false value Ans✓✓✓-example: myVar = True


How are buckets used in a hash table? What effect do they have on lookup
speed? Ans✓✓✓-Entries in a hash table are mapped to a number, which is the
position in the index where you should look for the entry. A hash table has
numbered bucket slots that hold entries. The entries are organized in the buckets
based on their assigned keyword number. When you run a search using a hash
table the keyword assigned will be used to determine which bucket the entry
should be located in and begin the search there. Because the search knows where
to begin looking it is much quicker to look up items.


How are compound mathematical expressions evaluated in Python? Ans✓✓✓-
First perform calculations within parentheses.
Next work left to right and perform all multiplication and division.
Finally, work left to right and perform all addition and subtraction


How are elements in a list indexed? Ans✓✓✓-List elements are assigned an index
number starting with 0.


How do you change the value of a variable with Python? Ans✓✓✓-Using the =
character to assign a new value
x=6
x=9
print x # would print out 9


How do you define outputs for a function? Ans✓✓✓-Using the return keyword
you can define what data will be returned or output when the procedure or

, function runs. You can only access data from within a function if you return that
specific data to be used outside of the function.


How do you prioritize case (best case, worst case, average case) when analyzing
algorithms? Ans✓✓✓-You would look at them in this order: Worst case, average
case, best case. The worst case is the most important because this will give you a
better understanding of why the time scales as it does.


How do you select a sub-sequence of a list with Python? Ans✓✓✓-You specify
the index position to begin the selection and the index position by which to stop
the selection. For example, the following code would print red and yellow
because they are at position 0 and 1.The value of 2 tells us to stop the selection at
position 2, but not to include it.


myColors = ["red","yellow","blue","orange","green"]
print myColors[0:2]


How do you update a list item with Python? Ans✓✓✓-By specifying the element
that you want to update and then assigning a new value. For example, the
following code would change the second element in list, from yellow to purple.


myColors = ["red","yellow","blue","orange","green"]
myColors[1] = "purple"
print myColors


How do you use dot notation to access an attribute of a class? Ans✓✓✓-You list
the individual object's name that is an instance of the class, a dot, and then the

Document information

Uploaded on
February 25, 2025
Number of pages
17
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

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.
cracker
3.8
(399)
Sold
2154
Followers
1346
Items
50067
Last sold
3 days 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