Docsity

ULTIMATE D278 SCRIPTING AND PROGRAMMING FOUNDATIONS QUESTIONS AND ANSWERS SOLVED CORRECTLY, Exams of Programming Paradigms

Toggle sidebar
bg1
ULTIMATE D278 SCRIPTING AND PROGRAMMING
FOUNDATIONS QUESTIONS AND ANSWERS SOLVED
CORRECTLY LATEST UPDATE GRADED A+
Question 1.
Which operator should be used to determine if a number is evenly divisible by 5?
ANSWER
%
Question 2.
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles
per gallon, which is 20?
ANSWER
Division
Question 3.
A variable should hold a person's height in meters.
Which data type should the variable be?
ANSWER
Float
Question 4.
A variable should hold the names of all past U.S. presidents.
Which data type should the variable be?
ANSWER
String array
1 / 23
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download ULTIMATE D278 SCRIPTING AND PROGRAMMING FOUNDATIONS QUESTIONS AND ANSWERS SOLVED CORRECTLY and more Exams Programming Paradigms in PDF only on Docsity!

ULTIMATE D278 SCRIPTING AND PROGRAMMING

FOUNDATIONS QUESTIONS AND ANSWERS SOLVED

CORRECTLY LATEST UPDATE GRADED A+

Question 1.

Which operator should be used to determine if a number is evenly divisible by 5?

ANSWER %

Question 2.

A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20?

ANSWER Division

Question 3.

A variable should hold a person's height in meters. Which data type should the variable be?

ANSWER Float

Question 4.

A variable should hold the names of all past U.S. presidents. Which data type should the variable be?

ANSWER String array

A program uses the number of seconds in a minute in various calculations. How should the item that holds the number of seconds in a minute be declared?

ANSWER Constant integer secondsPerMinute

Question 6.

A program determines if a user's age is high enough to run for U.S. president. The minimum age requirement is 35. How should the item that holds the minimum age be declared?

ANSWER Constant integer minAge

Question 7.

Given integer x = 3 and integer y = 5. What is the value of the expression ( x / 2.0) + y?

ANSWER

Question 8.

Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y?

ANSWER

Question 9.

What kind of operator is the == in the expression i == 20?

ANSWER Equality

A function should convert hours and minutes to seconds, such as converting 1 hour and 10 minutes to 4,200 seconds. What should be the input to the function?

ANSWER Hours and minutes

Question 16.

A function returns a number x cubed. For example, if x is 3, the function returns 3 * 3 * 3, or 27. What should be the input to the function?

ANSWER x

Question 17.

A function calculates the weight difference (Diff) given two sample weights (S1 and S2). What should be the output from the function?

ANSWER Diff

Question 18.

function P(integer x) returns integer y y = 2 * x What does P(5) evaluate to?

ANSWER 10

Question 19.

Function F() Put "Hey" to output What entire output appears after three successive calls to F()?

ANSWER HeyHeyHey

What is a valid user-defined function name?

ANSWER Any valid identifier

Question 21.

A function MyFct has an input x and an output z. What does MyFct return?

ANSWER z only

Question 22.

What is the return value of a function?

ANSWER Output of a function

Question 23.

A program should continue accepting input numbers, adding each to a sum, until a 0 is input. Which control structure should be used?

ANSWER While loop

Question 24.

Joe is building an online game. He wants to provide a riddle and have the player guess the answer. The game needs to prompt the user to enter the answer, check to see if it the input provided does not match the correct answer, and continue prompting the user until the answer entered matches the correct answer. Which control structure supports Joe's needs?

ANSWER Do-while loop

What is the loop variable initialization in the following pseudocode? y = 0 s = 100. while y < 10 s = s + (s * 5.0) y = y + 1

ANSWER y = 0

Question 29.

Order the steps needed to output the minimum of x and y from first (1) to last (4). A Declare variable min B Put min to output C min = x D If y < min, set min = y

ANSWER ACDB

Question 30.

Order the steps needed to calculate speed in miles per hour given a start and end location and time traveled in hours from first (1) to last (4). A Put speedMph to output B Declare variables distMiles and speedMph C distMiles = endLocation - startLocation D speedMph = distMiles / timeHours

ANSWER BCDA

Order the tasks needed to create a pyramid (large on bottom, small on top) on a table from first (1) to last (4). A Place largest shape. B Clear table C Place smallest shape. D Place middle-sized shape.

ANSWER BADC

Question 32.

What does the following algorithm determine? if x == y z = 1 else z = 0

ANSWER Whether x and y are the same

Question 33.

What does the following algorithm accomplish?

x = Get next input if x == - Put "Goodbye" to output

ANSWER Outputs Goodbye when user types -

Question 34.

What does an output of 1 indicate for the following algorithm running on a five-element list of integers?

i = 0 x = 0 while i < 5 if list[i] < 0 x = 1 i = i + 1 Put x to output

