2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
31st December 2016, 05:19 PM
Super Moderator
 
Join Date: Mar 2013
Re: Kuvempu University BSC IT Sample Papers

Well below I have given you the Kuvempu University 6th SEM sample paper for the basics of .NET you can have a look


Kuvempu University 6th SEM Sample Paper

BASICS OF .NET

Long question answer

1. What is .NET frame work? Explain.

Ans:- The .NET framework is one of the tool provided by Microsoft corporation. This is a software framework that includes everything required for developing software for web services. The .NET platform provides a new environment for creating and running robust, scalable and distributed application over the web. It is designed to make significant improvements in code reuse, code specialization, resource management, and Multilanguage development.

It consists of three services:–

a).NET Product: It consists of Visual Studio .NET, Visual Basic, Visual C#, and Visual C++.

b) .NET Services: .NET helps you to create software as a web services. Microsoft has its own set of web services called My Services.

c) .NET framework: It is a foundation on which you design, develop, and deploy applications. It is consistent and simplified programming model that helps you to easily build robust application.

.Net framework has several components such as Window form, Console application, Web forms and web services, Base class library and Common language runtime.

2. What are the advantages of using .NET frame work?

Ans: Following are the main advantages of .NET framework:–

Consistent programming model:- It provide a common object-oriented programming model across languages. This object model can be used to perform several tasks such as reading from and writing to file, connecting to databases, and retrieving data.
Multi-platform application:- A .NET application can execute on any architecture or environment that is supported by the CLR.
Multi-language integration:- .NET allow multiple language to be integrated. We can create a object in any language that is derived from a class implemented in any other languages. To enable objects to interact with each other a set of language features has been defined in CLS. CLS enhances language interoperability.
Automatic resource management:– CLR is a important component of .NET framework. It manages all resources such as file, memory, network connection, and database resources automatically without writing the code.
Ease of development:– .NET applications can be deployed simply by copying files to the target computer. The .NET framework provides zero-impact deployment means that installation of new applications or components does not have an adverse effect on the existing applications.
Web services:- With the advent of .NET technology, web services provide many built in Base Class Library facility which open up a whole world of information for the users. Web services provide everything from basic text news information to vital database or application information.

3. How does string handle in C# ? Explain.

Ans: String is a sequence of characters. It is the easiest way to represent a sequence of characters in C#. In C# string is uses to create a string type objects. It is an alias to the System.String type. String type is immutable means that once it has been created, a string cannot be changed. No modification in the string will take place. Ex: Insert () method of string class



using System;

class str {

public static void Main() {

string s1 = “Lean”;

string s2 = s1.Insert ( 3, “r”);

string s3 = s1.Insert (5, “er”);

for (int I =0; i>s3.Length; i++ ) {

Console.Write(s3[i]);

Console.WriteLine();

}}



4. Explain working of switch statement.

Ans: A switch statement executes the statements that are associated with the value of a given expression. It checks the values of a given variable against a list of case values and when a match is found, a block of statements associated with that case is executed.

Following example demonstrate the working of switch statement:



using System;

class CityGuide {

public static void Main() {

Console.WriteLine(“ Select your choice”);

Console.WriteLine(“ London”);

Console.WriteLine(“ Bombay”);

Console.WriteLine(“ Paris”);

Console.WriteLine(“ Type your choice”);

String name = Console.ReadLine();

switch (name) {

case “Bombay”:

Console.WriteLine(“ Bombay: guide 5”);

break;

case “London”:

Console.WriteLine(“ London: guide 10”);

break;

case “Paris”:

Console.WriteLine(“ Paris: guide 12”);

break;

default:

Console.WriteLine(“ Invalid choice”);

break;

}}}

Kuvempu University BSC IT Sample Papers



5. Write an ASP. NET program to demonstrate handling of server control events.

Ans: Server control is capable of exposing an object model containing properties, methods and events in ASP.NET. Developers use this object model to cleanly modify and interact with the page.

Following program shows the handling of server control event:-










Name:

Category:

Math

English

Science





6. Compare the features of C++ with C# programming.

Ans: i) C++ support object-oriented programming while C# is purely object-oriented language.

