Visual C# - How to Program, Sixth Edition

Ace your homework & exams now with Quizwiz!

The ___________________ property specifies which image a PictureBox displays.

Image

Each parameter must specify both a(n) _____ and a(n) ______.

type name

____________________ begins a single line comment.

//

Instance variables of type int are given the value _______________ by default.

0 (Zero)

What is a default constructor? How are an object's instance variables initialized if a class has only a default constructor?

A constructor is a special method of a class that is used for initialization of the object at the time of creating the objects. The constructor is called right after the creation of the objects. Initialization usually means to provide initial values to the object's copy of variables. The Default Constructor is a constructor that does not get any argument. It is usually not defined explicitly. If there are no arguments provided at the time of object creation, the default constructor is invoked. The constructor provides default values to instance variables. In numeric types, that value is 0. Boolean types are set to false and all other types are set to Null.

What is a key advantage of interpreters over compilers? What is a key disadvantage?

A key advantage is that interpreters can execute high-level language programs directly(without the need for compilation). A key disadvantage is that interpreted programs execute more slowly than compiled programs

What is the difference between a local variable and an instance variable?

A local variable is declared and used within the body of the method it was declared in. Only one copy exists. An instance variable is declared within a class, but not in the body of any of the class's members. Every object (instance) of a class has a separate copy of the class's instance variables. Also, instance variables are accessible to all members of the class.

Keyword public is a(n) _________________ ____________________ .

Access Modifier

The properties in the Properties window can be sorted ______________ or __________________ .

Alphabetically, Categorically.

The three types of computer programming languages discussed in chapter 1 are machine languages, _____________ and ______________ ______________ languages.

Assembly and High Level

Calculations are normally performed by _______________ statements.

Assignment

The ____________ - _____________ feature hides a window in the IDE.

Auto - Hide

For a(n) ___________________ - ___________________ ________________________ , the compiler automatically generates a private instance variable and set/get accessors.

Auto - Implemented Property

Microsoft Windows ____________ is a cloud-computing platform that allows you to develop, manage and distribute your apps in the cloud.

Azure

_____________ _______________ , ______________ _______________ and _____________ ______________ are called whitespace. Newline characters are also considered whitespace.

Blank lines space characters tab characters

The format specifier ____________ is used to display values in a monetary format.

C

Describe the two-step translation process for preparing your C# code to execute on your particular computer.

C# code is first compiled into MSIL (Microsoft Intermediate Language) and placed in an executable file. When the app executes, another compiler called the JIT (Just-In-Time) compiler in the CLR (Common Language Runtime) translates the MSIL in the executable file into machine-language code (for a particular platform).

You send messages to an object. Each method is implemented as a method ____________ that tells a method of the object to perform its task.

Call

In object-oriented programming languages, we create a program unit called a(n) __________ to house the set of methods that perform its task.

Class

Objects, or more precisely the __________ that objects come from, are essentially reusable software components.

Classes

Explain the purpose of an instance variable.

Classes can be considered blueprints for real world entities. Any blueprint can be used to produce any number of copies, but all of them might not have the same values for their attributes. Thus, instance variables allow like constructs to exist, while holding individual values.

Methods ______________________ and ___________________________ display information in the console window.

Console.WriteLine Console.Write

Prompt the user to enter an integer.

Console.WriteLine("Enter an integer: ");

Why is using cloud-computing resources sometimes preferable to purchasing all the hard-ware you need for your own computer?

Cloud computing gives you the flexibility to increase or decrease computing resources to meet your resource needs at any given time, making it more cost effective than purchasing expensive hardware to ensure that you have enough storage and processing power at their occasional peak levels.

___________________ are used to document an app and improve its readability.

Comments

Expand the acronym: CLR

Common Language Runtime

The _____________ ______________ _______________ of the .Net Framework executes .NET programs.

Common Language Runtime

What did the chief benefit of the early Internet prove to be?

