Intro To Programming With Python

Ace your homework & exams now with Quizwiz!

Not equal to

!=

What are the three logical operators used to write compound conditions?

"and", "or" , and "not"

Give examples of integers.

-12, 4, 0, 234, -768, 99

Decimal numbers are based on 10 digits from __________.

0-9

Give examples of floating point numbers.

0.0, 4.64, -234.145, 1.2, -0.45

Read the following Python code: day = 12 binaryDay = bin(day) print(binaryDay) Which of the following is the correct output? 1) 0b1100 2) 0d1100 3) 0p1100 4) 0x1100

1) 0b1100

Which of the following represents the numeric value nine as a decimal number? 1) 9 2) 01001 3) N 4) Nine

1) 9

The programmer starts with a high-level description of what the program will do, and then breaks it down into the functions needed to complete the actions. How would you classify it? 1) An aspect of procedural programming 2) A disadvantage of object-oriented programming 3) An outcome of object-oriented programming 4) A result of procedural programming

1) An aspect of procedural programming

What is a way to protect against a security threat to a computer system? 1) Avoid external links with inconsistent URLs 2) Create a disaster recovery plan 3) Open online pop-up notifications 4) Post personal information online

1) Avoid external links with inconsistent URLs

Which of the following would be considered unethical for a programmer to do? 1) Create software used to take another person's identity 2) Protect users from unauthorized access to their personal information 3) Test code to check for errors that could cause security issues 4) Use someone else's code with the original developer's permission

1) Create software used to take another person's identity

Which backup type should be used to back up all data since the last full backup? 1) Differential 2) Full 3) Incremental 4) Mirror

1) Differential

What is a disaster recovery plan? 1) Outline of procedures to retrieve an organization's data in the event of a catastrophe 2) Program code used to save an organization's lost data after a catastrophe has occurred 3) Software designed to keep an organization's data secure in the event of a catastrophe 4) Summary of why an organization's data was involved in a catastrophe and the consequences

1) Outline of procedures to retrieve an organization's data in the event of a catastrophe

Object-oriented programming uses objects to carry out different __________. 1) actions 2) attributes 3) classes 4) systems

1) actions

Which statement uses a Boolean condition to test: "If kids are under 10, they eat for free"? 1) if( kid < 10 ): 2) if( kid > 10 ): 3) if( kid == 10 ): 4) if( kid != 10 ):

1) if( kid < 10 ):

Geneva has defined her class (class PackingList:). She wants to initialize the attributes clothes and shoes. Which of the following properly initializes the shoes attribute? 1) self.shoes = "" 2) self = shoes "" 3) self + shoes = "" 4) selfShoes = ""

1) self.shoes = ""

When was Python created?

1991

Which of the following is an example of a binary number? 1) 15 2) 01111 3) F 4) Fifteen

2) 01111

Once programmers write a useful class for one programming project, they can often reuse that class in another program instead of starting from scratch. How would you classify the characteristic? 1) An aspect of procedural programming 2) A benefit of object-oriented programming 3) A disadvantage of object-oriented programming 4) A goal of procedural programming

2) A benefit of object-oriented programming

Why would a programmer use the logical operator "and" in an if statement? 1) When an action is to be taken that requires both conditions to be false 2) When an action is to be taken that requires both conditions to be true 3) When an action is to be taken that requires the first condition to be false 4) When an action is to be taken that requires the second condition to be true

2) When an action is to be taken that requires both conditions to be true.

In order to avoid phishing scams, delete suspicious ______. 1) contacts 2) emails 3) program codes 4) text messages

2) emails

How many characters does ASCII have?

256.

Which of the following would be included in the pseudocode for a program that tests the user's vocabulary skills? 1) Ask the user for the number of guests 2) Calculate the total cost of tuition and books 3) If score is > 75, move on to the next level 4) Print a message displaying favorite food

3) If score is > 75, move on to the next level

How could an online college utilize enterprise software? 1) Develop new technical support jobs 2) Improve course resources and navigation 3) Provide access to course registration 4) Supply online word processing software

3) Provide access to course registration

Why would a programmer employ regression testing? 1) To employ quality analysts in finding minor and major errors 2) To have users find errors or bugs that developers missed 3) To find errors in new versions that did not exist in the original 4) To test long programs efficiently without requiring a human

3) To find errors in new versions that did not exist in the original

Kim needs to initialize a new object with the attributes player and score. Which of the following correctly sets the initial values? 1) def __init__(self; player = ""; score = 0): 2) def __init__(self + player = "" + score = 0): 3) def __init__(self, player = "", score = 0): 4) def __init__(self = player = "" + score = 0):

