Purdue CNIT 155 Midterm Exam (Python)

Ace your homework & exams now with Quizwiz!

Which of the following is an example of a comment in python?

# This is a comment in python

Modulus operator

% (2 % 5 = 2)

What are the three phases of solving any problem?

Inputs, then Processing, then Outputs

What does \n do?

Inserts a new line in the output

What does \t do?

Inserts a tab

These are examples of numerical data types

Integers, Floating point numbers, complex numbers

What is IDE?

Integrated development environment that combines several programming tools together into one cohesive program

What is Operands?

The values the operator works on

What is Library functions?

These are inside a special library, such as the Math library, Random library, graphics library, etc

What is Built-in functions?

They are part of Python language, and there is no need for the programmer to import any library to use them

In the expression (17 * 9), the operator is:

*

Multiplication operator

* (2 * 5 = 10)

Exponent operator

** (2 ** 4 = 16)

Addition operator

+ (2 + 5 = 7)

Subtraction operator

- (2 - 5 = -3)

What is Compiler?

Translates statements in a language into machine code

What is Interpreter?

Translates the statements and executes the statements in order

T or F: "Hello, World!" is a string

True

T or F: A bit is the smallest unit of data in a computer.

True

T or F: Any inputted data is going to be considered as a String data (Regardless of what the user inputted).

True

T or F: Arithmetic operators are binary operators.

True

T or F: Boolean only has two possible values.

True

T or F: Comments should say why you are doing something.

True

T or F: High-level language can be translated into many different machine code languages for different processors.

True

T or F: Python is commonly used to create things like websites, games, and graphic interfaces.

True

T or F: String values can never be converted to integer values.

True

T or F: System Software provides the real functionality of a computer, helping your computer do specific types of work.

True

T or F: The Precedence Rules state that anything inside the ( ) gets evaluated first.

True

True or False: There are thousands of programming languages in existence.

True

Which of the following is an example of a boolean value?

True

What is the name of the python function that tells you a class?

Type

What is the extension of the source file for a python program?

.py

Division operator

/ (2 / 5 = 0.4)

Floor Division operator

// (9 // 2 = 4)

Operating Systems Layer

Windows 10, Mac OS, iOS, Android, Linux...

Which of the following is an example of software?

WingIDE 101

What is a Statement?

An instruction that the Python interpreter can execute

Which of the following is true about an integer?

An integer can be stored as a variable

Examples of application software includes all of the following, except:

Android

These are examples of boolean data types

Bool (True/False)

Rules of naming identifiers include the following, except:

Can include a space

Guido van Rossum

Creator of Python

What is the data in a program?

Data value, data types, data name, data conversion

What is Data Type?

Data values can be classified into different classes

Computer Hardware Layer

Disks, RAM, Leyboard, Mouse...

What does \" do?

Displays "

What does \\ do?

Displays \

User Layer

End users, developers...

Examples of operating systems do NOT include:

Excel

T or F: A computer, is some cases, understands more than machine code.

False

T or F: A string is a numerical type of data.

False

T or F: Python is considered a low-level language.

False

T or F: Python needs a main function to operate.

False

T or F: The print() function returns a value.

False

T or F: Values cannot be converted from one type to another.

False

T or F: print() is an example of an input.

False

What is a Variable?

A place holder in computer's RAM

What is a Source Program?

A program written in a high-level language

What is a String Literal?

A stream of characters enclosed in double quotes

What is a Test Plan?

A table with a number of test cases

What is Data Value?

A value is one of the fundamental things, like a word or a number, that a program manipulates

System Software is used for

Managing a computer's resources

Applications Layer

Microsoft Office, Safari, Bkackboard

What piece of hardware connects all the components and devices of a computer?

Motherboard

Which of the following is an example of an input device?

Mouse

Things you should identify and test in a test plan are:

Normal cases, special cases, boundary cases, and error cases

What is Machine Code?

Numbers treated as instructions by the CPU. EX: 05 01 23

What is Logical Errors?

Occur when a program provides you with actual outputs that are different from the desired outputs. The program runs but it gives wrong results.

What is Run-Time Errors?

Occur while an application is running where Python interpreter detects an operation that is impossible to complete. The program runs, but it does not complete. The program crashes in the middle of running.

What does end= do?

Prints string after all the arguments have been printed

What are Bugs?

Programming errors

Which of the following displays a proper string literal?

ProgrammingDialogue = 'Coding in python is fun!'

High level programming languages include:

Python, Java, C, etc.

A computer's "working memory" is its:

RAM

Which of the following is NOT a device to store data in a computer?

RAM

What is Syntax Errors?

Result from errors in code construction, such as mistyping a keyword, omitting a necessary colon, or using a wrong indentation. The program does not run. You have to fix this before rerunning the program.

What is Regression?

Returning to an earlier, usually lower or less desirable state

What is Syntax?

Rules that say what programs look like, and how the statements in the programming language are formed

What is Semantics?

Rules that say what the program means

If a string can not be converted, you get a:

Run-time error

What does sep= do?

Separates arguments without using a space

What is Operators?

Special tokens that represent computations like addition, multiplication, and division

What is Concantenate?

Stick together strings with a plus (+)

These are examples of textual data types

String

How many bytes are in a kilobyte?

1024

Of the options below, which equal one gigabyte?

1024 Megabytes (MB)

In the expression (17 * 9), the operant is:

17 and 9

Which of the following is an example of an integer?

4

What is a Expression?

A combination of values, variables, operators, and calls to functions

Programming Language

A formal constructed language designed to communicate instructions to a computer

What is User-defined functions?

Functions created and defined by the user

Who is the inventor of Boolean Algebra?

George Boole

Refers to the tangible part of a computer system

Hardware

What is Assembly Code?

Humanly readable way of writing machine code. EX: add EAX, 1 mov [ESP+4], EAX

When is Assembly code used?

In small devices where the size of code is important, in hardware specific code like device drivers, where performance is critical

What is Debugging?

The process of tracking down bugs and correcting them

Computer Programming

The process of translating an algorithm into instructions that a computer can understand

What is the structure of a Python Program?

def main (): Indentation and blocks main ();

You can use the math library by typing:

import math

Which of the following is a legal variable name?

studentname1


Related study sets

Chapter 2: Workforce Safety and Wellness

View Set

28. Examining the Cisco SD-Access Solution

View Set

Supply Chain Management Final Part 2

View Set

Blood Vessels and Circulation Chapter 19

View Set

Life Insurance Exam Practice Pt. 2

View Set