Communication by e-mail. Today, that communication is also facilitated by applications such as instant messaging and file transfer.

The programs that translate high-level language programs into machine language are called _____________________ .

Compilers

Translator programs called _____________ convert high-level language code into machine-language code.

Compilers

Computers process data under the control of sequences of instructions called ____________.

Computer Programs.

Display the message "Enter an integer:" leaving the cursor on the same line.

Console.Write("Enter an integer: ");

Input an integer and assign the result to int variable value.

Console.WriteLine("Enter an integer: "); int value = int.Parse(Console.Readline( ));

Display "This is a C# app" on two lines in the console window. The first line should end with c#. Use method Console.WriteLine.

Console.WriteLine("This is a C# \n app.");

Display "This is a C# app" on one line the console window.

Console.WriteLine("This is a C# app.");

Write a statement that uses string interpolation to display the sum of the variables x and y. Assume variables x and y of type int exist and already have values.

Console.WriteLine($"The sum of {x} and {y} is {x + y}");

Using ____________ - _____________ help ([F1] key) immediately displays a relevant help article.

Context-Sensitive

________________ - ______________ ____________ displays relevant help articles, based on the current context.

Context-Sensitive Help

Repeating a set of instructions a specific number of times is called _______________ iteration.

Counter Controlled (or Definite)

Data items processed by computers form a ________ ________ that becomes larger and more complex in structure as we progress from the simplest data items (called bits) to richer data items, such as characters, fields, and so on.

Data Hierarchy

Variables of type _______________ are typically used to represent monetary amounts.

Decimal

When an ellipsis button is clicked (...) , a(n) __________________ is displayed.

Dialog Box

Systems such as smartphones, appliances, game controllers, cable set-top boxes and automobiles that contain small computers are called ______________ ______________ .

Embedded Systems

Visual C# is ______________ driven. You'll write programs that respond to mouse clicks, key-strokes, timer expiration's, touches and finger swipes.

Event

True or False: Comments cause the computer to display the test after the // on the screen when the app executes.

False

True or False: C# considers variable number and NuMbEr to be identical.

False : C# is case sensitive

True or False: The information-carrying capacity of communications lines on the Internet has increased tremendously, while hardware costs have increased.

False : Hardware costs have decreased.

True or False: Secondary storage data takes much longer to access than data in primary memory, but the cost per unit of secondary storage is much higher than that of primary memory.

False : The cost of per unit of secondary storage is much lower than that of primary storage.

True or False: The Transmission Control Protocol (TCP) ensures that messages, consisting of sequentially numbered pieces called BYTES, are properly routed from sender to receiver, arrive intact and are assembled in the correct order.

False : The pieces are called packets, not bytes.

True or False: .NET programs can run on any platform.

False. .NET programs run on the Common Language Runtime, which is a virtual machine.

True or False: The Unicode character set is a popular subset of ASCII that represents uppercase and lowercase letters, digits and some common special characters.

False. ASCII is a subset of Unicode.

True or False: The smallest data item in a computer can assume the value 1 or the value 2. Such a data item is called a bit (short for "binary digit"—a digit that can assume either of two values).

False. Such items have the value 0 or 1.

True or False: C# is available only on Microsoft Windows.

False. There are ports of C# for other platforms, such as Linux.

True or False: The .NET Framework Class Library has millions of valuable pre-built classes that have been tested and tuned to maximize performance.

False. Thousands, not millions of pre-built classes.

True or False: A property declaration must contain both a get and a set accessor.

False: A property declaration can contain a get accessor, a set accessor, or both.

True or False: A property's get accessor enables a client to modify the value of the instance variable associated with the property.

False: A property's get accessor enables a client to RETRIEVE the value of the instance variable associated with the property. A property's set accessor enables a client to MODIFY the value of the instance variable associated with the property.

True or False:A set of statements contained within a pair of parenthesis is called a block.