3) def __init__(self, player = "", score = 0):

yards = 26 hexadecimal Yards = hex(yards) print(hexadecimalYards) Which of the following is the correct output? 1) 0b1a 2) 0d1a 3) 0h1a 4) 0x1a

4) 0x1a

Which of the following is considered information? 1) A single keystroke 2) All the characters on a keyboard 3) An individual test score 4) Average of a series of test scores

4) Average of a series of test scores

Which one of the following best demonstrates a SMART goal? 1) I hope to raise my GPA before I graduate. 2) I should study more before tests and quizzes. 3) I want to do better in school. 4) I will do all my homework and raise my C's by the end of the quarter.

4) I will do all my homework and raise my C's by the end of the quarter.

What type of data is backed up during incremental backup? 1) All data 2) All data since last backup 3) Exact copy of new or modified files/folders 4) Only new or modified files/folders

4) Only new or modified files/folders

Which of the following would be considered a security threat to computer systems? 1) Enterprise software 2) Lightning 3) Mirror backup 4) Terrorist

4) Terrorist

Tanya is writing a program to design t-shirts. Which of the following properly defines the t-shirt class? 1) classTShirt 2) class + TShirt 3) class = (TShirt): 4) class TShirt:

4) class TShirt:

Scout sold fewer than 20 boxes of cookies. Scout missed more than one meeting. Which of the following statements tests if one of the conditions has been met? 1) if(boxes < 20 and meetingsMissed > 1): 2) if(boxes < 20 and meetingsMissed >= 1): 3) if(boxes < 20 or meetingsMissed >= 1): 4) if(boxes < 20 or meetingsMissed > 1):

4) if(boxes < 20 or meetingsMissed > 1):

Corrine is writing a program to design t-shirts. Which of the following correctly sets an attribute for fabric? 1) self+fabric = fabric 2) self(fabric): 3) self = fabric() 4) self.fabric = fabric

4) self.fabric = fabric

Jamal currently has a class named ReactionButton. In his program, he created two instances named smile and frown. He wants to add one more instance named surprise to the program. Which statement should he use? 1) class Surprise: ReactionButton 2) def __init__(Surprise = ReactionButton) 3) self.surprise = "ReactionButton" 4) surprise = ReactionButton()

4) surprise = ReactionButton()

if(x > 5 and x < 10): Which values of x make the if condition true?

6, 7, 8, 9

Less than and Greater than

< and >

Less than or equal to and Greater than or equal to

<= and >=

Equal to

==

Boolean

A condition that evaluates whether something is true or false.

Why is version control important?

A program may go through many, different iterations in its life cycle. When a game gets a new level or when your social media app gets a better messaging capability, the programmers must keep track of both the old and the new versions. With this organization, it's much easier to fix problems that might happen during updates.

What is a string?

A sequence of letters, numbers, spaces, and symbols or alphanumeric information. It can be a single letter, a word, or even a phrase. It is not meant to perform math operations.

Turtle Graphics

A set of functions in Python that allow the programmer to draw on the screen or create images.

What is the PMR(Post Mortem Review)?

A short, written statement that evaluates how the project went, reflecting on what went well and how the program could be improved.

What is a string within quotation marks called and why?

A string literal because Python will print literally what you type, no matter what.

In object-oriented programming, what is a class?

A template with attributes and behaviors for an object.

Who is credited to be the first computer programmer?

Ada Lovelace, dubbed the "Enchantress of Numbers" by Charles Babbage, the inventor of the computer.

What does Python's Turtle Graphics Module give you control of?

An imaginary "turtle" who will follow your instructions, drawing lines as he moves around the screen.

What is the IDLE?

An integrated development environment for Python.

Benefits AGILE

As an approach to rapid development, the focus is on development rather than planning, enabling teams to start work more quickly.

When will the loop repeat its action?

As long as the condition provided is true.

How much memory space does a integer take up?

As relatively simple numbers, integers don't take up that much room.

How much memory space does a floating point take up?

Because floats have decimals, they're more precise. That means they end up taking up a lot of memory.

What does Python use to determine whether the condition is true or false?

Boolean logic.

Why do programmers update their programs?

Bugs (glitches) and enhancements (making the program better).

What do programmers refer to their errors as and why?

Bugs because the process of removing the bug is called debugging.

What do we mean by "programmers are researchers"?

Code libraries, programming threads, and collections of best practices are resources that programmers constantly seek out to improve their skills and share ideas.

Description of low-level programming languages?

Considered less readable by humans because they are written in the computer's native machine code.

What is a collection of quantities or characters computers use to perform operations?

Data.

Example of syntax error?

