• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 31 pages
Exam (elaborations)

C173 Scripting and Programming Foundations| Questions with Complete Solutions 100% Solved| Grade A+

Document preview thumbnail
Preview 4 out of 31 pages

C173 Scripting and Programming Foundations| Questions with Complete Solutions 100% Solved| Grade A+

Content preview

C173 Scripting and Programming Foundations| Questions with Complete Solutions 100%
Solved| Grade A+
Which change would correct the following algorithm so that it will identify the maximum
number from a list with values 2,7,8,3,9,1
max = 0
for each value
if value > max
max = value
else

max = 0 * Remove the clause



What is algorithm time efficiency? The number of calculations required to solve a problem


function myNewFunction(integer x)
z=x-3
returns integer y

What is the parameter? integer x


A function's parameter is the information it needs to execute. This function needs and integer
that it will call x in order to complete.

What happens if you define a function but do not call it? Nothing. The code will simply
remain in memory but will not execute


Using the following function, which portion is the function declaration?
function myFunction(integer b)
a=b-3
returns integer a + b

myFunction(6) function myFunction(integer b)

,Using the following function, which portion calls the function?
function myFunction(integer b)
a=b-3
returns integer a + b

myFunction(6) myFunction(6)


Your user needs to enter a number into the program that will be used throughout its execution.
Before the user enters a number, which loop type can determine how many times the loop will
run? * For



Which loop types are best suited to continually check a test expression? while and do-while



What is the purpose of an "if" statement? To control what code executes based on the
result of a test expression



How many times can you call a function to run? as many times as you want


Fill in the blank so that the loop will iterate 10 times.

for i = 1; _________; i = i + 1; // Loop statements i <= 10


What is put to output by the following pseudocode?
x=4
while x >= 0
Put x to output

x=x-2 420


What is put to output by the following pseudocode?

,x=6
while x > 0
Put x to output
Put " " to output

x=x-2 642


How many times does this loop run?
a=8
b=4
while a % b == 0:
Put a to output

b=b+2 1


David is creating a grade book program for to keep track of his student's scores in a
programming course. This grade book will contain the students' names, email addresses, and
scores on each task.
Which control structure is best to look at the individual grades of each student for Task 1?
Grades are known For loop


Which control structure is best to send continual reminders to submit the upcoming
assignment and ensure that each student receives it at least once? do-while loop


Which control structure is best to assign extra credit work to each student scoring less than 75
on Task 2? if/else statement



Variable declaration Declares a new variable, specifying the variable's name and type

What is a variable? A name that can hold a value. Might be named x. Then, x = 7 assigns x
with 7, which remains in x while the program runs, until x is assigned again.

, Assignment Statement Assigns the variable on the left-side of the = with the current value of
the right-side expression



Expression A mathematical phrase that contains operations, numbers, and/or variables.


numApples is initially 5. What is numApples after:



numApples = numApples + 3; 8


Is the following statement valid?

x+y =y+x Invalid. In programming, the left side of = must be a variable, which will be
assigned with the right side's value. Thus, having x + y on the left side doesn't make sense.


Is the following assignment statement valid?

x+1=3 Valid. The left side must be a variable, not an expression like x + 1. In programming,
= does not mean equal. = means assign the left-side variable with the right-side's value. Thus,
the left side MUST be a variable.


x=9
y=x+1

What is y? 10



What does = mean? Assignment


What is the value of x?
x=2
y=3
x=x*y

Document information

Uploaded on
June 9, 2025
Number of pages
31
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$15.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.
KeithAndrews
2.9
(29)
Sold
144
Followers
5
Items
18568
Last sold
19 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