Podcast
Questions and Answers
What is the initial step a programmer typically takes when using an existing programming library?
What is the initial step a programmer typically takes when using an existing programming library?
- Discard the library and rewrite its functionality from scratch.
- Write the library's functions to tailor them to the project.
- Modify the library's functions to optimize performance.
- Include the library in the project to access its functionalities. (correct)
What common characteristic do functions within a programming library typically share?
What common characteristic do functions within a programming library typically share?
- Every function performs the identical computation for redundancy.
- Functions all relate to the same purpose, providing different facets of a solution. (correct)
- Each function fixes bugs in the other functions to ensure stability.
- Each function competes with the other to efficiently utilize resources.
What is a primary benefit of utilizing a programming library in software development?
What is a primary benefit of utilizing a programming library in software development?
- The code has already been compiled, allowing a deeper level of customization.
- The code can be used across programming languages, ensuring broad compatibility.
- The code has not been tested, ensuring a fresh and innovative approach.
- The code has already been tested, reducing the risk of bugs. (correct)
Which of the following languages is known for being dynamically typed?
Which of the following languages is known for being dynamically typed?
Which language is least aligned with object-oriented design principles?
Which language is least aligned with object-oriented design principles?
A programming language allows a developer to define items like 'Person,' 'Teacher,' and 'Student,' each having unique data and behaviors. Which term best describes this?
A programming language allows a developer to define items like 'Person,' 'Teacher,' and 'Student,' each having unique data and behaviors. Which term best describes this?
A programmer seeks a language that will instruct the compiler to report an error if an attempt is made to assign a string value to an integer variable. Which type of language is most suitable for this purpose?
A programmer seeks a language that will instruct the compiler to report an error if an attempt is made to assign a string value to an integer variable. Which type of language is most suitable for this purpose?
A language uses tags around text to indicate how that text should be formatted. Which characteristic describes a language having such tags?
A language uses tags around text to indicate how that text should be formatted. Which characteristic describes a language having such tags?
Which of the following is a fundamental attribute of a compiled language?
Which of the following is a fundamental attribute of a compiled language?
Which of the following is a defining characteristic of an interpreted language?
Which of the following is a defining characteristic of an interpreted language?
What is a key advantage of interpreted programs?
What is a key advantage of interpreted programs?
Which characteristic specifically describes a markup language?
Which characteristic specifically describes a markup language?
Which characteristic specifically describes interpreted languages?
Which characteristic specifically describes interpreted languages?
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20?
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20?
Which operator should be used to determine if a number is evenly divisible by 5?
Which operator should be used to determine if a number is evenly divisible by 5?
A variable should hold a person's height in meters. Which data type should the variable be?
A variable should hold a person's height in meters. Which data type should the variable be?
A variable should hold the names of all past U.S. presidents. Which data type should the variable be?
A variable should hold the names of all past U.S. presidents. Which data type should the variable be?
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?
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?
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?
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?
Given integer x = 3
and integer y = 5
, what is the value of the expression (x / 2.0) + y
?
Given integer x = 3
and integer y = 5
, what is the value of the expression (x / 2.0) + y
?
Given float x = 10.2
and float y = 1.0
, what is the value of the expression x / y
?
Given float x = 10.2
and float y = 1.0
, what is the value of the expression x / y
?
What kind of operator is the ==
in the expression i == 20
?
What kind of operator is the ==
in the expression i == 20
?
What is the purpose of parentheses ()
in a programming expression?
What is the purpose of parentheses ()
in a programming expression?
Given float x = 3.0
, which expression evaluates to 2.0?
Given float x = 3.0
, which expression evaluates to 2.0?
Flashcards
Programming Library
Programming Library
A collection of functions, procedures, data, and documentation that can be used by programmers to add functionality to their programs.
Library function relationship
Library function relationship
Functions in a programming library relate to a specific, shared purpose.
Advantage of using a library
Advantage of using a library
A key advantage is that the code within it has already been tested, making it more reliable.
Dynamically typed language
Dynamically typed language
Signup and view all the flashcards
Non-Object Oriented Language?
Non-Object Oriented Language?
Signup and view all the flashcards
Object-Oriented Programming
Object-Oriented Programming
Signup and view all the flashcards
Statically typed languages
Statically typed languages
Signup and view all the flashcards
Markup Language
Markup Language
Signup and view all the flashcards
Compiled Language
Compiled Language
Signup and view all the flashcards
Interpreted Language
Interpreted Language
Signup and view all the flashcards
Advantage of Interpreted Programs
Advantage of Interpreted Programs
Signup and view all the flashcards
Markup Language Defined
Markup Language Defined
Signup and view all the flashcards
Interpreted Languages Defined
Interpreted Languages Defined
Signup and view all the flashcards
Interpreted Languages Defined Again
Interpreted Languages Defined Again
Signup and view all the flashcards
Compute Miles Per Gallon
Compute Miles Per Gallon
Signup and view all the flashcards
Modulus Operator (%)
Modulus Operator (%)
Signup and view all the flashcards
Represent a person's height in meters
Represent a person's height in meters
Signup and view all the flashcards
Hold the names of all past US presidents
Hold the names of all past US presidents
Signup and view all the flashcards
Declare num of seconds in a minute
Declare num of seconds in a minute
Signup and view all the flashcards
Declare min age
Declare min age
Signup and view all the flashcards
What kind of operator is ==
What kind of operator is ==
Signup and view all the flashcards
What is the role of parentheses?
What is the role of parentheses?
Signup and view all the flashcards
Represent an age range
Represent an age range
Signup and view all the flashcards
Data Type for Length?
Data Type for Length?
Signup and view all the flashcards
Input for hours to minutes
Input for hours to minutes
Signup and view all the flashcards
Study Notes
Programming Libraries
- The first step a programmer takes when using an existing programming library is to include the library.
- Functions within a programming library typically relate to the same general purpose.
- A key advantage of using a programming library is that the code has already undergone testing.
Dynamically Typed Languages
- Python is an example of a dynamically typed language.
Object-Oriented Programming
- C is a language not built on object-oriented design principles.
- Object-oriented languages allow programmers to create items with internal data and operations, such as persons, teachers and students.
- When a programmer requires a compiler to report an error on assigning a string to an integer variable, a statically typed language should be used.
Markup Languages
- Markup languages use tags around text to specify formatting.
Compiled Languages
- A characteristic of a compiled language is its conversion to machine language before running.
Interpreted Languages
- A characteristic of an interpreted language is that it runs easily on different kinds of machines.
- Interpreted programs have the advantage of being modifiable at run time.
- Interpreted languages are specifically described as being able to run one statement at a time.
- Interpreted languages can run on any machine that has the correct interpreter.
Mathematical Operations
- To calculate miles per gallon, divide the miles driven by the gallons of fuel used (200 miles / 10 gallons = 20 mpg).
- The "%" operator is used to determine if a number is evenly divisible by another number.
Data Types
- A variable holding a person's height in meters should be a Float data type.
- A variable should hold the names of past U.S. presidents as a String array data type.
Declaring Variables
- To store the number of seconds in a minute for calculations, it should be declared as a constant integer named secondsPerMinute.
- To store the minimum age to run for U.S. president (35), it should be declared as a constant integer minAge.
Expressions
- The expression (x / 2.0) + y, given integer x = 3 and integer y = 5, evaluates to 6.5.
- The expression x / y, given float x = 10.2 and float y = 1.0, evaluates to 10.2.
- The "==" in the expression i == 20 is an equality operator.
- Parentheses in a programming expression are used to group expressions.
- Given float x = 3.0, the expression x / 2 + 0.5 / 2 + .25 evaluates to 2.0.
- The expression (x >= 18) and (x <= 24) represents all values of x when x is an age ranging from 18 to 24 years old.
- Float data type is used for items that are measured in length.
- The data type that should be used to keep track of how many planes are in a hangar is Integer.
Function Input
- When a function converts hours and minutes to seconds, the input should be hours and minutes.
- A function returning x cubed (x * x * x) requires x as the input.
- A function calculating the weight difference (Diff) between two sample weights (S1 and S2) should output Diff.
- For a function P(integer x) returning integer y = 2 * x, P(5) evaluates to 10
- If Function F() "Puts "Hey" to output", after three successive calls to F() "HeyHeyHey" is displayed.
- A valid user-defined function name can be any valid identifier.
- A function MyFct with input x and output z returns z only.
- The return value of a function is the Output of a function.
Control Structures
- A "while loop" control structure should be used for accepting input numbers and adding them to a sum until a 0 is input.
- A "do-while loop" control structure supports a game that prompts the user to enter an answer and checks if the input matches the correct answer and continues prompting the user until the answer matches the correct answer.
Pseudocode
- Given the pseudocode:
x=3
do
Put x to output
Put " " to output
x=x-1
while x > 0
- The put to output is 3 2 1.
- Given the code:
count = 0
while count is less than 5:
print 'Hello'
- "Hello" will print indefinitely.
- In the pseudocode:
i=0
while i < 20
Put i to output
i=i+1
- The loop expression is i < 20
- In the pseudocode:
y=0
s = 100.0
while y < 10
s = s + (s * 5.0)
y=y+1
- The loop variable initialization is y=0.
- To output the minimum of x and y, the correct order of statements is: declare variable min, min = x, If y < min, set min = y, Put min to output.
- To calculate speed in miles per hour given a start and end location and time traveled in hours, the order of the required statments is: Declare variables distMiles and speedMph, distMiles = endLocation - startLocation, speedMph = distMiles / timeHours, Put speedMph to output
- To create a pyramid (large on bottom, small on top) on a table, the correct order of actions is: Clear table, Place largest shape, Place middle-sized shape, Place smallest shape.
Algorithms
- The algorithm:
if x == y
z=1
else
z=0
- determines whether x and y are the same.
- The algorithm:
x = Get next input
if x == –1
Put "Goodbye" to output
- outputs Goodbye when user types -1.
- Given the algorithm:
i=0
x=0
while i < 5
if list[i] < 0
x=1
i=i+1
Put x to output
- An output of 1 indicates at least one integer is negative.
- A programmer should develop an algorithm to solve a problem before writing a program to solve the problem.
- "Insert key, turn key, open door" represents an algorithm.
- "Shake bulb; if it rattles, replace it" represents an algorithm.
- For an algorithm that should output "OK" if a list's numbers are all non-zero, else "Not OK", a valid test is Input 99, 0, 5. Ensure output is "Not OK."
Flowcharts
- In the flowchart, if the input is 17, OK is printed.
- In the flowchart, if the input is 3 5 -1, 6 10 will be printed.
Class Diagrams
- A class diagram depicts the Employee class' name, data members, and functions.
- System’s classes, attributes, and methods and their features, constraints, and relationships are elements that are characteristic of a class diagram.
Use Case Diagrams
- A use case diagram provides an overview of several use cases.
Waterfall Approach
- The design phase of a waterfall approach would create a sequence diagram that specifies the required order of events between completed program components.
- The analysis phase of a waterfall approach defines a program's goals.
- Testing is the phase of a waterfall approach where another person runs the program hundreds of times with different input, checking that each run yields correct output.
- When a programmer starts writing the program in C++ using several functions, implementation phase of a waterfall approach is occurring.
- When a company leadership determines that the system should support direct data entry as well as automated data capture of phone calls and emails, the analysis phase of the waterfall process is occurring.
Agile Approach
- The testing phase of an agile approach would define a hypothesis to find a problem in a program.
- The implementation phase of an agile approach creates an executable program.
- The design phase of an agile approach creates a list of components needed to build an online auction site.
- In an agile approach, the analysis phase is when goals are changed based on customer feedback.
- If a programmer begins writing a second version of the program implementation phase of an agile approach , based on feedback.
- If a colleague runs the second version of the program on numerous inputs to ensure outputs are correct, testing phase of an agile approach is being carried out.
- The programming of the fourth version occurs during the implementation phase of an agile approach.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.