Error: This sentence shouldnt have eny errors Correction: This sentence shouldn't have any errors. or Error: print Hello, World! Correction: print("Hello, World!")

Example of a runtime error?

Error: print( 11 / 0 ) Correction: print( 11 / 17 )

Example of a logic error?

Error: print("Grass is purple.") Correction: print("Grass is green.")

We have to tell Python whether the values we assign to variables are numeric or alphanumeric.

False, Python can tell on its own.

In programming, it is best practice to use a pronoun for class names.

False.

Natural disasters like fires, hurricanes, and tornados are considered security threats to computer systems.

False.

Python doesn't follow order of operations.

False.

Sharing passwords with friends and family prevents risks to personal information.

False.

The code in the body of the loop does not get indented. True or False?

False.

What is the connection between programming and entertainment?

Films, video games, concerts, and more all use programmers to create the effects we enjoy.

What programming language did John Backus design?

Fortran, which has evolved to perform highly advanced calculations, and is both fast and effective at completing tasks.

Examples of strings?

Hello, world!.......800-374-1430.........Please enter your first name:.........Your address

What two categories does every programming language fall under?

High-level and Low-level.

Drawbacks WATERFALL

If a change is needed from a previous step, the project process can get seriously delayed.

Where does the test condition go?

Inside the parentheses.

What are the two numerical data types?

Int (integers) and Float (floating point numbers).

What type of testing assesses whether the behavior and functionality of separate parts of a program work together as expected?

Integration.

How much memory space does a string take up?

It depends on the length of the string. The longer the string, the more memory it takes up.

How do loops help us?

It saves time with shorter, simple code and allows for less errors since it's only a few lines.

What do left and right functions do to the turtle?

It tells it how many degrees to turn.

What do forward and backward functions do to the turtle?

It tells it how many pixels to move.

When you mix integer and float values in your arithmetic, what will the result be?

It will be a floating point number for a precise answer.

What is change management?

Keeping strong notes about what changes are needed for the future, as well as what changes have been implemented already. This can be important when the team is reviewing what it spends its time working on.

What was an important advance in 1981?

MS-DOS was released, allowing people around the world to use the early operating system for their personal computers.

What happens after programmers release software to the public?

Major focus is usually ongoing maintenance.

Pro of low-level programming languages?

More control over the hardware and executes tasks more quickly.

Pro of high-level programming languages?

More user friendly and can be used on different kinds of hardware.

Description of high-level programming languages?

Much closer to human languages than low-level languages, making it easier for programmers to learn and use.

Limit of high-level programming language?

Must be translated into machine code (this is done by interpreting and compiling).

Design

Next, design your program by writing pseudocode and mocking up how the software will work, and what it will look like.

What do programmers call numbers?

Numeric data.

Relational Operator

Operators used to compare two values, variables, or expressions.

Who is enterprise software designed to serve?

Organizations.

What programming language did Niklaus Wirth design?

Pascal, which pushed programming into a new era, one past general calculations and into a more sophisticated and structured approach.

What is the connection between programming and healthcare?

Patient portals, robotic surgery, even 3-D printed prosthetics would not have been possible without programmers.

What is the connection between programming and adaptive tech?

People with disabilities rely on programmers to create software like screen magnifiers, touch screen displays, and speech recognition software are some examples to help with daily activities.

How do procedural and object-oriented programming approaches differ?

Procedural programming breaks down the functions needed for a program step-by-step, while object-oriented programming creates classes with attributes and features.

Loop

Program statements that cause a segment of code to be repeated until a terminating condition is met.

What does the Post Mortem Review allow programmers to do?

Programmers are able to share lessons learned, reflect, and complete future projects efficiently.

What do we mean by "programmers are inventors"?

Programmers create programs that solve problems, sometimes from scratch, sometimes from existing code. Their creations help power every industry in the world.

What does programming look like today?

Programmers today work in every industry imaginable. There are thousands of different programming languages today, all developed to meet different needs. Mobile devices and constant need to access information, means a higher demand for smarter and more complex programs.

What is the connection between programming and construction?

Programmers write code to mock up buildings, map out land, and more.

Limit of low-level programming language?

Programs are written for specific computers and will only work on that one type of computer.

What programs count as programming calculations?

Programs that involve points, levels, timing, leaderboards, moves, speed, averages, etc.

Programming Task Details AGILE

Project teams do smaller portions of the entire project in small sprints. Teams can interact to handle different steps simultaneously if needed. Documentation is still required allowing teams to keep control over what version of the project they are working on and how the project has changed along the way.

Programming Task Details WATERFALL