False: A set of statements contained within a pair of braces ( { } ) is called a block.

True or False: A selection statement specifies that an action is to be repeated while some condition remains true.

False: An iteration statement specifies that an action is to be repeated while some condition remains true. A selection statement determines whether an action is performed based on the truth or falsity of a condition.

True or False: Control properties can be modified only by writing code.

False: Control properties can be modified using the Properties window

True or False: A valid C# arithmetic expression with no parentheses is evaluated from left to right.

False: Depending on the situation, evaluation can be done from left to right, or right to left.

True or False: Both forms and labels have a title bar.

False: Forms have a title bar but Labels do not (although they do have Label text)

True or False: Local variables are initialized by default.

False: Instance Variables are initialized by default. Local variables are not.

True or False: Instance variables of type bool given the value true by default.

False: Instance variables of type bool are given the value false by default.

True or False: Microsoft's ASP.WEB technology is used to create web apps.

False: It's ASP.NET technology.

True or False: By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.

False: Method names use the Pascal naming convention.

True or False: All instance variable are initialized by default to null.

False: Number simple - type instance variables are initialized to 0. Bool simple - type instance variables are initialized to false. Instance variables of all other types are initialized to Null.

True or False: Variables or methods declared with access modifier private are accessible only to members of the class in which they're declared.

False: Such variables are called Local Variables and can be used only in the method in which they're declared.

True or False: Java has become the key programming language for the Mac OS X desktop operating system and all iOS-based devices, such as iPods, iPhones, and iPads.

False: The language is SWIFT, not Java.

True or False: The arithmetic operators *, /, %, +, and - all have the same level of precedence.

False: The operators *, / and % are on the same level of precedence, and the operators + and - are on the same level of precedence.

True or False: The X icon toggles auto-hide for a Window.

False: The pin icon toggles auto hide. |X| closes a window

True or False: The remainder operator % can be used only with integer operands.

False: The remainder operator also can be used with noninteger operands in C#

True or False: The toolbar contains icons that present controls you can drag onto a form.

False: The toolbox contains icons that represent such controls.

True or False: The unary cast operator (double) creates a temporary integer copy of its operand.

False: The unary cast operator (double) creates a temporary floating-point copy of its operand.

True or False: Sizing handles are visible during execution.

False: They are available in the design window when the application is not running.

True or False: The Form, Label and PictureBox have identical properties.

False: They have some similar properties, but many unique properties.

True or False: C# operators are evaluated from left to right.

False: This order can change according to the precedence of operation or associativity of operations.

True or False: The following are invalid variable names: 3g, 87, 67h2, h22, and 2h.

False: Variables can start with an underscore or alphabet char. They cannot start with numbers.

True or False: Visual C# files use the file extension .csharp

False: Visual C# files use the file extension .cs

Just as characters are composed of bits, _________________ are composed of characters, or bytes.

Fields

How does the .NET Framework Class Library facilitate the development of .NET apps?

First, the Framework Class Library is a large library of reusable classes that reduces development time. Programmers can build software quickly by reusing framework's classes, rather than building new classes "from scratch." Second, the Framework Class Library is shared by all of the .NET languages, which means that programmers who work in multiple languages have to learn only one class library.

GUI is an acronym for _____________ _____________ _______________.

Graphical User Interface

A computer consists of various devices referred to as ____________ , such as the keyboard, screen, mouse, hard disks, memory, DVD drives and processing units.

Hardware

Tim Berners-Lee developed the ____________ for sharing information via "hyperlinked" text documents on the web.

HyperText Markup Language

Visual Studios is a(n) ______________ in which C# programs are developed.

IDE

The ability of a program to run without modification across multiple platforms is known as platform _________________ .

Independence

A new class of objects can be created conveniently by ______________ ; the new class absorbs the characteristics of an existing class, possibly customizing them and adding unique characteristics of its own.

Inheritance

Expand the acronym: IDE

Integrated Development Environment

