header1.html

Tuesday 9 April 2013

ASP.NET Quiz-1


ASP.NET Quiz-1
1.If page output caching,________caching persists specific portions of a page and lets other portion of the page be created dynamically ?
Partial page
Full page
Custom
semi


2.By using an ,_________ , the data is separated from html, and any changes to the items are made in the separated data source .
Incorporate source
Join
Link
Imported source


3.Asp.net object is used to get information about web servers?
Session Object
Application
Request
Server object


4.The __________ namespace contain classes for accessing and managing data from diverse sources
System.Data
System.IO
System.Reflection
System.Object


5. When an ASP.NET server control is added to a Web Form, Visual Studio .NET adds one item to the class for the form. What item is added ?
The event registration
A protected class member for the control
A default event handler for the click event
A default class that inherits from the control’s base class


6.What attribute must be set on a validator control for the validation to work ?
Validate
ValidateControl
ControlToBind
ControlToValidate


7.What HTML element is the asp:Label control rendered as when the target is Internet Explorer ?
label
span
div
table


8.Given an ASP.NET Web Form called WebForm1,what class does the WebForm1 class inherit from by default?
System.Web.Form
System.Web.GUI.Page
System.Web.UI.Page
System.Web.UI.Form


9.What is the Web.config file used for ?
To store the global information and variable definitions for the application
Configures the time that the server-side codebehind module is called
To configure the web server
To configure the web browser


10.After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesn’t execute. What could the problem be ?
The AutoEventWireup attribute is set to False
The AutomaticPostBack attribute is set to False
The codebehind module is not properly compiled
The ListBox must be defined WithEvents

C# Quiz-6(Events & Delegates)


C# Quiz-6(Events & Delegates)
1.A(an)...is the encapsulation of the idea that "something happened" to which the program must respond.
event
delegate
event-delegate model
None of above


2.-= operator is used to remove a delegate from a (possibly composite) field.
True
False


3. What will be output of following program?
delegate void MyDelegate(int i);
class Program
{
   public static void Main()
   {
      TakesADelegate(new MyDelegate(DelegateFunction));
   }
   public static void TakesADelegate(MyDelegate SomeFunction)
   {
      SomeFunction(21);
   }
   
   public static void DelegateFunction(int i)
   {
      System.Console.WriteLine("Called by delegate with number: {0}.", i);
   }
}

Compile time error
Called by delegate with number: 21.
Runtime error
None of above


4.Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea?
Attribute
Delegate
Namespace
Interface


5.Which of the following statements are correct about delegates?
Delegates cannot be used to call a static method of a class.
Delegates cannot be used to call procedures that receive variable number of arguments.
If signatures of two methods are same they can be called through the same delegate object.
Delegates cannot be used to call an instance function. Delegates cannot be used to call an instance subroutine.


6.delegate is a....
reference type
value type
both
none of above


7.A delegate defines....
a means of passing arrays into methods
a substitue for an inherited method
a class that encapsulates methods
None of above


8.An Event is
The result of a users action
result of a party
code to force users action
None of above


9.An event declaration defines a type that encapsulates a method with a particular set of arguments and return type.
True
False


10.A delegate can either be called asynchronously by using BeginInvoke and EndInvoke methods.
True
False

C# Quiz-5(Exception Handling)


C# Quiz-5(Exception Handling)
1.Exceptions are types that all ultimately derive from ...
System.Exception
System
System.Error
All of above


2. Use a ....block around the statements that might throw exceptions.
catch
finally
try
None of these


3.In C#,.....keyword is used to define an exception handler.
catch
finally
exception
None of above


4.which block is used to release resources, for example to close any streams or files that were opened in the try block?
try
catch
finally
all of above


5.
try
{
int a,b;
b=a/0;    // Code to try goes here.
}
catch (Exception ex)
{
    Console.WriteLine("Got it!!!");
}
catch (DivideByZeroException ex)
{
    Console.WriteLine("Infinite value!!!");
}
What will be output?
  

Got it!!!
Infinite value!!!
Compile time error
Run time error


6.The user-defined application exception classes derived from ApplicationException.True or False?
True
False


