Uploaded by hcmes Kadapa

C# Programming Exam Questions

advertisement
1.
CLR is the .NET equivalent of _________.
A.
Java Virtual Machine
B.
Common Language Runtime
C.
Common Type System
D.
Common Language Specification
Ans: A
Boxing converts a value type on the stack to an ______ on the heap.
A.
Bool type
B.
Instance type
C.
Class type
D.
Object type
Ans: D
10.
The character pair ?: is a________________available in C#.
A.
Unary operator
B.
Ternary operator
C.
Decision operator
D.
Functional operator
Ans: B
11.
In C#, all binary operators are ______.
A.
Center-associative
B.
Right-associative
C.
Left-associative
D.
Top-associative
Ans: C
12.
An _______ is a symbol that tells the computer to perform certain
mathematical or logical manipulations.
A.
Operator
B.
Expression
C.
Condition
D.
Logic
Ans: A
13. A _____ is any valid C# variable ending with a colon.
A.
goto
B.
Label
C.
Logical
D.
Bitwise
Ans: B
14.
C# has _______ operator, useful for making two way decisions.
A.
Looping
B.
Functional
C.
Exponential
D.
Conditional
Ans: D
15.
________causes the loop to continue with the next iteration after skipping
any statements in between.
A.
Loop
B.
Exit
C.
Break
D.
Continue
Ans: D
16.
An ____ is a group of contiguous or related data items that share a
common name.
A.
Operator
B.
Integer
C.
Exponential
D.
Array
Ans: D
17.
Arrays in C# are ______ objects.
A.
Reference
B.
Logical
C.
Value
D.
Arithmetic
Ans: A
18.
Multidimensional arrays are sometimes called _______ Arrays.
A.
Square
B.
Triangular
C.
Rectangular
D.
Cube
Ans: C
19.
______ parameters are used to pass results back to the calling method.
A.
Input
B.
Reference
C.
Value
D.
Output
Ans: D
20.
The formal-parameter-list is always enclosed in _______.
A.
Square
B.
Semicolon
C.
Parenthesis
D.
Colon
Ans: C
21.
_______ variables are visible only in the block they are declared.
A.
System
B.
Global
C.
Local
D.
Console
Ans: C
22.
C# does not support _____ constructors.
A.
parameterized
B.
parameter-less
C.
Class
D.
Method
Ans: B
23.
A structure in C# provides a unique way of packing together data of ______
types.
A.
Different
B.
Same
C.
Invoking
D.
Calling
Ans: A
24.
Struct’s data members are ____________ by default.
A.
Protected
B.
Public
C.
Private
D.
Default
Ans: C
25.
A _______ creates an object by copying variables from another object.
A.
Copy constructor
B.
Default constructor
C.
Invoking constructor
D.
Calling constructor
Ans: A
26.
The methods that have the same name, but different parameter lists and
different definitions is called______.
A.
Method Overloading
B.
Method Overriding
C.
Method Overwriting
D.
Method Overreading
Ans: A
27.
The C# provides special methods known as _____ methods to provide
access to data members.
A.
Loop
B.
Functions
C.
Methods
D.
Accessor
Ans: D
28.
When an instance method declaration includes the abstract modifier, the
method is said to be an ______.
A.
Abstract method
B.
Instance method
C.
Sealed method
D.
Expression method
Ans: A
29.
The theory of _____ implies that user can control the access to a class,
method, or variable.
A.
Data hiding
B.
Encapsulation
C.
Information Hiding
D.
Polymorphism
Ans: B
30.
Inheritance is ______ in nature.
A.
Commutative
B.
Associative
C.
Transitive
D.
Iterative
Ans: C
31.
The point at which an exception is thrown is called the _______.
A.
Default point
B.
Invoking point
C.
Calling point
D.
Throw point
Ans: D
32.
In C#, having unreachable code is always an _____.
A.
Method
B.
Function
C.
Error
D.
Iterative
Ans: C
33.
C# treats the multiple catch statements like cases in a _____________
statement.
A.
If
B.
Switch
C.
For
D.
While
Ans: B
34.
C# supports a technique known as________, which allows a method to
specify explicitly the name of the interface it is implementing.
A.
Method Implementaion
B.
Implicit Interface Implementation
C.
Explicit Interface Implementation
D.
Iterative Interface Implementation
Ans: C
35.
The reason that C# does not support multiple inheritances is because of
______.
A.
Method collision
B.
Name collision
C.
Function collision
D.
Interface collision
Ans: B
36.
_______ is a set of devices through which a user communicates with a
system using interactive set of commands.
A.
Console
B.
System
C.
Keyboard
D.
Monitor
Ans: A
37.
Exponential formatting character (‘E’ or ‘e’) converts a given value to string
in the form of _______.
A.
m.dddd E+xxx
B.
m.dddd
C.
E+xxx
D.
None of the above
Ans: A
38.
The ______ are the Graphical User Interface (GUI) components created for
web based interactions..
A.
Web forms
B.
Window Forms
C.
Application Forms
D.
None of the above
Ans: B
39.
In Microsoft Visual Studio, ______ technology and a programming
language such as C# is used to create a Web based application.
A.
JAVA
B.
J#
C.
VB.NET
D.
ASP.NET
Ans: D
40.
The controls available in the tool box of the ______ are used to create the
user interface of a web based application.
A.
Microsoft visual studio IDE
B.
Application window
C.
Web forms
D.
None of the above
Ans: A
41.The infrastructure that supports these dynamic operations at run time is called
the__________.
A.CLR
B.CTS
C.CLS
D.DLR
Ans: D
42.The___________keyword is new to C# 4.0, and is used to tell the compiler that
a variable's type can change or that it is not known until runtime.
A.Covariance
B.dynamic
C.Contravariance
D.Object
Ans: B
43._______ methods are not supported for dynamic types.
A.Anonymous
B.Static
C.Abstract
D.Extension
Ans: D
44.myMobile.Accept(55, inReject: false); Above statement is an example of which
new concept of C# 4.0?
A.Named Parameters
B.Optional Parameters
C.dynamic
D.Variance
Ans: A
45.COM Interop is simplified in C#4.0 e.g.var doc =
Application.GetDocument("MyFile.txt"); In above statement_______ keyword was
essential in parameters of GetDocument() in previous versions of C#.
A.out
B.named
C.base
D.ref
Ans: D
46.Covariance and Contravariance are new features introduced in C#
4.0.True/False?
A.False
B.True
Ans: B
47._________parameters allows you to give a method parameter a default value
so that you do not have to specify it every time you call the method.
A.optional
B.named
C.out
D.ref
Ans: A
48.Duck typing is implemented by using_________ keyword.
A.dynamic
B.object
C.ref
D.base
Ans: A
49. Web Forms consists of a _______ and a _________ .
A. Template, Component
B. CLR, CTS
C. HTML Forms, Web services
D. Windows, desktop
Ans: A
50. The ______ parentheses that follow _____ indicate that no information is
passed to Main ().
A. Empty, class
B. Empty, submain
C. Empty, Main
D. Empty, Namespace
Ans: C
51. Is it possible to store multiple data types in System.Array?
A.
Yes
B.
No
Ans: B
52. What is the wild card character in the SQL "like" statement?
A.
* (Asterisk)
B.
# (Pound)
C.
% (Percent)
D.
$ (Dollar)
Ans:
C
53. Which of the following is the root of the .NET type hierarchy?
A.
System.Object
B.
System.Base
C.
System.Root
D.
System.Parent
Ans:
A
54. C# doesnot support:
A.
abstraction
B.
polymorphism
C.
multiple inheritance
D.
inheritance
Ans:
C
55. Your company uses Visual Studio.NET 2005 as its application development
platform. You are developing an application using the .NET Framework 2.0. You
are required to use a datatype that will store only numbers ranging from -32,768
to 32,767. Which of the following datatypes will you use to accomplish the task?
A.
short
B.
System.Int16
C.
string
D.
a and b
Ans:
D
56. Which of the following jobs are NOT performed by Garbage Collector?
1.Freeing memory on the stack.
2.Avoiding memory leaks.
3.Freeing memory occupied by unreferenced objects.
4.Closing unclosed database collections.
5.Closing unclosed files.
(A)
1, 2, 3
(B)
1, 4, 5
(C)
3, 5
(D)
3, 4
Ans: B
57. Which of the following statements is correct about Managed Code?
A.
Managed code is the code that runs on top of Windows.
B.
Managed code is the code that is written to target the services of the CLR.
C.
Managed code is the code where resources are Garbage Collected.
D.
Managed code is the code that is compiled by the JIT compilers.
Ans:
B
58. How does assembly versioning in .NET prevent DLL Hell?
A.
The runtime checks to see that only one version of an assembly is on the machine at
any one time.
B.
The compiler offers compile time checking for backward compatibility.
C.
.NET allows assemblies to specify the name AND the version of any assemblies
they need to run.
D.
It doesn.t.
Ans:
C
59. Which of the following is/are not types of arrays in C#?
A.
Single-Dimensional
B.
Multidimensional
C.
Jazzed arrays
D.
Jagged arrays
Ans:
C
60. A variable which is declared inside a method is called a________variable
A.
Local
B.
Private
C.
Static
D.
Serial
Ans:
A
61. Two methods with the same name but with different parameters.
A.
Overloading
B.
Multiplexing
C.
Duplexing
D.
Loading
Ans:
A
62. Which file contains configuration data for each unique URl resource used in
project?
A.
web.config
B.
global.asax
C.
webapplication.vsdisco
D.
assemblyinfo.cs
Ans:
A
63. Features of Read only variables
A.
Declaration and initialization is separated
B.
It is allocated at compile time
C.
It is allocated at runtime
D.
all of the above
Ans:
D
64. Different ways a method can be overloaded in C#.NET
A.
Different parameter data types
B.
Different order of parameters
C.
Different number of parameters
D.
All of above
Ans:
D
65. Is it possible to change the value of a variable while debugging a C#
application?
A.
Yes
B.
No
Ans:
A
66. Which of the following constitutes the .NET Framework?
1. ASP.NET Applications
2. CLR
3. Framework Class Library
4. WinForm Applications
5. Windows Services
(A)
2, 5
(B)
2, 1
(C)
2, 3
(D)
3, 4
Ans: C
67. Which of the following statements is correct about the C#.NET program given
below?
namespace PskillsConsoleApplication
{
class Baseclass
{
int i;
public Baseclass(int ii)
{
i = ii;
Console.Write("Base ");
}
}
class Derived : Baseclass
{
public Derived(int ii) : base(ii)
{
Console.Write("Derived ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Derived d = new Derived(10);
}
}
}
A.
The program will report an error in the statement base(ii).
B.
The program will work correctly if we replace base(ii) with base.Baseclass(ii).
C.
The program will output: Base Derived
D.
The program will work correctly only if we implement zero-argument constructors in
Baseclass as well as Derived class.
Ans:
C
68. Managed methods will be marked as ------------ in MSIL code
A.
mscorjit
B.
cil
C.
dgclr
D.
None
Ans:
B
69. Identify which is true
A.
DataView ia subset of row and not columns
B.
find can be done only on sorted columns
C.
Sorting can be done on multiple columns
D.
None of these
Ans:
A
70. Which of the following .NET components can be used to remove unused
references from the managed heap?
A.
Class Loader
B.
Garbage Collector
C.
CTS
D.
CLR
Ans: B
71. A local variable
A.
Can be used anywhere in the program
B.
Is declared within a method
C.
Must accept a class
D.
Represent a class object
Ans: b
72. An instance variable
A.
is an object of a class
B.
represents an attribute of an object
C.
is a method of a class
D.
a and c
Ans: b
73. Private Button print = new button();
A.
creates a button control
B.
initializes a button control
C.
instantiates button control
D.
a and b
E.
a and c
Ans: e
74. An instance method
A.
Represents the behavior of an object
B.
Represents the attribute of an object
C.
Represents another class
D.
a and b
Ans: a
75. A Constructor
A.
is used to create objects
B.
must have the same name as the class it is declared within
C.
is a method of a class
D.
maybe overloaded
E.
b and c
F.
all of the above
Ans: e
76. class Test: Form { }
A.
Creates the class Test : Form
B.
Creates the class Test that inherits the class Form
C.
Creates the class form that inherits the class Test
D.
a and b
Ans: b
77. A variable declared inside a method is called a________variable
A.
Static
B.
Private
C.
Local
D.
Serial
E.
b and d
Ans: c
78. Defining two methods with the same name but with different parameters is
called.
A.
Loading
B.
Overloading
C.
Multiplexing
D.
Duplexing
Ans: b
79. Find any errors in the following BankAccount constructor: Public int
BankAccount() { balance = 0; }
A.
Name
B.
Formal parameters
C.
Return type
D.
No errors
Ans: c
80. In the body of a method, C# uses the variable named_____to refer to the
current object whose method is being invoked
A.
call
B.
this
C.
do
D.
that
Ans: b
81.String mystring; Creates a(n)
A.
class
B.
Constructor
C.
Object
D.
a and b
Ans: c
82. An Event is
A.
The result of a users action
B.
result of a party
C.
code to force users action
Ans: a
83. A delegate defines
A.
a Wahsington representative
B.
a class that encapsulates methods
C.
a means of passing arrays into methods
D.
a substitue for an inherited method
Ans: b
84. Is it possible to pass methods as arguments for other methods without
modification.
A.
True
B.
False
Ans: a
85. All interfaces must contain IDrivable
A.
True
B.
False
Ans: b
86. What is the proper header for a class that intends to use an interface.
A.
class MyClass IFace
B.
class MyClass ; IFace
C.
class MyClass : IFace
D.
class MyCalss {IFace}
E.
class MyCalss(IFace)
Ans: c
87. In order for a class to use an interface, it must
A.
inherit the properties of the interface
B.
contain the same methods as the interface
C.
create an interface objects
D.
a and b
E.
all of the above
Ans: e
88. Every class directly or indirectly extends the______class.
A.
System
B.
Object
C.
Drawing
D.
Console
Ans: b
89. The concept of composition specifies that you can.
A.
Compose good code with C#
B.
Compose C# projects with different objects
C.
Reduce errors by remaining composed during programming
D.
all of the above
Ans: b
90. Polymorphism occurs when the methods of the child class.
A.
Override the parent class methods but maintain the implementation
B.
Maintain the same return type and arguments as the parent class, but implement it
differently
C.
Have different return types and arguments than the parent class
D.
Are Virtual
Ans: b
91. To output the value of multidimensional array, Console.WriteLines(___)
A.
myArray[1][3];
B.
myArray[1.3];
C.
myArray{1}{3};
D.
myArray(1),(3);
Ans: a
92. All methods in an abstract base class must be declared abstract.
A.
True
B.
False
Ans: b
93. Methods that are declared abstract in the base class must show
implementation at the time of declaration.
A.
True
B.
False
Ans: b
94. The code public class B : A { }
A.
Defines a class that inherits all the methods of A
B.
Defines a class that inherits the public and protected methods of A only
C.
Errors
D.
a and b
Ans: b
95. Assuming that public class B : A { public B(int i) :base(i) { } } compiles and
runs correctly, what can we conclude about the constructors in the class A?
A.
One constructor takes an argument of type i
B.
There is only a default constructor
C.
One constructor takes an arguments of the type int
D.
False
Ans: b
96. Classes declared with the sealed keyword cannot be base class.
A.
True
B.
False
Ans: a
97. A method_____an exception when that method detects that a problem has
occured.
A.
Trys
B.
Catches
C.
Throws
D.
a and b
Ans: c
98. Exception objects are derived from the class.
A.
Try
B.
Catch
C.
Exception
D.
Event
E.
System
Ans: c
99. An abstract class
A.
may contain instance variables
B.
may contain constructors
C.
may extend another class
D.
a and b
E.
all of the above
Ans: e
100. A____block enclose the code that could throw an exception.
A.
Try
B.
Catch
C.
Exception
D.
Error
E.
a and b
Ans: a
C# MCQ (Multiple Choice Questions and Answers)
May 29, 2020 C#, C#.Net, C# MCQs, 72141 Views
In this article we’ll go through various important questions of C#.Net .This would help
students to test their knowledge, in a way that to what extent they are familiar with the topic.
This article would even help students to brush up their knowledge.
Are you preparing for the next job interviews in C# .NET? If yes, trust me this post will help
you also we'll suggest you check out a big collection for Programming Full Forms that may
help you in your interview:
List of Programming Full Forms
The questions are as follows along with the options given below them:
1. CLR is the .Net equivalent of _____.
A.
B.
C.
D.
Java Virtual machine
Common Language Runtime
Common Type System
Common Language Specification
Ans: A
2. Abstract class contains _____.
A.
B.
C.
D.
Abstract methods
Non Abstract methods
Both
None
Ans: C
3. The default scope for the members of an interface is _____.
A.
B.
C.
D.
private
public
protected
internal
Ans: B
4. Which of the following statements is incorrect about delegate?
A.
B.
C.
D.
Delegates are reference types.
Delegates are object-oriented.
Delegates are type-safe.
Only one can be called using a delegate.
Ans : D
5. The space required for structure variables is allocated on the stack.
A.
B.
C.
D.
True
False
Maybe
Can’t say
Ans: A
6. Which of the following is incorrect about constructors?
A.
B.
C.
D.
Defining of constructors can be implicit or explicit.
The calling of constructors is explicit.
Implicit constructors can be parameterized or parameterless.
Explicit constructors can be parameterized or parameterless.
Ans: C
7. Reference is a ___.
A.
B.
C.
D.
Copy of class which leads to memory allocation.
Copy of class that is not initialized.
Pre-defined data type.
Copy of class creating by an existing instance.
Ans: D
8. The data members of a class by default are?
A.
B.
C.
D.
protected, public
private, public
private
public
Ans: C
9. What is the value returned by function compareTo( ) if the invoking string is less
than the string compared?
A.
B.
C.
D.
Zero
A value of less than zero
A value greater than zero
None of the mentioned
Ans: B
10. The correct way to overload +operator?
A.
B.
C.
D.
public sample operator + (sample a, sample b)
public abstract operator + (sample a, sample b)
public static operator + (sample a, sample b)
all of the mentioned above
Ans: D
11. Select the two types of threads mentioned in the concept of multithreading?
A.
B.
C.
D.
Foreground
Background
Only foreground
Both foreground and background
Ans: D
12. Choose the wrong statement about properties used in C#.Net?
A. Each property consists of accessor as getting and set.
B. A property cannot be either read or write-only.
C. Properties can be used to store and retrieve values to and from the data members of
a class.
D. Properties are like actual methods that work like data members.
Ans: A
13. If a class ‘demo’ had ‘add’ property with getting and set accessors, then which of
the following statements will work correctly?
A. math.add = 20;
B. math m = new math();
m.add = 10;
C. Console.WriteLine(math.add);
D. None of the mentioned
Ans: A
14. What will be the output of the following code snippet?
using System;
class sample
{
int i;
double k;
public sample (int ii, double kk)
{
i = ii;
k = kk;
double j = (i) + (k);
Console.WriteLine(j);
}
~sample()
{
double j = i - k;
Console.WriteLine(j);
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample(9, 2.5);
}
}
A.
B.
C.
D.
0 0
11.5 0
Compile-time error
11.5 6.5
Ans : D
15. What will be the output of the following code snippet?
using System;
class program
{
static void Main(string[] args)
{
int x = 8;
int b = 16;
int c = 64;
x /= c /= b;
Console.WriteLine(x + " " + b+ " " +c);
Console.ReadLine();
}
}
A.
B.
C.
D.
2
4
2
8
Ans: A
16
8
4
16
4
16
8
64
16. Struct’s data members are ___ by default.
A.
B.
C.
D.
Protected
Public
Private
Default
Ans: C
17. The point at which an exception is thrown is called the _____.
A.
B.
C.
D.
Default point
Invoking point
Calling point
Throw point
Ans: D
18. Which of the following statements are correct for C# language?
A. Every derived class does not define its own version of the virtual method.
B. By default, the access mode for all methods in C# is virtual.
C. If a derived class, does not define its own version of the virtual method, then the one
present in the base class gets used.
D. All of the above.
Ans: C
19. What will be the output of the following code snippet?
using System;
class sample
{
public sample()
{
Console.WriteLine("constructor 1 called");
}
public sample(int x)
{
int p = 2;
int u;
u = p + x;
Console.WriteLine("constructor 2 called");
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample(4);
sample t = new sample();
Console.ReadLine();
}
}
A. constructor 1 called
constructor 2 called
B. constructor 2 called
constructor 1 called
C. constructor 2 called
constructor 2 called
D. error
Ans: B
20. Which of the following keywords is used to refer base class constructor to
subclass constructor?
A.
B.
C.
D.
this
static
base
extend
Ans: C
1. Which of the following is not a namespace in the .NET Framework Class Library?
a) System.Process
b) System.Security
c) System.Threading
d) System.xml
View Answer
Answer: a
Explanation: None.
2. Which is the correct statement about the namespaces in C#.NET?
a) Nesting of namespaces is permitted, provided all the inner namespaces are declared in
the same file
b) A namespace cannot be tested
c) There is no limit on the number of levels while nesting namespaces
d) All of the mentioned
View Answer
Answer: c
Explanation: None.
3. Which among the following does not belong to the C#.NET namespace?
a) class
b) struct
c) enum
d) data
View Answer
Answer: d
Explanation: None.
advertisement
4. Which among the following is a correct statement about namespace used in C#.NET?
a) Classes must belong to a namespace, whereas structures need not
b) All elements of the namespace must to belong to one file
c) If not mentioned, a namespace takes the name of the current project
d) All of the mentioned
View Answer
Answer: c
Explanation: None.
5. Which among the given is not a correct way to call the method Issue() defined in the
following C# code snippet?
1. class Book
2. {
3.
public void issue()
4.
{
5.
/* code */
6.
}
7. }
8. class Journel
9. {
10.
public void issue()
11.
{
12.
/* code */
13.
}
14.
}
a)
College.Lib.Book b = new College.Lib.Book();
b.issue();
b)
Book b = new Book();
b.issue();
c)
using College.Lib;
Book b = new Book();
b.issue();
d) All of the mentioned
View Answer
Answer: b
Explanation: None.
6. Which among the following statements are not correct about a namespace used in
C#.NET?
a) Nested namespaces are allowed
b) Importing outer namespaces imports inner namespace
c) Nested namespaces are allowed
d) Importing outer namespace does not import inner namespace
View Answer
Answer: b
Explanation: None.
7. Which among the following is a .NET namespace?
a) System.Web
b) System.Process
c) System.Drawing2D
d) System.Drawing3D
View Answer
Answer: a
Explanation: None.
8. If a class named csharp is present in namespace n1 as well as in namespace n2, then
which of the following is the correct way to use csharp class?
a)
class Program
{
static void Main(string[] args)
{
import n1;
csharp x = new csharp();
x.fun();
import n2;
csharp y = new csharp();
y.fun();
}
}
b)
import n1;
import n2;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
n1.csharp x = new n1.csharp();
x.fun();
import n2;
n2.csharp y = new n2.csharp();
y.fun();
}
}
}
c)
class Program
{
static void Main(string[] args)
{
using n1;
csharp x = new csharp();
x.fun();
using n2;
csharp y = new csharp();
y.fun();
}
}
d)
using n1;
using n2;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
n1.csharp x = new n1.csharp();
x.fun();
import n2;
n2.csharp y = new n2.csharp();
y.fun();
}
}
}
View Answer
Answer: c
Explanation: None.
9. If ListBox is the class of System.Windows.Forms namespace. Then, the correct way to
create an object of ListBox class is?
a)
using System.Windows.Forms;
ListBox I = new ListBox();
b) System.Windows.Forms.ListBox I = new System.Windows.Forms.ListBox();
c) using LBControl I = new System.Windows.Forms.ListBox;
d) All of the mentioned
View Answer
Answer: d
Explanation: None.
10. Which among the following is the correct statement about the using statement used in
C#.NET?
a) A C#.NET source code file consists of any number of using statement
b) By using ‘using’ statement it’s possible to create an alias for the namespace but not for
the namespace element
c) It is permitted to define a member at namespace level using alias
d) Using statement can be placed anywhere in the C#.NET source code file
View Answer
Answer: c
Explanation: None.
ADO.NET MCQs (Multiple choice questions and answer)
1) To perform asynchronous data access, what must be added to the
connection string?
1.
2.
3.
4.
BeginExecute=true
MultiThreaded=true
MultipleActiveResultSets=true
Asynchronous=true
Answer : 4
2) Can you use a DataView to filter rows in a DataTable
1.
2.
3.
4.
Yes, by setting the Filter property of the DataView
Yes, by setting the RowFilter property of the DataView
Yes, by using the SetFilter(. method of the DataView
No, a DataView cannot be used to filter rows in a DataTable
Answer: 2
3) Which is a property of the DataGrid control?
1.
2.
3.
4.
DataMember
DataSource
DataQuery
All of the above.
Answer: 4
4) In a connection string _____________ represents name of the database
1.
2.
3.
4.
Data Source
Initial Catalog
Catalog Initial
Database
Answer: 2
5) What are the Command Object Methods?
1.
2.
3.
ExecuteNonQuery
ExecuteReader
ExecuteScalar
4.
All of the above.
Answer: 4
6) When you create a relationship between tables in ADO.NET DataSet
1.
2.
3.
4.
A UniqueConstraint is added to the parent table
A ForeignKeyConstraint is added to the child table by default
Both a and b
None
Answer : 3
7) The first record in a dataset has a position property of:
1.
2.
3.
4.
zero
one
any value defined by the programmer
All of the above
Answer: 1
8) Which ado.net class provide a disconnected environment?
1.
2.
3.
4.
DataReader
DataSet
Command
None of the above.
Answer: 2
9) What information is specified in the Connection tab of the DataLink
window?
1.
2.
3.
4.
Database login
Database name
Database type
All of the above.
Answer: 4
10) Which of the following is true for ADO.NET DataSet?
1.
2.
3.
4.
DataSet provides a disconnected view of a data source.
Dataset enables to store data from multiple tables and multiple sources
We can create a relationship between the tables in a DataSet.
All of the above is true
Answer: 4
11) Which file you should write for the connection string so that you can
access it in all the web pages for the same application?
1.
2.
3.
4.
In App_Data folder
In Web.config file
In MasterPage file
None of the above
Answer: 2
12) Which of the following is not a DataReader method?
1.
2.
3.
4.
NextResult
GetName
GetValue
GetDataType
Answer: 4
13) Which database is the ADO.NET SqlConnection object designed for?
1.
2.
3.
4.
Access
Microsoft SQL Server
MySQL
Oracle
Answer: 2
14) The data is stored in a Microsoft SQL Server database on a server named
Admin and the Database name is Diploma. You connect to Diploma by using
Windows authentication mode. You use a SqlConnection object to connect to
the database. Then which is the correct connection string from below?
1.
2.
3.
4.
Data Source=Admin\SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=True
Data Source=Admin/SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=True
Data Source=Admin\SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=False
All of the Above
Answer: 1
15) Choose the correct option about the Integrated Security property of the
connection object.
1.
2.
3.
4.
If Integrated Security=false then User ID and Password must be specified in the connection string.
If Integrated Security=true, then current Windows account credentials are used for authentication.
Both A and B option are correct.
None of the above.
Answer : 3
16) The first step of configuring a DataAdapter is to select:
1.
2.
3.
4.
An adapter object.
A connection object.
A database object.
A dataset object.
Answer: 2
17) To check the status of the connection, ____ property is useful
1.
2.
3.
4.
ConnectionStatus
Status
State
ConnectionState
Answer: 3
18) Which is not an ADO.NET DataAdapter Object?
1.
2.
3.
4.
OleDbDataAdapter
SQLDataAdapter
QueryDataAdapter
All of the above.
Answer: 3
19) Which type of object has the Generate Dataset method?
1.
2.
3.
4.
Adapter object
Connection object
Database object
Dataset object
Answer: 1
20) Which of the following illustrates the benefit of ADO.NET?
1.
2.
3.
4.
Interoperability
It uses DataSet to represent data in memory that can store data from multiple tables and multiple
sources.
Disconnected data access
All of above
Answer: 4
21) Which object does the data-aware control bind to?
1.
2.
3.
4.
Dataset
DataAdapter
Connection
All of the above.
Answer: 1
22) Which object contains the Position property of the current record in a
dataset?
1.
2.
3.
4.
BindingContext
BindingData
DataBinding
DataBound
Answer: 1
23) Which below is specified by the DataSource Property?
1.
2.
3.
4.
Connection object
DataAdapter object
Database field
Dataset object
Answer : 3
24) Which of the following method of the command object is best suited when
you have aggregate functions in a SELECT statement?
1.
2.
3.
4.
ExecuteScalar
ExecuteReader
ExecuteNonQuery
None
Answer: 1
25) What data type is returned when calling the ExecuteScalar method of a
command object?
1.
2.
3.
4.
System.Int32
Object
No of affected records.
None of the above.
Answer: 2
26)To perform Insert, Update and Delete Command which method is used?
1.
2.
3.
4.
ExecuteScalar
ExecuteReader
ExecuteNonQuery
None
Answer: 3
27) Which DataAdapter Query Type can be used with the Access database?
1.
Use SQL statements.
2.
3.
4.
Create a new stored procedure.
Use existing stored procedure.
All of the above.
Answer: 1
28) What is the proper code to put data into the dataset called EmployDataset
using the EmployDataAdapter object?
1.
2.
3.
4.
EmployDataset.Fill(EmployDataAdapter)
EmployDataAdapter.Fill(EmployDataset)
EmployDataset.Load(EmployDataAdapter)
EmployDataAdapter.Load(EmployDataset)
Answer: 2
29) Which of the following is the method provided by the DataSet object to
generate XML?
1.
2.
3.
4.
ReadXML
WriteXML
3.GetXML
All of the above
Answer: 4
30) The default timeout for SqlCommand.Command timeout property
1.
2.
3.
4.
10 Seconds
20 Seconds
30 Seconds
40 Seconds
Answer : 3
2. Which properties gets or sets the name of the current data set?
A. DefaultSetName
B. DefaultViewManager
C. DataSetName
D. SetName
View Answer
Ans : C
Explanation: DataSetName : Gets or sets the name of the current data set
3. ADO.NET provides a bridge between the front end controls and the
back end database.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, ADO.NET provides a bridge between the front end controls and the back
end database.
4. Which method copies the structure of the DataSet, including all
DataTable schemas, relations, and constraints?
A. EndInit
B. Clone
C. Copy
D. BeginInit
View Answer
Ans : B
Explanation: Clone : Copies the structure of the DataSet, including all DataTable schemas,
relations, and constraints. Does not copy any data.
5. Which properties Returns the parent DataSet?
A. ParentColumns
B. ParentRelations
C. ParentDataSet
D. DataSet
View Answer
Ans : D
Explanation: DataSet : Returns the parent DataSet.
6. The DataReader object is an alternative to the?
A. DataSet
B. DataAdapter
C. Both A and B
D. None of the above
View Answer
7. The main features of dotConnect for SQL Server includes ___________
A. Extra data binding capabilities
B. Ability of monitoring query execution
C. Supports the latest versions of SQL Server
D. All of the above
View Answer
Ans : D
Explanation: dotConnect for SQL Server includes base-class-based provider model,
provider factories, connection string builder, metadata schemas, asynchronous commands,
pooling enhancements, batch update support, provider-specific types, server enumeration,
database change notification support and so on.
8. Syntax for closing and opening the connection in ADO.net is
_______________
A. sqlConn.Open() and sqlConn.close()
B. sqlConn.open() and sqlConn.Close()
C. sqlConn.Open() and sqlConn.Close()
D. None of the above
View Answer
Ans : C
Explanation: The Close method rolls back any pending transactions and releases the
Connection from the SQL Server Database.
9. Which of the following is enumeration for ADO.net with SQL Server?
A. SqlInfo
B. SqlBulkCopyOptions
C. SqlNotification
D. All of the above
View Answer
Ans : B
Explanation: Bitwise flag that specifies one or more options to use with an instance of
SqlBulkCopy.
10. The goal of dotConnect for SQL Server is to enable developers to
maintain database applications
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : B
Explanation: The goal of dotConnect for SQL Server is to enable developers to write
efficient and flexible database applications. The dotConnect for SQL Server assemblies are
implemented using optimized code and advanced data access algorithms.
1. ASP stands for?
A. Active Server Pages
B. Access Server Pages
C. Active Server Platform
D. Active Server Programming
View Answer
Ans : A
Explanation: ASP stands for Active Server Pages
2. ASP (aka Classic ASP) was introduced in?
A. 1997
B. 1998
C. 1999
D. 2000
View Answer
Ans : B
Explanation: ASP (aka Classic ASP) was introduced in 1998 as Microsoft's first server side
scripting language.
3. Classic ASP pages have the file extension?
A. .aspx
B. .net
C. .asp
D. .cs
View Answer
Ans : C
Explanation: Classic ASP pages have the file extension .asp and are normally written in
VBScript.
4. Which of the following is true?
A. ASP.NET Web Forms is not a part of the new ASP.NET Core.
B. ASP.NET Web Forms is an event driven application model.
C. ASP.NET MVC is an MVC application model (Model-View-Controller).
D. All of the above
View Answer
Ans : D
Explanation: All of the above statement are true.
5. ASP.NET is?
A. client side technologies
B. server side technologies
C. Both A and B
D. None of the above
View Answer
Ans : C
Explanation: ASP and ASP.NET are server side technologies.
6. Web.config file is used
A. Configures the time that the server-side codebehind module is called
B. To store the global information and variable definitions for the application
C. To configure the web server
D. To configure the web browser
View Answer
Ans : B
Explanation: Web.config file is used to store the global information and variable definitions
for the application
7. Difference between Response.Write() andResponse.Output.Write().
A. Response.Output.Write() allows you to buffer output
B. Response.Output.Write() allows you to write formatted output
C. Response.Output.Write() allows you to flush output
D. Response.Output.Write() allows you to stream output
View Answer
Ans : B
Explanation: Response.Output.Write() allows you to write formatted output
8. What class does the ASP.NET Web Form class inherit from by default?
A. System.Web.UI.Page
B. System.Web.UI.Form
C. System.Web.GUI.Page
D. System.Web.Form
View Answer
Ans : B
Explanation: System.Web.UI.Form class the ASP.NET Web Form class inherit from by
default.
9. Attribute must be set on a validator control for the validation to work
A. ControlToValidate
B. ControlToBind
C. ValidateControl
D. Validate
View Answer
Ans : A
Explanation: Attribute must be set on a validator control for the validation to work
ControlToValidate.
10. Default Session data is stored in ASP.Net.
A. StateServer
B. Session Object
C. InProcess
D. All of the above
View Answer
Ans : C
Explanation: InProcess is default Session data is stored in ASP.Net.
1) Which protocol is used for requesting a web page in ASP.NET from the
Web Server?
1.
2.
3.
4.
HTTP
TCP
SMTP
None of the above.
2) What are the types of cookies?
1.
2.
3.
4.
Session cookies
Persistent cookies
Dummy cookies
Options A and B are correct
3) What is the fully qualified name of the base class of all server controls?
1.
2.
3.
4.
System.Web.UI.Control
System.Web.UI
System.Control
All of the above
4) Which file you should write for the connection string so that you can access
it in all the web pages for the same application?
1.
2.
3.
4.
In App_Data folder
In Web.config file
In MasterPage file
None of the above
5) What are the advantages of AJAX?
1.
2.
3.
4.
AJAX is a platform-independent technology
It provides partial-page updates
Improved performance
All of the above
6) You need to allow users to choose their own themes. In which page event
will you write the user-selected theme?
1.
2.
3.
4.
Page_Load
Page_Render
Page_PreInit
Page_PreRender
7) Which is the first event of the ASP.NET page, when the user requests a
web page?
1.
2.
3.
4.
PreLoad
Load
PreInit
Init
8) What is the name of the Page object’s property that determines if a Web
page is being requested without data being submitted to the server?
1.
2.
3.
4.
IsCallback
IsReusable
IsValid
IsPostBack
9) How will you specify the Cache Location?
1. You can use browser settings to specify where a page is cached.
2. You can use the Location attribute of the <%@ OutputCache %> directive to specify
where a page is cached.
3. You can use the Location attribute in QueryString to specify where a page is cached.
4. None of the above.
10) How many types of authentication ASP.NET supports?
1.
2.
3.
4.
Windows Authentication.
.NET Passport Authentication.
Forms Authentication.
All of the above.
Here are the correct answers:
Question 1: HTTP
Question 2: Options A and B are correct
Question 3: System.Web.UI.Control
Question 4: In Web.config file
Question 5: All of the above
Question 6: Page_PreInit
Question 7: PreInit
Question 8: IsPostBack
Question 9: You can use the Location attribute of the <%@ OutputCache %> directive to
specify where a page is cached.
Question 10: All of the above.
10) Match the following List 1 to List 2
a. Web Form -------------------------- i. .ascx
b. Web User Control ---------------- ii. .asmx
c. Web Service ---------------------- iii. .aspx
- Published on 27 Jul 15
a. a-iii, b-i, c-ii
b. a-ii , b-i, c-iii
c. a-i, b-ii, c-iii
Answer Explanation
ANSWER: a-iii, b-i, c-ii
Explanation:
No explanation is available for this question!
To create your application on a remote server which option you will choose in
ASP.NET?
- Published on 27 Jul 15
a. File System
b. FTP
c. HTTPS
d. None of the above.
Answer Explanation
ANSWER: FTP
Download