What is the key capability of the web?

It allows computer users to locate and view multimedia-based documents on almost any subject over the Internet

What is the key accomplishment of the UML?

It replaced the many different graphical modeling languages with a single (unified)language for modeling that can be used by developers regardless of the different OOAD processes they may use.

_____________ are words reserved for use by C#.

Keywords

A _____________ ________________ begins the body of every method, and a(n) _____________ ________________ ends the body of every method.

Left Brace Right Brace

Computers can directly understand only their ____________ language, which is composed of 1s and 0s.

Machine

C# apps begin execution at method ________________.

Main

The CLR provides various services to _____________ code, such as integrating software components written in different .NET languages, error handling between such components, enhanced security, and more.

Managed

Explain the purpose of a method parameter. What is the difference between a parameter and an argument?

Method parameters act as variables inside the method. Arguments are the actual values which are passed in when the method is invoked. A parameter represents additional information that method requires to perform its task. Each parameter required by a method is specified in the method's declaration.

Expand the acronym: MSIL

Microsoft Intermediate Language

A ________________ processor implements several processors on a single "microchip" -- a dual core processor has two CPU's and a quad-core processor has four CPU's.

Multicore

Expand the acronym: OOP

Object-Oriented Programming

What are operating systems?

Operating systems are software systems that make using computers more convenient for users, app developers and system administrators. They provide services that allow each app to execute safely, efficiently and concurrently (i.e., in parallel) with other apps.

decimal method ___________________ converts a string to a decimal value.

Parse

Information on secondary storage devices is _______________ ; it's preserved even when the computer's power is turned off.

Persistent

Converting a program to run on a different platform from which it was originally intended is called ___________________ .

Porting

If the increment operator is _______ to a variable, first the variable is incremented by 1, then its new value is used in the expression.

Prefixed

What are the advantages to using object-oriented techniques?

Programs that use object-oriented programming techniques are easier to understand,correct and modify. The key advantage with using object-oriented programming is that it tends to produce software that is more understandable, because it is better organized and has fewer maintenance requirements than software produced with earlier methodologies. OOP helps the programmer build applications faster by reusing existing software components that model items in the real world. OOP also helps programmers create new software components that can be reused on future software development projects. Building software quickly, correctly, and economically has been an elusive goal in the software industry. The modular, object-oriented design and implementation approach has been found to increase productivity while reducing development time, errors, and cost.

Explain why a class might provide a property for an instance variable.

Properties allow access to be thoroughly controlled, allowing for more customization.

You can sell your own Windows phone apps in the __________ ___________ .

Windows Store

To create the best solutions you should follow a detailed analysis process for determining your projects _________________ (i.e., defining what the system is supposed to do) and developing a design that satisfies them (i.e., deciding how the system should do it.)

Requirements

By using exiting controls-which are objects-you can create powerful apps much faster than if you had to write all the code yourself. This is a key benefit of software ___________ .

Reuse

Use a building-block approach to creating your programs. Avoid reinventing the wheel- use existing pieces wherever possible. Such software ___________ is the key benefit of object-oriented programming.

Reuse

Most statements end with a ____________ .

Semicolon

When it's not known in advance how many times a set of statements will be repeated, a(n) _______ value can be used to terminate the repetition.

Sentinel, Signal, Flag or Dummy.

The _________________ structure is built into C# -- by default, statements execute in the order in which they appear.

Sequence

All apps can be written in terms of three types of control structures: _________________ , ______________________ and ________________________.

Sequence Selection Iteration.

The programs that run on a computer are referred to as ______________ .

Software

A ____________ is a group of one or more projects that collectively form a Visual C# app.

Solution

The ___________ ____________ window allows you to browse solution files.

Solution Explorer

A form's ______________ property specifies the text displayed in the form's title bar.

Text

The _____________ property specifies how text is aligned within a Label's boundaries.

TextAlign

