Computer Programming 2 First Test

¡Supera tus tareas y exámenes ahora con Quizwiz!

postfix increment operator

(++ after a variable) evaluates a vari- able and then adds 1 to it.

prefix increment operator

(++ before a variable) increases the variable's value by 1 and then evaluates it.

named constant

(often called simply a constant) is an identifier whose value must be assigned upon declaration and whose contents cannot change.

decrement operator

(− −) reduces a variable's value by 1. ere is a prefix and a postfix version.

floating-point

A value's number of significant digits specifies the mathematical accuracy of the value.

Which of the following statements is true?

An identifier can contain digits

Associativity

Associativity specifies the order in which a sequence of operations with the same precedence are evaluated.

If a programmer inserts using System; at the top of a C# pro- gram, which of the following can the programmer use as an alternative to System.Console.WriteLine("Hello");?

Console.WriteLine("Hello");

Which of the following is a method?

Main()

order of operation.

Operator precedence

Which of the following is a class?

System

Which of the following is true of variable declarations?

Two variables of the same type can be declared in the same statement

The C# method that produces a line of output on the screen and then positions the cursor on the next line is .

WriteLine()

class

a category of objects or a type of object.

Debugging

a program is the process of removing all syntax and logical errors from the program.

syntax

a set of rules

comment out

a statement is to make a statement nonexecuting

assignment

a statement that provides a variable with a value.

format string

a string of characters that contains one or more placeholders for variable values

Console.ReadLine() method

accepts user input from the keyboard.

add and assign operator

adds the operand on the right to the operand on the left and assigns the result to the operand on the left in one step.

high-level programming language

allows you to use a vocabulary of keywords instead of the sequence of on/off switches that perform these tasks.

Lexically

alphabetically

properties

an object are its values

Methods

are compartmentalized, named program units that contain instructions that accomplish tasks.

behaviors of an object

are its methods

Program comments

are nonexecuting statements that you add to document a program

Unary operators

are operators used with one operand.

Keywords

are predefined and reserved identifiers that have special meaning to the compiler.

Graphical user interfaces, or GUIs

are program elements that allow users to interact with a program in a graphical environment.

Computer simulations

are programs that attempt to mimic real-world activities to foster a better understanding of them

Standard numeric format strings

are strings of characters expressed within double quotation marks that indicate a format for output.

Semantic errors

are the type of logical errors that occur when you use a correct word in the wrong context, generating incorrect results.

Operands

are the values that operators use in expressions.

Integral data types

are those that store whole numbers.

Integers

are whole numbers.

A variable declaration must contain all of the following except a(n) .

assigned value

logic

behind any program involves executing the various statements and methods in the correct order to produce the desired results.

A comment in the form /* this is a comment */ is a(n) .

block comment

Of the following languages, which is least similar to C#?

c++

Substring() method

can be used to extract a portion of a string from a starting point for a specific length.

Boolean variable

can hold only one of two values—true or false

Which of the following pairs is an example of a class and an object, in that order?

chair and desk

comparison operator

compares two items; an expression contain- ing a comparison operator has a Boolean value.

A program that translates high-level programs into interme- diate or machine code is a(n) .

compiler

