Module 1-4 / Programing in C#

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed?int x = i / j;

0.5

If a decimal variable named total has a value of 1234.56, what string will result from the following statement? string s = total.ToString("c2") 1235 1,234.56 $1,234.56 1234.56

$1,234.56

To work with the files of a solution, you use a Visual Studio window called the Form Explorer Solution Designer Solution Explorer Form Designer

Solution Explorer

Which of the following statements results in a string that appears like this when displayed? c:\murach\files String s = @"c:\murach\files"; String s = "@c:\murach\files@"; String s = @c:\murach\files@; String s = "@c:\murach\files";

String s = @"c:\murach\files";

What property of a form sets the title that's displayed in the form's title bar? Text Heading Title Name

Text

Which property of a control sets the alignment for the text displayed on the control? Enabled TextAlign TextFormat TabStop

TextAlign

Which control do you use to allow a user to enter some text? ReadOnlyTextBox Button Label TextBox

TextBox

What is the purpose of the .NET class libraries? They manage the execution of .NET applications. They specify the data types that can be used by .NET applications. They specify the format of compiled .NET applications. They provide pre-written code that can be used by .NET applications.

They provide pre-written code that can be used by .NET applications.

Which of the following is not a recommended way to improve the readability of your C# code? Use blank lines before and after groups of related statements. Use spaces to separate words, values, and operators. Use all capital letters for variable names. Use indentation to align related elements of code.

Use all capital letters for variable names.

When an application encounters a problem that prevents a statement from being executed, a debugging error occurs a build error occurs a syntax error occurs a runtime error occurs

a runtime error occurs

A structure defines a value type a reference type a form an enumeration

a value type

An assembly is a an executable file that includes the MSIL or IL a container that holds projects the source file for a .NET application a secondary file required by an application, such as a graphic image or sound file

an executable file that includes the MSIL or IL

To assign a more precise numeric data type to a less precise numeric data type, you can code a widening conversion an implicit cast an assignment operator an explicit cast

an explicit cast

An object is an instance of a class the code that defines the characteristics of a class a grouping of related classes the code for a Windows form

an instance of a class

What is the name of the method generated if you double-click a button named btnProcess in the Form Designer? What is the term for a method that responds to events? btnProcess_DoubleClick btnProcess.Click btnProcess.DoubleClick btnProcess_Click

btnProcess_Click

What does the following code do? txtMonthlyInvestment.Focus(); calls the txtMonthlyInvestment method of the Focus() control calls the Focus() method of the current form calls the Focus() method of the txtMonthlyInvestment control calls the () method of the txtMonthlyInvestment.Focus control

calls the Focus() method of the txtMonthlyInvestment control

To run a Windows Forms project, select the project and press ENTER press CTRL-ALT click the Start button click the Continue button

click the Start button

An enumeration defines a set of related methods constants classes variables

constants

Access keys let the user activate a control by pressing Ctrl plus another key pressing Alt and Ctrl plus another key pressing Shift plus another key pressing Alt plus another key

pressing Alt plus another key

When you align or size a group of selected controls, the changes are made relative to the primary control top control bottom control alignment control

primary control

To change the name of all occurrences of a variable name after you change the first occurrence, you can use snippets previewing automatic renaming refactoring

refactoring

What event does Visual Studio generate code for when you double-click a button in the Form Designer? DoubleClick Enter Click Load

Click

Which of the following is a valid decimal literal? 30.0c 30.0 30.0d 30.0m

30.0m

Which of the following is not a platform that you can use to develop Windows desktop applications? Windows Forms WPF UWP ASP.NET Core MVC

ASP.NET Core MVC

What form property do you use to activate a button control when the user presses the Enter key? CancelButton property OKButton property AcceptButton property EnterButton property

AcceptButton property

Which of the following is a way to open the Code Editor window for a form? Find the form in the Solution Explorer and double-click on it. Find the form in the Solution Explorer and click on it. Find the form in the Solution Explorer, right-click on it, and select View Code. Find the form in the Solution Explorer, click on it, and select View -> Code.

Find the form in the Solution Explorer, right-click on it, and select View Code.

In Visual Studio, what command of the Tools menu can you use to change the development settings that affect the way the menus and toolbars work? Development Settings Menus and Toolbars Options Import and Export Settings

Import and Export Settings

What is the purpose of the Common Language Runtime? It provides pre-written code that can be used by .NET applications. It specifies the data types that can be used by .NET applications. It manages the execution of .NET applications. It specifies the format of compiled .NET applications.

It manages the execution of .NET applications.

Two properties that are common to both forms and controls are the Name and AcceptButton properties Name and Text properties Name and TabIndex properties TabIndex and AcceptButton properties

Name and Text properties

Which of the following is a not way to open an existing project in Visual Studio? Use the File -> Recent Files submenu. Use the File -> Open -> Project/Solution command. Use the links in the Start Window. Use the File -> Recent Projects and Solutions submenu.

Use the File -> Recent Files submenu.

To insert the starting code for an if statement into the code for a form, you can use a code snippet refactoring a data tip the Exception Helper

a code snippet

A solution is an executable file that contains MSIL or IL a container that holds projects the source file for a .NET application a secondary file required by an application, such as a graphic image or sound file

a container that holds projects

A characteristic of an object and its associated data is called a notice a property an event a method

a property

Given the following Random object named number, which of the following statements returns a double value that is greater than or equal to 0.0 and less than 1.0?Random number = new Random(); double d = number.Generate(); double d = number.NextDouble(); double d = number.NextDouble(1.0); double d = number.Generate(1.0);

double d = number.NextDouble();

What is the term for a method that responds to events? event handler event procedure event responder event wiring

event handler

To create an access key that will move the focus to a text box, you set the access key in the Text property of the text box set the access key in the Text property of the label immediately before the text box set the access key in the Text property of the label immediately after the text box set the AccessKey property of the text box

set the access key in the Text property of the label immediately before the text box

A constant stores data that is a reference type that does not need to be initialized that does not change as a program executes that changes as a program executes

that does not change as a program executes

Within Visual Studio, which window can you use to change the version of .NET that a project is targeting? the Project Properties window the Start window the Form Designer window the Solution Explorer window

the Project Properties window

When you run a Windows Forms project, you must first build it or it won't display. the project is built and then you are notified that it's ready to run. the project is first built and then run. you must first build it or it won't compile.

the project is first built and then run.

The Text property of a control determines the text that's displayed in the form the text that you use to refer to the control in your C# code the name of the control and the text that's displayed in it the text that's displayed in the control

the text that's displayed in the control

How could you rewrite the following sequence of statements as a single statement, assuming the temp1 variable is not required after these statements are executed? decimal temp1 = 1.0 - discountPct; total = total * temp1; total = total * (1.0 - discountPct); total = 1.0 - discountPct * total; total = 1.0 - (discountPct * total); total = total * 1.0 - discountPct;

total = total * (1.0 - discountPct);


Ensembles d'études connexes

Intro to Global Supply Chain - Second Half

View Set

NCLEX Substance Abuse and Domestic Violence Practice Questions

View Set

Chapters 13-18, 20 Multiple Choice

View Set

Part 2 Units 2-15(Most tested section) Questions

View Set