Besides the obvious benefits of reuse made possible by OOP, what do many organizations report as another key benefit of OOP?

That OOP tends to produce software that is more understandable, better organized,and easier to maintain, modify and debug.

You are probably wearing on your wrist one of the world's most common types of objects—a watch. Discuss how each of the following terms and concepts applies to the notion of a watch: object, attributes and behaviors.

The entire watch is an object that is composed of many other objects (the moving parts, the band, the face, etc.) Watch attributes are time, color, band style, technology(digital or analog), and the like. The behaviors of the watch include setting the time and getting the time. A watch can be considered a specific type of clock (as can an alarm clock).

What are the key benefits of the .NET Framework and the CLR? What are the drawbacks?

The key benefits are portability between operating systems and interoperability be-tween languages. As long as a CLR exists for a platform, it can run any .NET pro-gram. Programmers can concentrate on program logic instead of platform-specific details. Thus, the double compilation (code-to-MSIL, and MSIL-to machine code)allows for platform independence: Programs can be written once and executed on any platform supporting the CLR—this is known as platform independence. Code written once could easily be used on another machine without modification, saving time and money. A second benefit of the .NET framework is language interoperability—software components written in different languages can interact (language independence). A drawback associated with these features is that .NET programs cannot be run until the .NET Framework is developed for a platform. Another is the overhead of the double compilation that is needed before a .NET-language program can be executed.

What is the purpose of the Operator new? Explain what happens when this keyword is used in an app.

The keyword new is used for creating new objects for the class. The class in C# is instantiated using the Operator new. When the operator is used in the application, it creates an object of the class and reserves space for that object in the memory heap.

What is the key advantage of using the new async feature in preference to using old-style multithreading

The new features simplify asynchronous programming, because the compiler hides much of the associated complexity from the developer.

A _______ -__________ appears when the mouse pointer hovers over an icon.

Tool Tip

Identify and Correct the errors in the following statement: if (c => 7) { Console.WriteLine("c is equal to or greater than 7") }

The relational operator => is incorrect. >= is the correct format.

