COSC 1436

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

All of the following examples of code work. However, which of the following code has the best programming style? #include <iostream> using namespace std; int main() { cout << "Welcome to C++" << endl; return 0; } #include <iostream> using namespace std; int main() { cout << "Welcome to C++" << endl; return 0; } #include <iostream> using namespace std; int main() { cout << "Welcome to C++" << endl; return 0; } #include <iostream> using namespace std; int main() { cout << "Welcome to C++" << endl; return 0; }

#include <iostream> using namespace std; int main() { cout << "Welcome to C++" << endl; return 0; }

What is the output of the following two lines of code: cout << "0 + 1 + 2 = " << endl; cout << 0 + 1 + 2 << endl; 0 + 1 + 2 = 3 0 + 1 + 2 = 0 + 1 + 2 0 + 1 + 2 = 3 3 3

0 + 1 + 2 = 3

What is the output of the following two lines of code: cout << "0 + 1 + 2 = "; cout << 0 + 1 + 2 << endl; 0 + 1 + 2 = 0 + 1 + 2 0 + 1 + 2 = 3 3 3 3

0 + 1 + 2 = 3

Match the term on the left with its best definition on the right. compiler source code interpreter machine code operating system Windows C++ C (not C++)

A(n) _____ translates the entire source code into a machine-code file, and the machine-code file is then executed. A program written in a high-level language is ______. A(n) ______ reads one statement from the source code, translates it to the machine code, and then executes it, then gets another line of code and repeats the process. What language does the CPU understand/ The most important program that runs on a computer. It manages and controls a computer's activities. An example of an operating system. An example of a high-level language. An example of a programming language that is NOT object oriented.

What is the output of the following code? #include <iostream> using namespace std; int main() { cout << "A"; cout << "B"; return 0; } BA AB AB A B

AB

(T or F) Software is the physical aspect of the computer that can be seen such as the CPU, Memory, Storage Devices, Input/Output Devices, and Communication Devices. True False

False

The speed of the CPU may be measured in __________. Gigabytes bits Megabytes Gigahertz (GHz)

Gigahertz (GHz)

Match the term on the left with its definition on the right. Keyboard Printer Touch screen

Input device (sends data to the computer) Output device (receives data from the computer) Both an input and output device

A computer's native language, which differs among different types of computers, is its _______ Links to an external site.—a set of built-in primitive instructions, such as 01010111. C++ CPU machine language assembly language

Machine language

A program and its data must be moved into the computer's _______ before they can be executed by the CPU. USB window memory Hard disk

Memory

What is wrong with the following code: #include <iostream> using namespace std; int main() { cout << "This is a line of code" << endl; cout << "The answer to 2 + 2 = "; cout << 2 + 2 << endl; return 0; } The first line needs a semi-colon. The << should be <. Nothing is wrong. There are too many semi-colons.

Nothing is wrong

Fill in the phrase on the right with the correct item from the left side. byte bit ASCII gigabyte kilobyte

One _____ has 8 bits. A _____ is a binary digit 0 or 1 An encoding scheme is a set of rules that govern how a computer translates characters and numbers into data. In the popular ______encoding scheme, for example, the character C is represented as 01000011 in one byte. A _____ is approximately 1 billion bytes. A _____ is approximately 1000 bytes.

Complete the program development process steps in order. The [ Select ] ["linker", "compiler", "preprocessor"] modifies the source code to create a larger, modified source code file. The [ Select ] ["preprocessor", "linker", "compiler"] converts the source code to machine code. The [ Select ] ["linker", "preprocessor", "compiler"] creates an executable file that you run from the machine code.

Preprocessor Compiler Linker

The ____________ specifies the number of pixels in horizontal and vertical dimensions of the display device. memory dot pitcch screen resolution USB

Screen resolution

___________ provides the invisible instructions that control the hardware and make it perform specific tasks. Keyboards Hardware Storage devices Software

Software

The compiler checks _______. run-time errors syntax errors logical errors

Syntax errors

Match the item on the left with the correct description on the right. .cpp # Netbeans or Eclipse {}

The extension added to the name of your C++ source file The beginning of a preprocessor directive An example of an IDE Encloses a block of statements

Match the term on the left with its definition on the right. Hardware Software CPU Memory Storage Device

The physical aspect of the computer that can be touched. The invisible instructions that control the hardware and make it perform tasks. The computer's brain. It retrieves instructions from memory and executes them. Stores data and program instructions for the CPU to execute. It is volatile, because information is lost when the power is turned off. Stores programs and data permanently.

C++ was developed by Bjarne Stroustrup at Bell Labs during 1983-1985 True False

True

Every statement in C++ must end with a semicolon (;), known as the statement terminator (though pre-processor statements are not C++ statements so they do not end in a semicolon). True False

True

Memory is volatile, because information is lost when the power is turned off. Programs and data are permanently stored on storage devices and are moved, when the computer actually uses them, to memory, which is much faster than storage devices. True False

True

The higher the resolution, the sharper and clearer the image is. True False

True

A computer's components are interconnected by a subsystem called a __________. bus keyboard USB storage device

bus

Which of the following statements is correct to display "Programming is fun" on the console? cout < "Programming is fun"; cout << "Programming is fun"; cout << "Programming is fun" cout << Programming is fun;

cout << "Programming is fun";

Match the sample code on the left with its description on the right. #include <iostream> using namespace std; return 0; //hello /* hello */ int <<

preprocessor directive A mechanism to avoid naming conflicts in a large program Placed at the end of the program to indicate a successful exit A line comment A block comment An example of a keyword stream insertion operator used with cout


Set pelajaran terkait

Intracranial Regulation Questions Theory Exam 3

View Set

ServSafe(Foodborne microorganisms & Allergens)

View Set

Qualitative Research (Combo) May 2016 (ALL)

View Set

Chapter 7- Taxation of Personal Life Insurance

View Set

Chapter 7: The Outer Planets & Their Moons (Lecture Notes)

View Set