ii) The syntax for declaring array follows the token ’[]’ in C# which is different from C++.

iii) There is no conversion between the bool type and int in C#.

iv) In C#, the long data type is 64 bits, while in C++, it is 32 bits.

v) C# supports additional operator such as is and typeof while C++ doesn’t supports them.

vi)C# strings are different from C++ string.

vii) In C# Main method is declared differently from the main function in C++.

viii) Like C++, no header files or #include directives in C#.

ix) Operator overloading is performed differently in C# from C++.

x) Unlike C++, if you don’t provide a class constructor in C#, a default constructor is automatically generated for.



7. Explain how to use multiple threads in program with example.

Ans: Following code shows the use of multithread in program:-



using System;

using System.Threading;

class threads {

public static void ChildThread1() {

Console.WriteLine(“This is child thread”);

Console.WriteLine(“child thread- counting from 1to 5”);

for (int T=1; T

for (int Cnt=0; Cnt

Console.Write(“.”); }

Console.Write(“{0}”, T); }

Console.WriteLine(“child thread ending”); }

Public static void ChildThread2() {

Console.WriteLine(“This is child thread2”);

Console.WriteLine(“child thread2- counting from 6 to 10”);

for (int T=6; T

for (int Cnt=0; Cnt

Console.Write(“.”); }

Console.Write( “{0}”, T); }

Console.WriteLine(“child thread2 ending”); }

Public static void Main() {

ThreadStart Child1 = new ThreadStart (ChildThread1);

ThreadStart Child2 = new ThreadStart (ChildThread2);

Console.WriteLine(“This is creating child thread”);

Thread Thread1 = new Thread(Child1);

Thread Thread2 = new Thread(Child2);

Thread1.Start();

Thread2.Start(); }}



8. What are the advantages of using multiple threads in program?

Ans: Threads are the basic unit to which an operating system allocates processor time, and more than one thread can run inside that process. Each thread maintains exception handlers, a scheduling priority, and a set of structures the system uses to save the thread context until it is scheduled.

Multithreading offers the following advantages:

i)Improved responsiveness: If the application is performing operations that take a perceivably long time to complete, these operations can be put into a separate thread which will allow the application to continue to be responsive to the user.

ii) Faster application: Multiple threads can lead to improved application performance. For example, if there are a number of calculations to be performed, then there the application can be made faster by performing multiple operations at the same time.

iii) Prioritization: Threads can be assigned a priority which would allow higher priority tasks to take precedence over lower priority tasks.

iv) It communicates over a network, to a web server and to a database.

9. a) Explain exception handling techniques.

Ans: An exception is any error condition or unexpected behavior encountered by a program in execution. Exception can be raised because of fault in our code or shared library.

Exceptions are handled by a try statement. When an exception occurs, the system searched for the nearest catch block that can handle the exception. Once a matching catch block is found the control is transferred to the first statement of the catch block and the catch block executes. If no matching catch block is found, then the execution of the thread is terminated. Some exception objects are- System.AirthmeticException, System.DivideByZeroException.

10. Write a program in C # to display ‘Welcome to World of C sharp’ Explain the program?

Ans:- using System;

namespace Welcome

{

class Hello

{

public static void Main()

{

Console.WriteLine(“Welcome to the world of C Sharp”); }}}

11. Explain how to create user defined exceptions with an example.

Ans: User defined exception classes are derived from the ApplicationException class. Following code creates a user defined exception named CountIsZeroException.



using System;

namespace UDExc {

class CountZero {

public static void Main(string[] args) {

Calcute calc = new Calcute();

Try {

Calc.DoAverage(); }

Catch (CountIsZeroException e) {

Console.WriteLine(“CountIsZeroException: {0}”,e.Message); }

Console.ReadLine(); }}}

Public class CountIsZeroException: ApplicationException {

Public class CountIsZeroException(string message) : base (message) { }}

Public class Calculate {

Int sum = 0;

Int count = 0;

Float average;

Public void Doaverage() {

If (count === 0)

Throw (new CountIsZeroException(“zero count in average”) );

Else average = sum/count; }}


Quick Reply
Your Username: Click here to log in

Message:
Options




All times are GMT +5. The time now is 06:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4