Identify and Correct the errors in the following statement: if (c < 7); { Console.WriteLine("c is less than 7"); {

There should be no semicolon after the (c < 7) condition

The ________________ contains the controls that you can add to a form.

Toolbox

What is the key vision of Microsoft's .NET initiative?

To embrace the Internet and the web in the development and use of software.

PictureBoxs typically display images.

True

True or False : Software Objects model both abstract and real-world things.

True

True or False: A database is a collection of data that's organized for easy access and manipulation.

True

True or False: A form's background color is set using the BackColor property.

True

True or False: A nested control statement appears in the body of another control statement.

True

True or False: An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute.

True

True or False: An interpolated string must begin with a $ before the string literal.

True

True or False: An object has attributes that it carries along as it's used in a program.

True

True or False: C# provides the arithmetic compound assignment operators +=, -=, *= , /=, and %= for abbreviating assignment expressions.

True

True or False: Each of the following is a form of computer output: data displayed on screens, printed on paper, played as audio or video on PCs and media players, used to control other de-vices, such as robots, 3D printers and "intelligent" appliances.

True

True or False: High-level languages allow you to write instructions that look almost like everyday English and contain commonly used mathematical expressions.

True

True or False: If your machine is connected to the Internet, you can browse websites from the visual studio IDE.

True

True or False: Microsoft's Windows operating system is the most widely used desktop operating system worldwide.

True

True or False: One of the W3C's primary goals is to make the web universally accessible to everyone regardless of disabilities, language or culture

True

True or False: Pseudocode helps you think out an app before attempting to write it in a programming language.

True

True or False: Reuse helps you build more reliable and effective systems, because existing classes and components often have gone through extensive testing, debugging and performance tuning.

True

True or False: Specifying the order in which statements (actions) execute in an app is called program control.

True

True or False: The Universal Windows Platform (UWP) is designed to provide a common platform(the underlying system on which apps run) and user experience across all of your devices including personal computers, smartphones, tablets and Xbox Live.

True

True or False: The body of any method or property is delimited by left and right braces.

True

True or False: The following are all valid variable names: _under_bar_ , m928134, t5, j7, her_sales, his_account_total, a, b, c, z, and z2.

True

True or False: The most popular database model is the relational database in which data is stored in simple tables. A table includes records and fields.

True

True or False: The number of arguments in the method call must match the number of required parameters in the method declaration's parameter list.

True

True or False: The toolbar icons represent various menu commands.

True

True or False: Visual C# app developers usually create complex apps without writing any code.

True

True or False: You can add a control to a Form by double clicking its control icon in the Toolbox.

True

True or False: You can build web-based apps with C# and Microsoft's ASP.NET technology.

True

True or false? Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task.

True

C# requires all variables to have a(n)

Type

Although many different OOAD (object oriented analysis and design) processes exist, a single graphical language for communicating the results of any OOAD process has into wide use. This language, known as the _____________ , is now the most widely used graphical scheme for modeling object-oriented systems.

UML - Unified Modeling Language

Expand the acronym: UML

Unified Modeling Language

Windows 10 introduced the ________________ ______________ ________________ for building Windows apps that run on desktop computers, notebook computers, tablets, phones, Xbox and even Microsoft's new HoloLens augmented reality holographic headset -- all using nearly identical code.

Universal Windows Platform

A location in the computer's memory that may contain different values at various times throughout the execution of an app is called a _____________________ .

Variable

The CLR is a(n) __________ machine. It is software that manages the execution of programs and hides from them the underlying operating system and hardware.

Virtual

The technique of _____________ ___________ _____________ , allows you to create GUI's without writing any code.

Visual App Development

The _______________ menu contains commands for arranging and displaying windows.

WINDOW

Expand the acronym: W3C

World Wide Web Consortium

A key goal of Java is to be able to write programs that will run on a great variety of computer systems and computer-controlled devices. This is sometimes called _____________ ___________ , _____________ ______________ .

Write Once, Run Anywhere

Apply the product of variables b and c to variable a

a = b * c;

Every class declaration contains keyword ______________ followed immediately by the class's name.

class

The arithmetic operators with he same precedence as multiplication are ___________________ and __________________ .

division (/) and remainder (%)

The ____________ statement is used to make decisions.

if

If the variable number is not equal to 7, display, "the variable number is not equal to 7."

if (variable != 7) { Console.WriteLine("Variable does not equal 7."); }

The _______ ... _________ statement is used to execute one action when a conditional is true and another when that condition is false.

if else

A decision can be made in a C# app with a(n) ___________ - _____________ .

if-statement

When parentheses in an arithmetic expression are nested, the ____________ set of parentheses are evaluated first.

innermost /inside

When each object of a class maintains its own copy of an attribute, the attribute is also known as a(n) ______________ .

instance variable

Declare variables c, thisIsAVariable, q7654 and number to be of type int.

int c; int thisIsAVariable; int q7654; int number;

Arrange these byte measurements in order from smallest to largest: terabyte, megabyte, petabyte, gigabyte, and kilobyte.

kilobyte, megabyte, gigabyte, terabyte, petabyte

Operator _____ creates an object of the class specified to the right of the keyword.

new

_______________ ___________________ enables you to insert values directly into a string literal.

string interpolation

A return type of _________ signals that the method does not return a value.

void

Write four C# statements that each add 1 to int variable x.

x = x + 1; x +=1; ++x; x++;


Related study sets

ATI Video Case Studies Mixing Insulins

View Set

GOODQUESTIONS-Medical Surgical Nursing Chapter 12 Inflammation and Wound Healing

View Set

Medical Assistant Course 04/Medical Coding for the Career Professional

View Set

LUOA 9th Grade Girls Health and P.E. Module 6 Study Guide

View Set