Intro to Computers and Programming

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of these is not a programming language? -C -C++ -HTML -Java

HTML

What must take place in a program before a variable is used?

Variable definitions must take place, which are used to define one or more variables that will be used in the program and to indicate the type of data they will hold. The variable definition causes the variables to be created in memory, so all variables must be defined before they can be used.

Explain what is stored in source file.

When a C++ program is written, it must be typed into the computer and saved to a file. A text editor is used for this task. The statements written by the programmer are called source code, and the file they are saved in is called the source file.

Explain what is stored in an object file.

When a preprocessed source code goes through a compiler, it's translating each source code instruction into the appropriate machine language instruction. Then, the compiler stores the translated machine language instructions, which are called object code, in an object file.

Explain the operations carried out by the compiler.

The compiler steps through a preprocessed source code, translating each source code instruction into the appropriate machine language instruction. This process will uncover any syntax errors that may be in the program. Syntax errors are illegal uses of key words, operators, punctuation, and other language elements. If the program is free of syntax errors, the compiler stores the translated machine language instructions, which are called object code, in an object file.

Explain what is stored in an executable file.

The executable file contains machine language instructions, or executable code, and is ready to run on the computer.

The purpose of testing a program with different combinations of data is to expose run-time and____ errors

logical

Compilers translate the instructions written by the programmer into

object code -translated machine language instructions

When a program is not running, it is stored -on a disk. -in level-2 cache (L2). -in main memory. -on the ethernet or wifi.

on a disk.

The ability of a language to let a programmer develop a program on computer system that can be run on other systems is called

portability

Division by zero when the program is executing is an example of a ____ error

runtime

The code that a programmer writes is called

source code The statements written by the programmer are called source code, and the file they are saved in is called the source file.

A compiler -maintains a collection of programs -tests a program's logic -translates source code into executable code -translates executable code to machine code

translates source code into executable code

A location in memory used for storing data and given a name in a computer program is called a ____ because the data in the location can be changed.

variable

RAM, random-access memory, is called that because -it is optimized for random number processing. -accesses are randomized to prevent clogging the control lines. -you can pick any two random locations and it will take the same time to access the data. -when power is turned off, its contents are lost and replaced by random bits. -none of the above.

you can pick any two random locations and it will take the same time to access the data.

What is the difference between a high-level language and a low-level language?

A low-level language means it resembles the numeric machine language of the computer more than the natural language of humans. The easiest languages for people to learn are high-level languages. They are called "high-level" because they are closer to the level of human-readability than computer-readability.

Describe the difference between a program line and a statement.

A program "line" is just a single line as it appears in the body of a program. Most of the lines contain something meaningful; however, some of the lines are empty. Blank lines are only there to make the program more readable. A statement is a complete instruction that causes the computer to perform some action. Statements can be a combination of key words, operators, and programmer defined symbols.

Explain the operations carried out by the linker.

A the linker combines an object file with the necessary library routines.

Why are variables called "variable"?

A variable is a named storage location in the computer's memory for holding a piece of information. The information stored in variables may change while the program is running (hence the name "variable").

Which of the following is not true? -An algorithm allows ambiguity. -An algorithm, when carried out, must eventually stop. -An algorithm, can be carried out by a human being.

An algorithm allows ambiguity.

What is an algorithm?

An algorithm is a set of steps to perform a task or solving a problem. These steps must be performed in their sequential order.

What is an integrated development environment?

Integrated development environments (IDEs) consist of a text editor, compiler, debugger, and other utilities integrated into a package with a single set of menus. Preprocessing, compiling, linking, and even executing a program is done with a single click of a button, or by selecting a single item from a menu.

What best defines a "programming language"? -It allows us to control a computer. -It allows us to make a calculation. -It allows to execute a program. -It allows us to express an algorithm.

It allows us to express an algorithm.

Describe the difference between a key word and a programmer-defined identifier.

Key Words have a special meaning and are used only for their intended purpose. Key words are also known as reserved words. They are reserved and cannot be used for anything other than their designated purposes. Part of learning a programming language is learning what the key words are, what they mean, and how to use them. Programmer-Defined Identifiers are names defined by a programmer. They are symbolic names that refer to variables or programming routines. They are not part of a programming language.