7.The pre-defined common language runtime exception classes derived from SystemException.
True
False


8.Which property is used to get a string representation of the immediate frames on the call stack.
CallStack
StackTrace
Message
Source


9.Supplementary information about the exception can be stored in the...property.
HResult
Source
Data
TargetSite


10.What will be output of following program?
using System;
class ExceptionTestClass 
{
   public static void Main() 
   {
      int x = 0;
      try 
      {
         int y = 100/x;
      }
         catch (ArithmeticException e) 
         {
            Console.WriteLine("ArithmeticException Handler");
         }
         catch (Exception e) 
         {
            Console.WriteLine("Generic Exception Handler");
         }
   } 
}


Compile time error
Generic Exception Handler
ArithmeticException Handler
None of above

C# Quiz-4


C# Quiz-4
1. The purpose of new keyword is
Method Hiding
Overriding
Oveloading
None of above


2.Multiple inheritance is suppported in C#?
Yes
No


3.GetEnumerator method returns ...
IEnumerable
IEnumerator
ICollection
None of above


4.Enumerators cannot be used to modify the underlying collection.
True
False


5. IEnumerator can be used to iterate through the collection.
True
False


6.Float datatype is equivalent to
System.Single
System.Double
Both
None Of above


7.The symbol used to represent nullable parameters in
~
!
:
?


8.parse is applied for
only value types
only reference types
Both value types and reference types
None of them


9.The scope of a variable declared inside an If statement is
Procedure
Module
If statement
None of above


10.sealed class can not be abstract.True/False
True
False

C# Quiz-3


C# Quiz-3
1.Which collection class represents first-in, first-out behaviour of objects?
ArrayList
Stack
Queue
SortedList


2. Which collection class manages items in a pairs of key/value?
HashTable
Stack
BitArray
Queue


3. In context of properties which of the following statements is true?
Properties must have atleast one accessor
Properties must have 'set' accessor
Properties must have 'get' accessor
No accessor is a must for a property to compile


4. A delegate which can point to more then one function at a time is known as which of the following?
an event
recursive function
delegate
muticast delegate


5.Whch of the following feature is based on publisher/subscriber model where publisher pubishes some activity to subscribers?
class
interface
event
collection


6.Which of the following is not true in context of structured exception handling?
finally block can be skipped
catch block can be skipped
arrange of blocks is flexible, for eg. try…finally…catch is valid
finally block do not take any argument like catch block


7.Which is the base class of all exceptions?
Exception
Error
SystemException
UserException


8.Where can we best do all clean up activities like freeing of resources in code?
In catch block
In finally block
in the end in try block
outside try..catch…finally blocks


9.Which of the following is not an available access specifier for class members?
public
private
external
internal


10. Which of the following correctly describes the contents of the filename AssemblyInfo.cs?
It contains assembly-level attributes.
It contains method-level attributes
It contains class-level attributes.
It contains structure-level attributes.

C# Quiz-2


C# Quiz-2
1.Which class cannot be further derived from?
Sealed class
Abstract class
Base class
Internal class


2. Which members are accessible to all within assembly but not to classes outside assembly?
public
private
virtual
internal


3.What is an array called if it can have rows of different sizes?
Jagged array
Multi dimension array
Single dimension array
Mixed array


4.What keyword is to be used in base class function which is supposed to be overridden in derived classes?
public
private
virtual
internal


5. Which keyword allows to split class definition in more than one .cs files?
virtual
attribute
sealed
partial


6.What conversion takes place with the concept of 'boxing'?
value type to reference type
reference type to value type
struct to enum
int to char


7.How a static function can be accessed?
Through class' object
Through class name
Only from another static function
Only from another non-static function


8.What is true about static class?
static class can be instantiated
static class can only have public members
static class can have only static members
static class cannot have members declared as 'internal'


9.In context of collections from which interface a class should be derived to have iteration facility where items can be iterated using foreach loop?
ICollection
IDictionary
IEnumerable
IComparer


10.Which collection class would be best suitable to manage a range of boolean values?
HashTable
BitArray
ArrayList
Queue