Project teams work on one step at a time. Teams do not move to the next step until the previous step is completed and approved. Extensive documentation allowing teams to keep control over what version of the project they are working on and what changes are needed.

How do you make Python print your strings exactly as written?

Put them in quotation marks.

Why should you check spacing if you are stuck in finding errors in your code?

Python expects blocks of code to be spaced properly. Look out for indentations.

Why should you check spelling and capitalization if you are stuck in finding error in your code?

Python is case sensitive.

Which programming language is a popular one to learn first?

Python.

Why should you check punctuation if you are stuck in finding errors in your code?

Quotations or parentheses could be missing, and they are important for running code smoothly.

Attributes of a for loop?

Repeats for a set range of values and the loop variable is given a start value.

Attributes of while loop?

Repeats while a boolean condition is true and the loop variable is assigned a value before the loop.

Examples of floating point numbers?

Result on a stopwatch.....The cost of an ice cream cone......8.342.......Number of liters in a gallon

What is one benefit of using object-oriented programming?

Reusable code.

What is the connection between programming and agriculture?

Software created by programmers helps us track and plan growth so we can have the healthy food we need.

What do you need to make a loop?

Something to repeat and something that tells the program when to stop.

What kind of data type is a phone number?

String because you don't use the value to perform math.

In object-oriented programming, what is a constructor?

The code that allows a programmer to create a new object.

What is the connection between programming and education?

The education industry depends on software to help students stay at the front of today's technology.

Software Development Life Cycle

The fully planned out life of a project, from early ideas and planning, to execution and delivery, through steps.

What happens when the condition becomes false?

The loop will end.

Benefits WATERFALL

The process is clear from beginning to end.

Drawbacks AGILE

The process may become confusing at times when people jump back and forth among steps in the SDLC.

What is the connection between programming and tech?

The tech world is made up of programmers who make tomorrow's technology possible! They build social media sites, talking smart cars, etc.

What are objects defined by?

Their attributes and behaviors.

What do we mean by "programmers are fluent"?

There are thousands of programming languages, each with a different set of rules and meant for a different purpose. A programmer may specialize in one language, but it's likely that he or she is fluent in a few.

What are integers?

These are all positive and negative whole numbers, including 0.

What are floating point numbers?

These are numbers that contain a decimal point. They can be positive or negative, and they can also include 0.0.

What are programmers able to do using built-in functions from modules?

They are able to import pre-written code and make use of it when writing their own programs. This leads to fast and efficient work.

What are syntax errors?

They are the easiest and most common errors. It occurs when you've broken a programming language rule. Written languages have rules, such as spelling, grammar, and punctuation.

Attributes of while loops and for loops?

They both will repeat a block of code and will stop once the condition is false.

What can interpreters and compilers both do?

They can translate a high-level language for a computer to understand.

What are runtime errors?

They happen when you run the program. Usually, this means there's a problem with a value, and the computer can't finish doing what you requested.

What can parentheses do for your code?

They help you control the order for the final computation.

What do we mean by "programmers are visionaries"?

They just don't write one program and move on. A programmer's vision for a program includes bringing it to life and finding ways to expand and evolve it to new, better programs.

What are logic errors?

They mean the program ran, but the results were not as expected. The program's syntax is fine, so there's no error. You have to notice these problems on your own by checking to see what happens when you run the program.

What is the connection between programming and military?

They rely on programmers to develop drones, maintain operational security and develop cutting-edge technology.

Planning & Analysis

This first step is where you define your project goal, create a requirements document, and analyze the scope of work.

Coding

This is where you write the actual code needed.

Maintenance

This primarily involves updating and making improvements based on user feedback, as well as resolving any defects that arise.

Testing

This step includes identifying defects and debugging to make sure your software is running in tip top shape.

What are the two types of numbers in programming?

Those with decimals and those without.

In Python, what is the purpose of using bin() and hex() functions?

To convert decimal numbers to other number systems.

What does "print" mean in programming?

To display something on the screen.

What is the goal of unit testing?

To ensure that sections of code are functional, meet the stated requirements, and are working as expected.

Uses of low-level programming languages?

To write code/instructions/programs that control the computer's hardware.

Uses of high-level programming languages?

To write programs for just about anything (operating systems, complicated scientific calculations, general applications such as a word processor).

Examples of integers?

Total books in the Harry Potter series......6.......Steps I walked today.......Points our basketball team scored

Compiler

Translates all lines of code together and then executes them at once.

Interpreter

Translates one line of code and then executes it before moving to the next line.

A disaster recovery plan outlines the procedures to recover and protect an organization's data in the event of a catastrophe.

True.

Arithmetic performed with floating point numbers will have a result with at least one decimal place, even if it's just .0.

