.NET Exam 1 Study Guide
To concatenate two or more strings into one, you use this character:
+
Which of the following is not a binary operator?
++
What does the following code do? txtMonthlyInvestment.Focus();
. calls the Focus method of the txtMonthlyInvestment control
What are the values of x and y after the following statements are executed? char x = 'A'; char y = ++x;
. x is 'B' and y is 'B'
Which of the following examples is a valid C# comment?
// This is a comment
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 because int can't have decimals
int i = 4; int j = 8; int k = 17; What is the value of x (not what it displays) after the following statement is executed? decimal x = i / j;
0.0
int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed? decimal x = (decimal)i / (decimal)j;
0.5
int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed? int x = k % j;
1 modulus tells you how many decimals that the solution will have
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;
12
decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; What is the value of x after the following statement is executed? decimal x = Math.Round(c)
13
int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed? int x = Math.pow(i, 2);
16
int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed? int x = j / i;
2
int i = 4; int j = 8; int k = 17; What is the value of x after the following statements are executed? int x = 27; x -= i;
23
Which of the following is a valid decimal literal? a. 30.0c b. 30.0m c. 30.0 d. 30.0d
30.0m
int i = 4; int j = 8; int k = 17; What is the value of x after the following statement is executed? int x = k / (j - i);
4 int only gives you values before the decimal
How many bits are in one byte?
8
How many bytes are stored in the C# long data type?
8
What is ASP.NET?
ASP.NET 5 is a significant redesign of ASP.NET. ASP.NET 5 is a new open-source and cross-platform framework for building modern cloud-based Web applications using .NET. You can develop and run your ASP.NET 5 applications cross-platform on Windows, Mac and Linux. With ASP.NET 5 we are making a number of architectural changes that make the core web framework much leaner and more modular. ASP.NET 5 is no longer based on System.Web.dll, but is instead based on a set of granular and well factored NuGet packages allowing you to optimize your app to have just what you need. ASP.NET 5 is built with the needs of modern Web applications in mind, and includes modern client-side frameworks and development workflows. ASP.NET 5 is also built to be cloud-ready and provides built-in dependency injection support. To appeal to a broader audience of developers, ASP.NET 5 supports cross-platform development on Windows, Mac and Linux. The entire ASP.NET 5 stack is open source and encourages community contributions and engagement. ASP.NET 5 comes with a new, agile project system in Visual Studio while also providing a complete command-line interface so that you can develop using the tools of your choice.
Which of the following statements is true?
Comments can be inaccurate or out of date.
The primary components of the .NET Framework are the .NET Framework Class Library and the
Common Language Runtime
The component of the .NET Framework that manages the execution of .NET programs is the
Common Language Runtime (CLR)
Assuming total is a decimal variable and totalString is a string variable, which of the following statements is valid code for converting totalString to total?
Decimal.TryParse(totalString, out total);
The protocol that's used by a web browser and a web server to communicate in a web application is
HTTP
What would you set the Text property of a label to if you want the label to appear as shown below, with the letter n as the access key?
I&nvoice number
Before a C# application can be run, it must be compiled into a language calleda
Microsoft Intermediate Language
To change the file name for a form, project, or solution you use the
Solution Explorer
To work with the files of a solution, you use a Visual Studio window called the
Solution Explorer
Which of the following statements is true?
The Label control doesn't have a TabStop property.
Consider the following statement. What directory does the page reside in?
The Secure subdirectory of the current directory
Session state is typically used for all but one of the following purposes. Which one is it?
To keep track of the last web page that was requested
What is the name of the Visual Studio window that contains controls that you can drag and drop?
Toolbox
Which of the following is not a recommended way to improve the readability of your C# code?
Use all capital letters for variable names.
A solution is
a container that holds projects
By default, ASP.NET sends the session ID to the browser in
a cookie
A reference type stores
a reference to an object
When a running application encounters a problem that prevents a statement from being executed,
a runtime error occurs
One common cause of a runtime error is
a user entry that can't be converted to a number
The only software component that's required to run a web application on a client is
a web browser
An assembly is
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
an explicit cast
An object is
an instance of a class
Instantiation is the process of generating
an object from a class
Which of the following statements results in a string that appears like this when displayed? a. String s = @c:\murach\files@; b. String s = @"c:\murach\files"; c. String s = "@c:\murach\files"; d. String s = "@c:\murach\files@";
b. String s = @"c:\murach\files";
Blocks of code are enclosed in
braces - { }
Variables named according to camel notation
capitalize the first letter of every word after the first word
Variables named according to Pascal notation
capitalize the first letter of every word including the first word
The .NET Framework Class Library consists of
classes that are organized into namespaces
A class is
code (blueprint or framework) that defines the characteristics of an object
The IntelliSense feature of Visual Studio can help you enter all but one of the following. Which one is it?
comments
An enumeration defines a set of related
constants
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")
d. $1,234.56
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?
d. total = total * (1.0 - discountPct);
Which built-in data type is the most precise type for storing monetary values?
decimal
Assuming that a variable named sales contains a string that represents a valid decimal number, which of the following statements is valid code for converting the sales string to a decimal value?
decimal d = Decimal.Parse(sales);
A data tip
displays the value of a variable or property
The ASP.NET Application Hosting model:
does not directly listen for requests, but instead relies on an HTTP server implementation to surface the request to the application
What is the term for a method that responds to events?
event handler
What is another name for a runtime error?
exception
When you test an application, your goal is to
find runtime errors
ASP.NET 5 uses a new configuration model:
for handling of simple name-value pairs that is not based on System.Configuration or web.config. This new configuration model pulls from an ordered set of configuration providers. The built-in configuration providers support a variety of file formats (XML, JSON, INI) and also environment variables to enable environment-based configuration.
ASP.NET 5 includes server support:
for running on IIS or self-hosting in your own process. You can also host your application on a non-Windows environment using the cross-platform Kestrel web server.
To select two or more controls, you can
hold down either the Shift or Ctrl key while you click on them
Which built-in data type stores only whole numbers?
int
Which of the following data types can't be used for storing the number 123.4567? a. double b. int c. decimal d. single
int
Indicate the correct initialization of the follow variables 'a' and 'b':
int a = 12; int b = 20;
Every ASP.NET 5 project:
is a DNX project.
If you use standard rounding with the Round method of the Math class, a positive number that ends in 5
is always rounded up to the next number
Client-side development:
is designed to integrate seamlessly with a variety of client-side frameworks, including AngularJS, KnockoutJS and Bootstrap.
Unlike a static web page, a dynamic web page
is generated by a program running on an application server
The Web root of your application:
is the root location in your project from which HTTP requests are handled (ex. handling of static file requests). The Web root of an ASP.NET 5 application is configured using the "webroot" property in your project.json file.
What is the purpose of the Common Language Runtime?
it manages the execution of .NET applications
What is the purpose of the .NET Framework Class Library?
it provides pre-written code that can be used by .NET applications
Which part of the following URL identifies the server that's hosting the web site?
localhost
Which of the following is not defined by a class?
notices
To refer to a property of an object in your C# code, you code the
object name followed by a period and the property name
If you declare a variable within a method, the variable will be available
only within that method
To override the order of precedence in an arithmetic expression, you can use
parentheses
You can get context-sensitive help information from the Code Editor by
positioning the insertion point in a keyword and pressing F1
Access keys let the user activate a control by
pressing Alt plus another key
The main purpose of the .NET Framework Class Library is to
provide the classes that are used for developing .NET applications
Select the following data types in order of increasing size
sbyte < short < int < long
C# statements must end with a
semicolon - ;
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 label immediately before the text box
Assuming total is a decimal variable, which of the following statements does not convert it to a string?
string s = String.Parse(total);
A constant stores data
that does not change as a program executes
A service is a component:
that is intended for common consumption in an application. Services are made available through dependency injection. Middleware
A syntax error is identified in
the Code Editor window and the Error List window
The tab order determines the order in which
the controls on a form receive focus when the user presses the Tab key
ASP.NET 5 applications are built and run using:
the new .NET Execution Environment (DNX).
The Text property of a control determines
the text that's displayed in the control
To code a selector for an HTML element with an id attribute, you code
the value of the id attribute preceded by a pound sign (#)
Why won't the following statement compile?
the value shouldn't be followed by a letter
ASP.NET 5 integrates with DNX:
through the ASP.NET Application Hosting package.
In an Internet development environment, you use an FTP server to
transfer files between the client computer and the web server
The bool data type stores a
true or false value
A Windows Forms application runs
under the Windows operating system
To say that a C# application is event-driven means that it responds to
user events and other types of events
In ASP.NET 5 you compose your request pipeline: middleware
using middleware
ASP.NET 5 applications are defined:
usnig a public startup class