The code in a finally section executes if the code finishes without an error or if a catch section handles an exception but not if the code executes a return statement.. An exception is
Trang 1Question 1 of 20 5.0/ 5.0 PointsThe default integral number type is
In the following code sample, will the second if structure be evaluated?
bool condition = true;
Trang 2implicite integral number initialization casting order is
A ulong long uint int
B int long uint ulong
C uint int ulong long
D int uint long ulong
Trang 3A sequence of characters in double quotation marks
B contains exactly its variable name and nothing else
C contains numbers rather than letters
D only contains one character
What will be the output of above code when compiled/run?
A The output of above
code will be
99953
Trang 4What are the keywords supported in an if statement?
A if, else, else if, break
B if, else, else if
C if, else, default
D if, else, else-if, return
Trang 5C System.Arr
D Array
What is the purpose of break;in a switch statement?
A It causes the program to pause
B It causes the program to exit
C It causes the code to exit the switch statement
D It causes the code to stop executing until the user presses a key on the keyboard
double type variable range is
A from ±5.0E−324 to ±1.7E308
B from ±1.7E−320 to ±1.7E320
Trang 6If the Employee class inherits from the Person class, covariance lets you do which of the following?
A Store a method that returns an Employee in a delegate that represents methods that return a Person
B Store a method that takes a Person as a parameter in a delegate that represents methods
Trang 7that take an Employee as a parameter
C Store a method that returns a Person in a delegate that represents methods that return anEmployee
D Store a method that takes an Employee as a parameter in a delegate that represents methods that take a Person as a parameter
Suppose the variable note is declared by the statement Action note Then which of the
following correctly initializes note to an expression lambda?
Trang 8B Isortable
C Icomparer
D Icomparable
If a class implements IDisposable, its Dispose method should do which of the following?
A All of the above
B Free unmanaged resources
C Call GC.SuppressFinalize
D Free managed resources
Which of the following statements about exception handling is true?
A A try-catch-finally block must include at least one catch section and one finally
section
B The code in a finally section executes if the code finishes without an error or if a catch section handles an exception but not if the code executes a return statement
C You can nest a try-catch-finally block inside a try, catch, or finally section
D An exception is handled by the catch section that has the most specific matching
exception type
Which of the following statements is true?
A A class can inherit from any number of classes and implement at most one interface
B A class can inherit from any number classes and implement any number of interfaces
C A class can inherit from at most one class and implement at most one interface
Trang 9D A class can inherit from at most one class and implement any number of interfaces
Which of the following statements about events is false?
A If an object subscribes to an event twice, its event handler executes twice when the event is raised
B In a Windows Forms application, you can use the Properties window to subscribe and unsubscribe events, and to create empty event handlers
C If an object subscribes to an event once and then unsubscribes twice, its event handler throws an exception when the event is raised
D If an object subscribes to an event twice and then unsubscribes once, its event handler executes once when the event is raised
Suppose Fis declared by the statement Func<float, float> F Then which of the following
correctly initializes Fto an anonymous method?
A F = delegate { return x * x; };
B F = float Func(float x) { return x * x; };
C F = delegate(float x) { return x * x; };
D F = (float x) { return x * x; };
Trang 10Question 11 of 20 5.0/ 5.0 PointsSuppose the Car class provides a Stopped event that takes as parameters sender and StoppedArgsobjects Suppose also that the code has already created an appropriate StoppedArgs object named args Then which
of the following code snippets correctly raises the event?
A if (!Stopped.IsEmpty) Stopped(this, args);
B if (Stopped != null) Stopped(this, args);
C raise Stopped(this, args);
D if (Stopped) Stopped(this, args);
Which of the following statements about throwing exceptions is false?
A If you rethrow the exception ex with the statement throw, the exception’s call stack is reset to start at the current line of code
B Before a method throws an exception, it should clean up as much as possible, so the calling code has to deal with the fewest possible side effects
C If you rethrow the exception ex with the statement throw ex, the exception’s call stack
is reset to start at the current line of code
D If you catch an exception and throw a new one to add more information, you should include the original exception in the new one’s InnerException property
Which of the following statements subscribes the myButton_Click event handler to catch the myButton
control’s Click event?
Trang 11If a class has unmanaged resources and no managed resources, it should do which of the following?
A Not implement IDisposable and provide a destructor
B Not implement IDisposable and not provide a destructor
C Implement IDisposable and provide a destructor
D Implement IDisposable and not provide a destructor
Which of the following is a valid delegate definition?
A private delegate MyDelegate(float x);
B private delegate void MyDelegate(float x);
C private delegate MyDelegate(x);
D private delegate float MyDelegate(float);
Which of the following should you not do when building a custom exception class?
A Make it implement Idisposable
B Give it event handlers with parameters that match those defined by the
System.Exception class
C Derive it from the System.Exception class, and end its name with Exception
D Give it the Serializable attribute
Suppose the MovedEventHandler delegate is defined by the statement delegate void MovedEventHandler() Which of the following correctly declares the Moved event?
A public MovedEventHandler MovedEvent;
B public event MovedEventHandler MovedEvent;
Trang 12C public event Action MovedEvent;
D Both b and c are correct
Which the following statements about the base keyword is false?
A A constructor cannot use both a base statement and a this statement
B The base keyword lets a constructor invoke a different constructor in the same class
C A constructor can use at most one base statement
D If a constructor uses a base statement, its code is executed after the invoked constructor
is executed
Suppose the HouseBoat class implements the IHouse interface implicitly and the IBoat interface explicitly Which of the following statements is false?
A The code can treat a HouseBoat object as an IBoat to access its IBoat members
B The code can treat a HouseBoat object as an IHouse to access its IHouse members
C The code can use a HouseBoat object to access its IBoat members
D The code can use a HouseBoat object to access its IHouse members
In the variable declaration Action<Order> processor, the variable process or represents which of the
following?
A Methods provided by the Action class that take no parameters and return void
B Methods that take no parameters and return an Order object
C Methods that take an Order object as a parameter and return void
D Methods that take an Order object as a parameter and return an Order object
Trang 13What wrong with these code :
A Do Not Catch Exceptions That You Cannot Handle
B This code is not good, you should Use validation code to avoid unnecessary
regarding the finally block?
A Finally block is executed after Catch block when no error occurs
B Finally block is used to enclose code that needs to run, regardless of whether an
exception is raised
C Finally block will be executed only if an error occurs
D Finally block is executed only when no error occurs
A block enclose the code that could throw an exception
A Error
B Try
Trang 15A block enclose the code that could throw an exception
B You should never catch System.Exception or System.SystemException in a catch blockbecause you could inadvertently hide run-time problems like Out Of Memory
C Do not catch exceptions that you do not know how to handle and then fail to propagate the exception
Trang 16A catch clause may catch exception of which type?
A The Error Type
B The Exception Type
C The Throwable Type
What will be the output of above code when compiled / run?
A The output of above code will be
Trang 17D The code will not generate a compile time
error
What wrong with this code
static void ProductExists( string ProductId)
{ // search for Product
B You should never catch System.Exception or System.SystemException in a catch blockbecause you could inadvertently hide run-time problems like Out Of Memory
C Do not catch exceptions that you do not know how to handle and then fail to propagate the exception
Trang 18after try block we can write code for connection close in _ block
Trang 19D Throws
Select a collection type that match all condition bellow :
Represents a collection of key/value pairs that are organized based on the hash code of the key
A weakly typed collection of key-value pairs
Lets you quickly get an object out of the collection by using it's key
Access items in your weakly typed collection, based on a key, not on an index
Each element is a key/value pair stored in a DictionaryEntry object
How can you sort the elements of the array in descending order?
A By calling Sort() and then Reverse() methods
B By calling Descend()
C By calling SortReverse()
Trang 20D By calling ReverseSort();
Select a collection type that match all condition bellow :
It is useful for storing messages in the order they were received for sequential processing
it maintains FIFO (first in first out) system
With it you can create weakly typed collections that are ordered by the order they are added to the collection
It accepts a null reference as a valid value and allows duplicate elements
Objects stored in it are inserted at one end and removed from the other
Select a collection type that match all condition bellow :
It is One of the most basic collection classes
It's not really a collection class, due to its limitations and its not even located in the
System.Collections namespace, but in the System namespace
It has a fixed size
it can have multiple dimensions
You can access an item of it by it's index
Trang 21A.Hight performance
B.Heavy object
C.No re-use/upgrade model
D.Lack of DataAccess features
Trang 22What is a connection object?
A Specifies whether to use a DSN or DSN-less connection
B First opens the initial connection to a database before giving any database information
C Specifies the type of driver to use, database format and filename
D Specifies whether to use a DSN or DSN-less connection
Which of the following statements is true about Dataset ?
A Dataset cannot store any tables in the cache
B Dataset can store only one table in its cache
C Dataset stores tables in the cache,only when cache set to true
D Dataset can store multiple tables in cache
Optimistic concurency means
A control works on the assumption that resource conflicts between multiple users are unlikely (but not impossible), and allows transactions to execute without locking any resources.Only when attempting to change data are resources checked to determine if any conflicts have occurred If a conflict occurs, the application must read the data and attempt the change again
Trang 23B … control locks resources as they are required, for the duration of a transaction Unlessdeadlocks occur, a transaction is assured of successful completion
C ….whatever data modification was made last gets written to the database
How to roll back all changes that have been made to the table since it was loaded?
A Call DataTable.RollbackChanges() method
B Call DataSet.RejectChanges() method
C Call DataTable.RejectChanges() method
D Call DataSet.RollbackChanges() method
Trang 24What must your ASP code have if you are using the DSN method of connecting?
Trang 25Which object that bellowed statements describe about?
Its is Read only !
Its connected to datasource
You must manage connection your self
It use fewer server resource
A DataReader
B Dataset
Trang 27A These attributes provide side validation, and the framework also supports side validation when you use one of the attributes on a model property You can use four
client-attributes in the DataAnnotations namespace to cover the common validation scenarios,
Required, String Length, Regular Expression and Range
B These attributes provide server-side validation, and the framework also supports side validation when you use one of the attributes on a model property You can use four
client-attributes in the DataAnnotations namespace to cover the common validation scenarios,
Required, String Length, Regular Expression and Range
C These attributes provide side validation, and the framework also supports side validation when you use one of the attributes on a model property You can use four
server-attributes in the DataAnnotations namespace to cover the common validation scenarios,
Required, String Length, Regular Expression and Range
What are Code Blocks in Views? (Razor)
A @{code commands here }
Trang 28B <% code commands here %>
C @* code commands here *@
Which is the correct code to get the Name?
A @foreach (var item in items)
What are the new features of MVC 3?
A Introduction of UI helpers with automatic scaffolding with customizable templates
B Mobile project template using jQuery Mobile
C Improved model validation
Trang 29Part 2 of 2 - Part 2 50.0/ 50.0 Points
You have code that executes SQL statements on a database within the context of a
SQLTransaction You want to ensure that no user can perform any updates in the database until your transaction is complete What IsolationLevel should you use?
Trang 30B.Initial catalog
C.Integrated security
D.Connection timeout
What are the benefit of typed dataset
A.Rapid application development
B.XML Support
C.Strongly type
D.Designer support
Permistic concurency means
A … control locks resources as they are required, for the duration of a transaction
Unless deadlocks occur, a transaction is assured of successful completion
B ….whatever data modification was made last gets written to the database
C control works on the assumption that resource conflicts between multiple users are unlikely (but not impossible), and allows transactions to execute without locking any resources.Only when attempting to change data are resources checked to determine if any conflicts have occurred If a conflict occurs, the application must read the data and attempt the change again
Which of the following statements is true about Dataset ?
A Dataset cannot store any tables in the cache
B Dataset can store only one table in its cache
C Dataset stores tables in the cache,only when cache set to true