True.

Data sets can be described as instances when the software didn't work as expected.

True.

Defining a class in programming code is similar to writing a template.

True.

Each character on the keyboard corresponds to a specific ASCII value.

True.

In Python, output starting with 0x indicates a hexadecimal number.

True.

In Python, the first step of creating a class is to define and name it.

True.

In a compound condition, one condition on either side of the logical operator or must be true for the overall condition to be true.

True.

It is a programmer's responsibility to contribute to society and human well-being.

True.

Natural disasters like fires, hurricanes, and tornados are considered threats to computer systems.

True.

Positive and negative values can be used when commanding the turtle.

True.

Python won't let you concatenate string literals and numeric variables.

True.

Relational operators compare values and determine whether a condition of an if statement is true or false.

True.

The binary number system uses two digits.

True.

The equal sign in Python is for assigning a value to a variable, not for math.

True.

The purpose of acceptance testing is to catch simple errors, as well as major errors like bugs that might result in system crashes.

True.

Unicode has over one million characters and more are being added.

True.

When writing a while loop the statement should begin with the keyword "while". True or False?

True.

What can you do to fix Python assuming all values you enter using the input() function are strings?

Use the int() or float() functions in your code to indicate your number type.

How do you a repetitive task in programming?

Using a loop.

Back then what was the only option to "communicate" with a computer?

Using low-level languages aka machine code.

How do computers take orders?

Using programming languages.

How can we concatenate a string literal and a numeric value?

Using the str() function.

What is an example in real life that works like a while loop?

WHILE IT'S RAINING OUTSIDE...you use an umbrella. On the condition that it is raining, you will use an umbrella. Otherwise, you'll stop.

What are the two of the most common methods software development life cycles use?

Waterfall and Agile.

What are the two main things a while loop needs to know to do?

What action to do and the conditions for doing that action.

Con of high-level programming languages?

When run, programs tend to be slower than ones written with low-level languages.

for n in range(9, 20, 3):

When the loop begins, the counter variable n is assigned the start value of 9. After each iteration of the loop, the value of n increments by 3, which is the change value. The loop repeats if the value of the counting variable n is less than 20, the end value. Therefore in the loop, n will have the values of 9, 12, 15, and 18. BASICALLY, 9 is the number that counting begins on, 20 IS THE NUMBER BEFORE IT STOP SO 19 IS THE LAST NUMBER, 3 IS THE NUMBER IT INCREASES BY.

When are for loops best used?

When you know the exact number of repetitions needed.

What do we mean by "programmers are gatekeepers"?

Writing and owning a program involves testing, debugging, and resolving any issues to make sure the program is working for the user.

Con of low-level programming languages?

Written in machine code, which is challenging for humans to understand.

How does memory play a role with int and float?

You may be working with a program that tends to take up a lot of storage space on your computer. Floating point numbers take more space than integers. Example: If you can use 1 instead of 1.0, you can save yourself some memory.

How does precision play a role with int and float?

You may need to have a specific number that requires decimals. Floating point numbers allow for more precision than integers.

How does arithmetic play a role with int and float?

You may need to have the correct math. The results of integer math and floating point math aren't always the same. Example: 11/5=? Python will tell you the answer to this question is 2. If you change the numbers to decimals, you'll get a different answer: 11.0/5.0 = 2.2.

When are while loops best used?

best used when you don't know the exact number of repetitions needed

Computer programmers write code that translates commands to....

binary code so computers can understand them.

What is a for loop example?

for x in range(0, 1, 10):

In order to make an object draw a line on the screen, __________ such as forward(), left(), right(), and backward() are used.

functions

Interpreters and compilers have similar...

functions but are still a little different.

What do programmers call words?

numeric data.Non-

What is one reason a programmer may choose procedural programming over object-oriented programming?

top-down design

What is a while loop example?

x = 0 while(x < 10): x = x + 1


Related study sets

ch 14: Agricultural Methods and Pest Management

View Set

Food Handler's Basic Course Study Guide

View Set

RST End of the Chapter Questions

View Set

To what extent does technology have a positive effect on cognitive processes?

View Set

"Are Vaccines Up for Debate?" & "Which Law to Follow?"

View Set

States and Capitals (not in alphabetical order)

View Set

***HURST REVIEW NCLEX-RN Readiness Exam 1***, Hurst Practice Exam 2, Hurst Review Test # 3, Hurst Review Test #2, Hurst Readiness Exam 3, Hurst (Readiness Exam #4), Hurst (Readiness Exam #3), Hurst 1, HESI 8, HESI 7, HESI Exit 2 leigh_love_life

View Set