Which phase of a waterfall approach would create a sequence diagram that specifies the required order of events between completed program components?

ANSWER Design

Question 41.

Which phase of an agile approach would define a hypothesis to find a problem in a program?

ANSWER Testing

Question 42.

Which phase of an agile approach would create an executable program?

ANSWER Implementation

Question 43.

Which phase of an agile approach would create a list of components needed to build an online auction site?

ANSWER Design

Question 44.

Which phase of a waterfall approach defines a program's goals?

ANSWER Analysis

After a programmer is done writing a program, another person runs the program hundreds of times, each time with different input, checking that each run yields correct output. Which phase of a waterfall approach is the person carrying out?

ANSWER Testing

Question 46.

A programmer decides a program should convert U.S. units to metric units and decides to write the program in C++ using several functions. Which phase of a waterfall approach is occurring when the programmer starts writing the program?

ANSWER Implementation

Question 47.

A company has a new project it wishes to implement to track and analyze employee and customer interactions. The company leadership determines that the system should support direct data entry as well as automated data capture of phone calls and emails.

Which phase of the waterfall process is occurring?

ANSWER Analysis

Question 48.

A programmer shows a program's first version to a customer. The customer provides feedback, which causes the programmer to change the goals of the program. In which phase of an agile approach are goals changed based on customer feedback?

ANSWER Analysis

What is an advantage of using a programming library?

ANSWER The code has already been tested

Question 55.

Which language is dynamically typed?

ANSWER Python

Question 56.

Which language is not built on object-oriented design principles?

ANSWER C

Question 57.

A language substantially supports a programmer creating items like person, teacher, and students. Each item has internal data and some operations. Which characteristic describes that language?

ANSWER Object-oriented

Question 58.

A programmer wants a compiler to report an error if an integer variable is assigned with a string. Which kind of language should the programmer use?

ANSWER Statically typed

A language uses tags around text to indicate how that text should be formatted. Which characteristic describes a language having such tags?

ANSWER Markup

Question 60.

What is a characteristic of a compiled language?

ANSWER Converts to machine language before running

Question 61.

What is a characteristic of an interpreted language?

ANSWER Runs easily on difefrent kinds of machines

Question 62.

What is an advantage of interpreted programs?

ANSWER They can be modified at run time

Question 63.

Which characteristic specifically describes a markup language?

ANSWER Tags surround text to describe desired formatting

Question 64.

Which characteristic specifically describes interpreted languages?

ANSWER They can be run one statement at a time

Algorithm

ANSWER A sequence of instructions that solves a problem.

Question 72.

Flowchart

ANSWER A graphical language for creating or viewing computer programs.

Question 73.

Run execute

ANSWER Carrying out a program's statements.

Question 74.

String literal

ANSWER Consists of text (characters) within double quotes, as in "Go #57!".

Question 75.

Characters

ANSWER Any letter (a-z, A-Z), digit (0-9), or symbol (~, !, @, etc.).

Question 76.

Newline

ANSWER A two-character sequence \n whose appearance in an output string literal causes the cursor to move to the next output line.

Comment

ANSWER Text a programmer adds to a program, to be read by humans to better understand the code, but ignored by the program when executing.

Question 78.

Whitespace

ANSWER Refers to blank spaces (space and tab characters) between items within a statement, and to newlines.

Question 79.

Moore's Law

ANSWER Engineers have reduced switch sizes by half about every 2 years.

Question 80.

Assignment statement

ANSWER Assigns a variable with a value, such as x = 5.

Question 81.

Variable declaration

ANSWER Specifies the variable's name and type.

Question 82.

Integer

ANSWER Can hold whole number values, like 1, 999, 0, or -25 (but not 3.5 or 0.001).

Parameter

ANSWER A function input specifeid in a function definition.

Question 90.

Loop

ANSWER A program that repeatedly executes statements while the expression is true; when false, execution proceeds past.

Question 91.

Pseudocode

ANSWER Text that resembles a program in a real programming language but is simplified to aid human understanding.

Question 92.

if else

ANSWER A decision and its two branches. Because IF the decision's expression is true then the first branch executes, ELSE the second branch executes.

Question 93.

Boolean

ANSWER A type that has just two values: true or false.

Question 94.

While loop

ANSWER A loop that repeatedly executes the loop body while the loop's expression evaluates to true.

For loop

ANSWER A loop with three parts at the top: a loop variable initialization, a loop expression, and a loop variable update.

Question 96.

Do While loop

ANSWER A loop that first executes the loop body's statements, then checks the loop condition.

Question 97.

Array

ANSWER An ordered list of items of a given data type.

Question 98.

Function call

ANSWER Consists of the function name and parentheses, within which comma-separated arguments (if any) appear.

Question 99.

Analysis

ANSWER This first SDLC phase determines the goals and requirements for a system.

Question 100.

Design

ANSWER This second SDLC phase defnies specifics of how to build a program.