98-361 : Software Development Fundamentals : Part 08
-
You are designing a class for an application. You need to restrict the availability of the member variable accessCount to the base class and to any classes that are derived from the base class.
Which access modifier should you use?
- Protected
- Private
- Public
- Friend
-
You create an object of type ANumber. The class is defined as follows.
The code is executed as follows.
Dim mynumber As ANumber = new ANumber(3);
What is the value of _number after the code is executed?
- Null
- 0
- 3
- 7
-
You are creating an application that presents users with a graphical interface in which they computers that do not have network connectivity.
Which type of application should you choose?
- ClickOnce
- Windows Service
- Windows Forms
- Console-based
Explanation:Use Windows Forms when a GUI is needed.
-
You have a class named Truck that inherits from a base class named Vehicle. The Vehicle class includes a protected method named brake ().
How should you call the Truck Class implementation of the brake () method?
- Mybase.brake ()
- Truck.brakef)
- Vehicle.brake()
- Me.brake ()
Explanation:The MyBase keyword behaves like an object variable referring to the base class of the current instance of a class.MyBase is commonly used to access base class members that are overridden or shadowed in a derived class.
-
Which type of function can a derived class override?
- A Protected Overridable member function
- A Shared function
- A Private Overridable function
- A non-overridable public member function
Explanation:The Overridable modifier allows a property or method in a class to be overridden in a derived class.
You cannot specify Overridable or NotOverridable for a Private method. -
Class C and Class D inherit from Class B. Class B inherits from Class A. The classes have the methods shown in the following table.
All methods have a protected scope.
Which methods does Class C have access to?
- only m1, m3
- only m2, m3
- m1, m3, m4
- m1, m2, m3
- m2, m3, m4
- only m3, m4
-
You execute the following code.
How many times will the word Hello be printed?
- 49
- 50
- 51
- 100
Explanation:The mod operator computes the remainder after dividing its first operand by its second. All numeric types have predefined remainder operators.
In this case the reminder will be nonzero 50 times (for i with values 1, 3, 5,..,99). -
You are creating the necessary variables for an application. The data you will store in these variables has the following characteristics:
– Consists of numbers
– Includes numbers that have decimal points
– Requires more than seven digits of precisionYou need to use a data type that will minimize the amount of memory that is used.
Which data type should you use?
- Decimal
- Single
- Byte
- Double
Explanation:The double keyword signifies a simple type that stores 64-bit floating-point values.
Precision: 15-16 digits -
You are building a web application that enables international exchange students to schedule phone calls with their prospective schools.
The application allows students to indicate a preferred date and time for phone calls. Students may indicate no preferred time by leaving the date and time field empty. The application must support multiple time zones.
Which data type should you use to record the student’s preferred date and time?
- uLong?
- DateTimeOffset?
- SByte
- Date
Explanation:datetimeoffset: Defines a date that is combined with a time of a day that has time zone awareness and is based on a 24-hour clock.
Incorrect:
Date: Defines a date.
sByte: The sbyte keyword indicates an integral type that stores values in the range of -128 to 127. -
You execute the following code.
What will the variable iResult be?
- 1
- 2
- 3
- 4
-
HOTSPOT
You are reviewing the following code that saves uploaded images.
For each of the following statements, select Yes if the statement is true. Otherwise, select No. Each correct selection is worth one point.
-
The following functions are defined:
What does the console display after the following line?
Printer(2)
- 210
- 211
- 2101
- 2121
-
DRAG DROP
You are developing an application to display track and field race results.
The application must display the race results twice. The first time it must display only the winner and runner-up. The second time it must display all participants. The code used to display results is shown below.
You need to implement the Rankings() function.
Complete the function to meet the requirements. (To answer, drag the appropriate code segment from the column on the left to its location on the right. Each code segment may be used once, more than once, or not at all. Each correct match is worth one point.)
-
How does a console-based application differ from a Windows Store app?
- Windows Store apps do not provide a method for user input
- Console-based applications do not display a graphical interface.
- Windows Store apps can access network resources.
- Console-based applications require the XNA Framework to run.
-
You are developing an application that tracks tennis matches. A match is represented by the following class:
A match is created by using the following code:
How many times is the Location property on the newly created Match class assigned?
- 0
- 1
- 2
- 3
-
DRAG DROP
You are extending an application that stores and displays the results of various types of foot races. The application contains the following definitions:
The following code is used to display the result for a race:
The contents of the console must be as follows:
– 99 seconds
– 1.65 minutes
– 99You need to implement the FootRace class.
Match the method declaration to the method body. (To answer, drag the appropriate declaration from the column on the left to its body on the right. Each declaration may be used once, more than once, or not at all. Each correct match is worth one point.)
-
You have a class named Glass that inherits from a base class named Window. The Window class includes a protected method named break().
How should you call the Glass class implementation of the break() method?
- Glass.break()
- Window.break()
- Me.break()
- MyBase.break()
-
You run the following code:
What is the value of result when the code has completed?
- 0
- 10
- 20
- 30
Explanation:The conditional-OR operator (||) performs a logical-OR of its bool operands. If the first operand evaluates to true, the second operand isn’t evaluated. If the first operand evaluates to false, the second operator determines whether the OR expression as a whole evaluates to true or false.
-
HOTSPOT
You are reviewing the following class that is used to manage the results of a 5K race:
For each of the following statements, select Yes if the statement is true. Otherwise, select No. Each correct selection is worth one point.
-
You create an object of type ANumber. The class is defined as follows.
The code is executed as follows.
What is the value of number after the code is executed?
- Null
- 0
- 3
- 7
-
You have a table named ITEMS with the following fields:
– ID (integer, primary key. auto generated)
– Description (text)
– Completed (Boolean)You need to insert the following data in the table:
“Cheese”, False
Which statement should you use?
- INSERT INTO ITEMS (Description, Completed) VALUES (‘Cheese’, 1)
- INSERT INTO ITEMS (ID, Description, Completed) VALUES (NEWID(), ‘Cheese’, 0)
- INSERT INTO ITEMS (ID, Description, Completed) VALUES (1, ‘Cheese”, 0)
- INSERT INTO ITEMS (Description, Completed) VALUES (‘Cheese’, 0)
Explanation:The string values TRUE and FALSE can be converted to bit values: TRUE is converted to 1 and FALSE is converted to 0.
Incorrect:
Not B, not C: ID is autogenerated and should not be specified. -
You run the following code.
What will the value of the variable iResult be?
- 1
- 2
- 3
- 4
-
This question requires that you evaluate the underlined text to determine if it is correct.
The application type should be ClickOnce for an application that presents users with a graphical interface in which they can enter data, and must run on computers that do not have network connectivity.
Instructions: Review the underlined text. If it makes the statement correct, select “No change is needed”. If the statement is incorrect, select the answer choice that makes the statement correct.
- Windows Service
- Windows Presentation Foundation
- console-based
- No change is needed
-
HOTSPOT
Instructions: For each of the following statements, select Yes if the statement is true. Otherwise, select No. Each correct selection is worth one point.
Explanation:
A value type holds a data value within its own memory space while a reference type holds a pointer to the memory location that holds the data.
Bool and char are value types; String is a reference type.