INFO 2010 C++

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

In what order would the following operators be evaluated? - , * , / , + , % Assume that if two operations have the same precedence, the one listed first will be evaluated first. +, -, /, *, % *, /, %, -, + -, +, %, *, / -, *, %, +, /

* , / , % , - , +

A header file is typically given the filename extension: .h .cpp .hdr .header

.h

A default constructor has how many parameters? 0 1 2 Variable number

0

What is the value of result after the following C++ statements execute? int a{4}; int b{12}; int c{37}; int d{51}; int result{d % a * c + a % b + a}; 51 119 59 127

119

The assignment operator ________ assigns the value of the expression on its right to the variable on its left. = <- -> #

=

Which of the following is not an arithmetic operator? + = % -

=

Each of the following is a relational or equality operator except: <= > == =!

=!

Which statement is false? Classes are reusable software components. A class is to an object as a blueprint is to a house. A class is an instance of its object. Performing a task in a program requires a method.

A class is an instance of its object.

Which of the following statements is false? A constructor that specifies a single parameter should be declared implicit. A constructor does not specify a return type, because constructors cannot return values. Constructors cannot be declared const (because initializing an object modifies it). None of these statements is false.

A constructor that specifies a single parameter should be declared implicit .

Which of the following statements is true? The compiler knows about fundamental types that are "built into" C++. A new type that you create is known as a user-defined type. New classes, when packaged properly, can be reused by other programmers. All of these are true.

All of these are true.

Which of the following is a compilation error? Neglecting to declare a local variable in a function before it is used. Using a triple equals sign instead of a double equals sign in the condition of an if statement. Omitting the left and right parentheses for the condition of an if statement. All of these.

All of these.

Today , virtually all new major operating systems are written in: C or C++. Visual C#. Ada. Objective-C

C or C++.

The ________ creates object code and stores it on disk. Loader Preprocessor Interpreter Compiler

Compiler

Which of the following statements are true? Interpreted programs run faster than compiled programs. Compilers translate high-level language programs into machine language programs. Interpreter programs typically use machine language as input None of these.

Compilers translate high-level language programs into machine language programs.

Which of the following statements is false? Each object of a class shares one copy of the class's data members. Headers should never contain using directives or using declarations. An object's data members exist before a program calls member functions on an object, while they are executing and after the member functions complete execution. Data members are declared inside a class definition but outside its member functions' bodies.

Each object of a class shares one copy of the class's data members.

Which of the following statements is false? Speaking to your computer is a form of input. Playing a video is an example of output. A multi-core processor implements several processors on a single integrated- circuit chip. Information in the memory unit is persistent-- it is retained when the computer's power is turned off.

Information in the memory unit is persistent-- it is retained when the computer's power is turned off.

Which of the statements a) , b) and c) about C++14 is false? It added several language features. It added several C++ Standard Library Enhancements. It added several bugs from C++11. None of these statements is false.

It added several bugs from C++11.

_______ models software in terms similar to those that people use to describe real -world objects. Object-oriented programming Object-oriented design Procedural programming None of these

Object-oriented design

Which of the following is not one of the six logical units of a computer? Printer. Input unit. Output unit. Central processing unit.

Printer.

______ is a graphical language that allows people who design software systems to use an industry standard notation to represent them. The Unified Graphical Language The Unified Design Language The Unified Modeling Language None of these

The Unified Modeling Language

The compiler will implicitly create a default constructor if: The class already defines a default constructor. The programmer specifically requests that the compiler do so. The class does not contain any data members. The class does not define any constructors.

The class does not define any constructors.

The linker links: The primary memory with the CPU. The source code with the object code. The executable code with primary memory. The object code with libraries.

The object code with libraries.

End-of-line comments that should be ignored by the compiler are denoted using: A slash and a star (/*). Three forward slashes (///). A slash and two stars (/**). Two forward slashes (//).

Two forward slashes ( //).

Which of the following statements is false? A function's parameters also are local variables of that function. Variables declared in a particular function's body are local variables, which can be used only in that function. When a function terminates, the values of its local variables are preserved. The argument types in the member function call must be consistent with the types of the corresponding parameters in the member function's definition.

When a function terminates, the values of its local variables are preserved.

The escape sequence for a newline is: \n \r \t \a

\n

A member-function call can supply ________ that help the function perform its task. classes arguments frameworks parameters

arguments

A member function that does not, and should not, modify the object on which it's called is declared with ________ to the right of its parameter list. immutable const firm total

const

To call a member function for a specific object, you specify the object's name, followed by a(n) ________, then the member function name and a set of parentheses. colon dot operator :: ->

dot operator

A main function can "drive" an object by calling its member functions—without knowing how the class is implemented. In this sense, main is referred to as a(n) ________ program. controller operator manipulator driver

driver

C++ is a(n) ________ programming language because you can define new class types as needed. strongly typed extensible inextensible None of these

extensible

Which of the following statements does not overwrite a preexisting value stored in a memory location? y = y + 2; number = 12; width = length; int a;

int a;

Which of the following uses C++11's list initialization to initialize count to 0? int count[0]; int count = 0; int count{0}; int count(0);

int count{0};

Which of the following is a variable declaration statement? // first string entered by user #include <iostream> int main() int total;

int total;

C++ Standard Library function getline, from the <string> header, reads characters up to, but not including, a(n)________ (which is discarded), then places the characters in a string. period \ tab newline

newline

Typically, you cannot call a member function of a class until you create a(n) ________ of that class. header object image constructor

object

The ________ statement passes a value back to a function's caller. recover pass return restore

return

Files ending in .cpp are known as ________ files. executable source-code secure C++ class

source-code

The _____ object enables a program to read data from the user. std::cread std::cget std::cout std::cin

std::cin

Which of the following statements could potentially change the value of number2? std::cout << number2; std::cin >> number2; sum = number1 + number2; number1=number2'

std::cin >> number2;

The default value for a string is: blanks null the empty string void

the empty string

Each class you create becomes a new ________ you can use to declare variables and create objects. access modifier type variable object

type

The return type ________ indicates that when a function completes its task, it does not return (i.e., give back) any information to its calling function. nullptr void null virtual

void


Kaugnay na mga set ng pag-aaral

Unit 1: The Living World - Ecosystems

View Set

BLOCKCHAIN: Chapter 1a - Introduction P. 7 - 11

View Set

Principles of Economics Pearson Reading Quiz Ch. 8

View Set

Athletic Training Knee and Thigh Injury Assessment

View Set

W03 Study: Chapter 02 Smart Book Part 1

View Set

CCNA Routing and Switching Essentials Chapter 2

View Set

Ch 9: Material Requirements Planning

View Set