Which statement is NOT true: -Machine languages can be used to express algorithms. -Machine languages can be used to write programs that can run on any machine. -Machine language consists of zeros and ones. -Machine language is produced by compilers.

Machine languages can be used to write programs that can run on any machine.

What does portability mean?

The portability of a program means it can be written on one type of computer and then run on many other types of systems. This usually requires the program to be recompiled on each type of system, but the program itself may need little or no change.

Replace the underlines with the words in parentheses that follow: The ____ solves the ____ of a ____ by expressing an ____ in a ____ to make a ____ that can run on a ____. (algorithm, computer, problems, program, programmer, programming language, user )

The programmer solves the problems of a user by expressing an algorithm in a programming language to make a program that can run on a computer.

What are the three primary activities of a program?

The three primary activities of a program are input, processing, and output. Input is information a program collects from the outside world. It can be sent to the program from the user, who is entering data at the keyboard or using the mouse. It can also be read from disk files or hardware devices connected to the computer. Once information is gathered from the outside world, a program usually processes it in some manner. Output is information that a program sends to the outside world. It can be words or graphics displayed on a screen, a report sent to the printer, data stored in a file, or information sent to any device connected to the computer.

Explain the operations carried out by the preprocessor.

When a C++ program is written, it must be typed into the computer and saved to a file. A text editor is used for this task. The statements written by the programmer are called source code, and the file they are saved in is called the source file. Then, a program called the preprocessor reads the source code. The preprocessor searches for special lines that begin with the # symbol. These lines contain commands that cause the preprocessor to modify the source code in some way.

What happens to a variable's current contents when a new value is stored there?

When information is stored in a variable, it is stored in RAM. If new information is stored in a variable, its current value will be replaced with the new.

A byte in memory is identified by a unique number called its

address Each byte is assigned a unique number known as an address. The addresses are ordered from lowest to highest. A byte is identified by its address in much the same way a post office box is identified by an address.

An operating system -is the chief hardware unit in a computer. -is loaded into the computer each time it needs to carry out an operation. -ensures that programs will not run on the computer at the same time. -allocates resources like memory to programs that are running. -all of the above.

allocates resources like memory to programs that are running.

At each step of its operation, the input to a Central Processing Unit is -a program. -an instruction. -main memory. -a control unit.

an instruction.

An error in a program that involves a violation of language rules will be detected at ____ time.

compile

Application software -processes applications for jobs, school admission, etc. -is any software that is runs with the support of the operating system. -was invented by Microsoft. -is applied to the computer for the purpose of running the operating system. -none of the above.

is any software that is runs with the support of the operating system.

Describe the difference between operators and punctuation symbols.

Operators perform operations on one or more operands. An operand is usually a piece of data, like a number. pay = hours * rate; The * operator multiplies its two operands, which in this example are the variables hours and rate. The = symbol is called the assignment operator. It takes the value of the expression on the right and stores it in the variable whose name appears on the left. In this example, the = operator stores in the pay variable the result of the hours variable multiplied by the rate variable. Punctuation characters mark the beginning or ending of a statement, or separate items in a list. An example would be a semicolon in C++, which is similar to a period in English: It marks the end of a complete statement. Semicolons do not appear at the end of every line in a C++ program, however. There are rules that govern where semicolons are required and where they are not. Part of learning C++ is learning where to place semicolons and other punctuation symbols.

Why were computer programming languages invented?

Programming languages were invented as a way to program in a certain language like C ++, instead of just numbers or machine language. Programmers save their programs in text files, and then use special software to convert their programs to machine language.

Which of the following is true? -There is exactly one and only one statement on each line of code. -There can be more than one statement on a line, but a statement must not extend over more than one line. -Statements can extend over more than one line but there must not be more than one statement on a line. -There are no language rules regarding statements and line in general.

There are no language rules regarding statements and line in general.


Kaugnay na mga set ng pag-aaral

Trig values of special angles 30, 45, 60 degrees

View Set

health assessment practice quizzes

View Set

accounting exam 2: multiple choice prep

View Set