just in time (JIT

compiler translates intermediate code into executable code.

Hardware

comprises all the physical devices associated with a computer.

Application classes

contain a Main() method and are executable programs.

Length property

contains a string's length.

double

data type can hold a floating-point number with 15 or 16 significant digits of accuracy.

float

data type can hold a floating-point number with as many as seven significant digits of accuracy.

char

data type can hold any single character.

bool

data type holds a Boolean value.

decimal

data type is a floating-point type that has a greater pre- cision and a smaller range than a float or double, which makes it suitable for financial and monetary calculations.

string

data type is used to hold a series of characters.

using clause or using directive

declares a namespace.

access modifier

defines the circumstances under which a method or class can be accessed; public access is the most liberal type of access.

Constant

describes data items whose values are fixed; constants can be unnamed literals or named.

Runnable

describes files that are executable

data type

describes the format and size of a data item and defines what types of operations can be performed with the item.

System software

describes the programs that operate the computer.

The String class Equals() method

determines if two strings have the same value; it requires two string arguments that you place within its parentheses, separated by a comma.

Operator precedence

determines the order in which parts of a math- ematical expression are evaluated.

Write() method

displays a line of output on the screen, but the cursor does not advance to a new line; it remains on the same line as the output.

WriteLine() method

displays a line of output on the screen, positions the cursor on the next line, and waits for additional output.

Non-application classes

do not contain a Main() method; they provide support for other classes.

The technique of packaging an object's attributes into a cohesive unit that can be used as an undivided entity is .

encapsulation

Every method in C# contains a

header and body

format specifier

in a format string can be one of nine built-in format characters that define the most commonly used numeric format types.

placeholder

in a format string consists of a pair of curly braces containing a number that indicates the desired variable's position in a list that follows the string.

precision specifier

in a format string controls the number of significant digits or zeros to the right of the decimal point.

method header

includes the method name and information about what will pass into and be returned from a method.

static

indicates that a method will be executed through a class and not by an object.

void

indicates that the method does not return any value when called.

Unicode

is a 16-bit coding scheme for characters

compiler

is a computer program that translates high-level language statements into machine code.

object

is a concrete entity that has attributes and behaviors; an object is an instance of a class.

namespace

is a construct that acts like a container to provide a way to group similar classes.

A black box

is a device you use without regard for the internal mechanisms.

Type precedence

is a hierarchy of data types used to determine the unifying type in arithmetic expressions containing dissimilar data types.

Hexadecimal, or base 16

is a mathematical system that uses 16 symbols to represent numbers.

Scientific notation

is a means of expressing very large and small numbers using an exponent.

variable

is a named location in computer memory that can hold different values at different points in time.

Integrated Development Environment (IDE)

is a program development environment that allows you to select options from menus or by clicking buttons. An IDE provides such helpful features as color coding and automatic statement completion.

Object-oriented programming (OOP)

is a programming technique that features objects, classes, encapsulation, interfaces, polymor- phism, and inheritance.

command prompt

is a request for input that appears at the beginning of the command line.

enumeration

is a set of constants represented by identifiers.

program

is a set of instructions that tell a computer what to do.

culture

is a set of rules that determines how culturally dependent values such as money and dates are formatted.

Camel casing

is a style of creating identifiers in which the first letter is not capitalized, but the first letter of each new word is.

Pascal casing

is a style of creating identifiers in which the first letter of all new words in a name, even the first one, is capitalized.

literal constant

is a value that is taken literally at each use.

private

is an access modifier that indicates other classes may not use the method directly.

public

is an access modifier that indicates other classes may use the method.

initialization

is an assignment made when a variable is declared.

syntax error

is an error that occurs when a programming language is used incorrectly.

verbatim identifier

is an identifier with an @ prefix.

prompt

is an instruction to the user to enter data.

instance of a class

is an object.

alias

is another name for something.

Whitespace

is any combination of spaces, tabs, and carriage returns (blank lines). You use whitespace to organize your program code and make it easier to read.

software

is computer programs

procedural program

is created by writing a series of steps or operations to manipulate values.

simple type

is one of the following in C#: byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, char, and bool.

interactive program

is one that allows user input.

Polymorphism

is the ability to create methods that act appropriately depending on the context.

Inheritance

is the ability to extend a class so as to create a more specific class that contains all the attributes and methods of a more general class; the extended class usually contains new attributes or methods as well.

implicit conversion or implicit cast

is the automatic transfor- mation that occurs when a value is assigned to a type with higher precedence.

state of an object

is the collective value of all its attributes at any point in time.

assignment operator

is the equal sign (=); any value to the right of the assignment operator is assigned to, or taken on by, the variable to the left.

interface

is the interaction between a method and an object.

command line

is the line on which you type a command in a system that uses a text interface.

Machine language

is the most basic circuitry-level language.

identifier

is the name of a program component such as a variable, class, or method.

Application software

is the programs that allow users to complete tasks.

variable declaration

is the statement that names a variable; it includes the data type that the variable will store, an identifier that is the variable's name, an optional assignment operator and assigned value when you want a variable to contain an initial value, and an ending semicolon.

Source code

is the statements you write when you create a program.

Encapsulation

is the technique of packaging an object's attributes and methods into a cohesive unit that can be used as an undivided entity.

unifying type

is the type chosen for an arithmetic result when oper- ands are of dissimilar types.

escape sequence

is two symbols beginning with a backslash that represent a nonprinting character such as a tab.

StartsWith() method

is used with a string and a dot, and its parentheses contain another string. It returns true if the first string starts with the characters contained in the second string.

A series of characters that appears within double quotation marks is a(n) .

literalstring

A computer program written as a series of on and off switches is written in .

machine language

Implicitly

means automatically

Variables are .

named memory locations

In C#, a container that groups similar classes is a(n) .

namespace

Programs in which you create and use objects that have attri- butes similar to their real-world counterparts are known as programs.

object oriented

literal string

of characters is a series of characters enclosed in double quotes that is used exactly as entered.

Intrinsic types

of data are basic types; C# provides 15 intrinsic types

method body

of every method is contained within a pair of curly braces ({ }) and includes all the instructions executed by the method.

immutable

or unchangeable. at is, a string's value is not actually modified when you assign a new value to it; instead, the string refers to a new memory location.

Which of the following identifiers is not legal in C#

per cent increase

self-documenting

program element is one that is self-explanatory.

explicit cast

purposefully assigns a value to a different data type; it involves placing the desired result type in parentheses followed by the variable or constant to be cast.

attributes of an object

represent its characteristics.

Compare() method

requires two string arguments. When it returns 0, the two strings are equivalent; when it returns a posi- tive number, the first string is greater than the second; and when it returns a negative value, the first string is less than the second.

The text of a program you write is called .

source code

Block comments

start with a forward slash and an asterisk (/*) and end with an asterisk and a forward slash (*/). Block comments can appear on a line by themselves, on a line before executable code, or after executable code. ey can also extend across as many lines as needed.

Line comments

start with two forward slashes (//) and continue to the end of the current line. Line comments can appear on a line by themselves, or at the end of a line following executable code.

concatenate

strings is to join them together in a chain.

Programming errors such as using incorrect punctuation or misspelling words are collectively known as errors.

syntax

The grammar and spelling rules of a programming language constitute its .

syntax

The nine integral types are byte, sbyte, short, ushort, int, uint, long, ulong, and char.

the first eight always represent whole num- bers, and the ninth type, char, is used for characters like 'A' or 'a'.

Intermediate language (IL)

the language into which source code statements are compiled.

argument

to a method represents information that a method needs to perform its task. An argument is the expression used between parentheses when you call a method

object-oriented approach

to a problem means defining the objects needed to accomplish a task and developing classes that describe the objects so that each maintains its own data and carries out tasks when another object requests them.

XML-documentation format comments

use a special set of tags within angle brackets to create documentation within a program

Binary operators

use two arguments—one value to the left of the operator and another value to the right of it.

CompareTo() method

uses a string, a dot, and the method name. When it returns 0, the two strings are equivalent; when it returns a positive number, the first string is greater than the second; and when it returns a negative value, the first string is less than the second.

C# programming language

was developed as an object-oriented and component-oriented language. It exists as part of Visual Studio 2010, a package used for developing applications for the Windows family of operating systems.

System namespace

which is built into your C# compiler, holds commonly used classes.


Conjuntos de estudio relacionados

CSET SUBTEST 1 HISTORY ENGLISH SUPER SET

View Set

PRACTICE TEST QUESTIONS TO MEMORIZE: EXAM 1

View Set

Unit 5 PFRQ's—Executive branch

View Set

Macroeconomics: Section 6 review

View Set

Four Types of Productive Resources

View Set

hrm str & planning chapters 13,15 and 17

View Set