Saturday, 6 August 2016

July, 2010 M4.1-R4: APPLICATION OF .NET TECHNOLOGY

July, 2010
M4.1-R4: APPLICATION OF .NET TECHNOLOGY

NOTE:
1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and
PART TWO contains FIVE questions.
2. PART ONE is to be answered in the TEAR-OFF ANSWER SHEET only, attached to the
question paper, as per the instructions contained therein. PART ONE is NOT to be answered in
the answer book.
3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be
supplied at the table when the answer sheet for PART ONE is returned. However, candidates,
who complete PART ONE earlier than one hour, can collect the answer book for PART TWO
immediately after handing over the answer sheet for PART ONE.
TOTAL TIME: 3 HOURS TOTAL MARKS: 100
(PART ONE – 40; PART TWO – 60)

PART ONE
(Answer all the questions)

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “tear-off” answer sheet attached to the question paper, following instructions therein. (1x10)

1.1 In C#, a statement “a ? b : c” means
A) If a is true, returns the value of b, otherwise c
B) If b is true, returns the value of a, otherwise c
C) If a is true, returns the value of c, otherwise b
D) If c is true, returns the value of b, otherwise a

1.2 In C#, a statement “a ?? b” means
A) If a is null and b is null, returns a
B) If a is null, returns a, otherwise returns b
C) If a is null, returns b, otherwise returns a
D) None of the above


1.3 In C# and VB.Net can you store multiple data types in System.Array?
A) No
B) Yes
C) Can’t say
D) None of the above
1.4 What is the role of the DataReader class in ADO.NET connections?
A) It does not return a dataset from the data source when the command is executed
B) It only can return a read-only dataset from the data source when the command is executed
C) It does both, store and return a read-only dataset from the data source when the command is
executed
D) None of the above

1.5 What are the ways to deploy an assembly?
A) A MSI installer
B) A CAB archive
C) A XCOPY command
D) All of the above

1.6 If a method is marked as “protected internal” who can access it?
A) Classes that are both in the same assembly and derived from the declaring class.
B) Only methods that are in the same class as the method in question.
C) Internal methods can only be called using reflection.
D) Classes within the same assembly and classes derived from the declaring class.

1.7 What is boxing?
A) Encapsulating an object in a value type.
B) Encapsulating a copy of an object in a value type.
C) Encapsulating a copy of a value type in an object.
D) Encapsulating a value type in an object.

1.8 What is a delegate?
A) A delegate is an object that represents a method and a strongly typed function pointer.
B) A light weight thread or process that can call a single method.
C) A reference to an object in a different process.
D) An inter-process message channel.

1.9 Which design pattern is shown below?
public class X
{
private X instance;
private X() {
}
Public static X Instance {
get
{
if ( X == null )
X = new X();
return instance;
}
}
}
A) Factory
B) Abstract Factory
C) Singleton
D) Builder

1.10 Which of the following operations you can NOT perform on an ADO.NET Data set?
A) A Data Set can be synchronized with the database.
B) A Data Set can be synchronized with a Record Set.
C) A Data Set can be converted to XML.
D) You can infer the schema from a Data Set.

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1x10)

2.1 A compiler switch “/text” creates an xml file from the xml comments in the files in an assembly.
2.2 In C#, following three assignment statements are equivalent.
month = month +1;
month + = 1;
month ++;
2.3 In ASP.Net fragment caching refers to the caching of individual user controls within a web Form.
2.4 A stack is a LIFO (Last In - First Out) collection. Only the last item is accessible at any time, and
items can only be put at the top.
2.5 A list is a static array which does not resize itself as needed if more data is inserted than it can
hold at the time of insertion.
2.6 Debugging tools CorDBG – command-line debugger, and DbgCLR – graphic debugger, come
with the .NET SDK. To use CorDBG, one must compile the original C# file using the “/debug”
switch.
2.7 All .NET languages have the same primitive data types. For example an int in C# is the same
as an int in VB.NET.
2.8 In VB.NET programming language, the default size of Integer data type is 16 bits.
2.9 As XML is case-sensitive, so <Student> and <student> are different elements.
2.10 The operator “+ =” can be used to write an event to the delegate.
3. Match words and phrases in column X with the closest related meaning/
word(s)/phrase(s) in column Y. Enter your selection in the “tear-off” answer sheet
attached to the question paper, following instructions therein. (1x10)

                                             X                                                     Y

3.1 ADO.NET is the primary data access API                A. “ // ”
3.2 Operator “= =”                                                          B. “al.exe”
3.3 Single Line Comments                                             C. Relational Operator
3.4 Assembly Generation Utility                                    D. .NET framework
3.5 XML Schema definition tool                                    E. “xsd.exe”
3.6 Assembly                                                                  F. Logical Operator
3.7 Operator “&&”                                                        G. “System.data.dll”
3.8 System Namespace                                                  H. System.Data.Common
3.9 Class for communication with the data source         I. ODBC
3.10 The number of elements the ArrayList                  J. ObjectSpace
can hold
                                                                                      K. System.Data.OleDb
                                                                                      L. object
                                                                                      M. Size
                                                                                      N. Capacity
                                                                                   O. “csc.exe”

4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “tear-off” answer sheet attached to the question paper,following instructions therein. (1x10)

A. http                            B. break & continue                                 C. interfaces
D. object class               E. NameSpaces                                         F. FIFO
G. .Net Runtime            H. .Net application                                    I. memory
J. removes                     K. object                                                    L. end
M. all N. continue          O. XML                                                    P. binary
 Q. ADO.NET               R. OledbConnection                                 S. hardware T. first time

4.1 A queue is a ________ collection and only the first item is accessible at any time, and any item
can only be put to the end of the queue.
4.2 Record set cannot be transmitted on ________.
4.3 MSIL (Microsoft Intermediate Language) Code is ________ independent.
4.4 Sole purpose of using ________ is to prevent name conflicts and resolves any ambiguity for the
C# compiler.
4.5 Use ________ in C# loops to change the normal execution path.
4.6 Structures (struct) in C# can only inherit (or implement) ________.
4.7 In C# (and the .Net Framework) all the types (classes, structures, and interfaces) are implicitly
inherited from the ________ defined in the System NameSpace.
4.8 Garbage Collection in .Net in invoked by the ________ at regular intervals using
System.GC.Collect ( ) method and removes the dirty objects from the memory.
4.9 ASP.NET is a part of the framework for developing ________.
4.10 ADO.NET and .NET data providers make connection pooling mostly transparent to developers
and ________ establishes a link with a data source via an OLE DB provider.

PART TWO
(Answer any FOUR Questions)

5.
a) What is ADO.NET?
b) Explain, how “while” and “Do….While” loop operates?”
c) Analyze the following code and give answer:
using system;
public static void Main ( )
{
// declaring and initializing an array of type integer
int [ ] integers = {8, 6, 2, 15, 43, 7};
// iterating through the arry and printing each element
For ( int i = 0; i<5; i++)
{
integers [i] = 2 * integer [i+1] + 5;
Console.WriteLine ( integers [ ] );
}
}
i) Is Console.WriteLine( ) a method or a class ? If WriteLine( ) is a method, then specify its
type and the class to which it belongs. If WriteLine( ) is a class, then explain, why it is a
class?
ii) Operator “ [ ] ” is known as which operator in C#?
iii) Give the output of the above code.
(3+6+6)

6.
a) Give the output of the following code with justification.
using system;
public class DoWorkTest
{
public static void Main ( )
{
// declaring and initializing of type integer
int p = 3;
DoWork (p) ;
console.WriteLine ( “ The value of p is ” + p );
// printing the value of p
}
public static void DoWork ( int i)
{
i++;
}
}
b) What is ID selector in ASP.Net?
c) i) How to declare and initialize a variable in one statement using C# syntax?
ii) How do you use CSS file in ASP.Net?
M4.1-R4 (New) Page 6 of 7 July, 2010
d) The following code snippet adds a new record to the in-memory database. Assume ‘da’ to be
the SqlDataAdapter reference, ‘ds’ to be the Dataset reference and ‘dt’ to be the Data Table
reference. Add the missing statement to the code.
DataRow r;
r=dt.NewRow();
r(0)=accno;
r(1)=accname;
r(2)=balance;
// Add missing statement here
da.Update(ds, “acc”);
(3+5+4+3)

7.
a) How to use ADO.NET with datasets? Explain with examples
b) i) Explain the purpose of “break” statement in the following code.
using system;
public class BreakTest
{
For (int i=1; i<=10; i++)
{
if ( i < 5 )
{
break;
}
Console.writeLine (“in the loop, value of i is {0}.”, i);
}
}
ii) Give the output of the following code.
using system;
public class ContinueTest
{
For (int i=1; i<=10; i++)
{
if ( i = = 5 )
{
continue;
}
Console.writeLine (“in the loop, value of i is {0}.”, i);
}
}
c) Write a program using VB.Net programming syntax to test whether two given strings are
equal.
(6+4+5)

8.
a) i) What is the basic difference between Dataset.Clone and Dataset.Copy?
ii) What is the difference between Clear ( ) method and Remove (object) of the ArrayList
class?
M4.1-R4 (New) Page 7 of 7 July, 2010
b) Write short notes (on any two) of the following:
i) .NET Framework
ii) Exception hierarchy in the .Net Framework
iii) Using ADO.NET without using datasets
(5+[2x5])
9.
a) Briefly explain the fundamentals of connection pooling?
b) What is method overloading? Explain with proper example.
c) Identify and explain the error in the following code.
using system;
public class ForTest
{
For (int i=1; i<=10; i++)
{
Console.writeLine (“in the loop, value of i is {0}.”,i);
}
i+ +; // line1
}
(5+6+4)

Next Set