latest Post

497 C# Single line interview Questions Part - 4

400) What is finally block? Finally block will be executed automatically and compulsorily even though an exception is raised or not.

  401) Is it compulsory to write finally block? No. finally block is an optional block.

 402) What are the types of error messages? Catch block generates an error message when exception occurred. They are of two types. i) User defined messages: user can write his own messages. ii) System defined messages: system provides the description of the error.

403) In which namespace the Exception classes are available? “System.Exception” is the namespace.

 404) What is the use of file stream class? File stream classes are used for write or read the content of the file.
 405) How a file stream acts? File stream acts as a pointer for the file which contains the memory address of the file on the disk.

  406) What are the types of file stream classes? There are two types of file streams. i) Reading Streams. ii) Writing Streams

. 407) Which namespace is required for reading the content of the file? “System.IO.StreamReader” is the namespace.

 408) Which namespace is required for writing the content of the file? “System.IO.StreamWriter”  is the namespace.

409) Write the process for reading the content from the file? i) Import the API Eg: using System.IO; ii) Create the StreamReader class object. Eg: StreamReader sr = new StreamReader (“filename”); iii) Read the content. Eg: sr.ReadToEnd( ); iv) Close the reader. Eg: sr.Close( );

 410) What is the use of FileInfo class? FileInfo class provides the operations like checking the file existence,get the file details like file size, file attributes, created date, modified date, last accessed date etc.

 411) Write the syntax for creating FileInfo class object? FileInfo obj=new FileInfo(“path of the file”);

412) Which property of FileInfo class is used for checking the file existence? “Exists” is property used for checking the file existence.

413) Write the process for writing content to the file? i) Import the API Eg: using System.IO; ii) Create a StreamWriter class Object Eg: StreamWriter sw = new StreamWriter(“file path”); iii) Write the content. Eg: sw.Write(“content of the file”); iv) Close the writer. Eg: sw.Close( );

414) What is XMLTextWriter class? XMLTextWriter class is used to write only XML files. Its just like a StreamWriter class.

415) In which namespace XMLTextWriter class is available? “System.Xml” is the namespace.

 416) Write the methods of XMLTextWriter class? i) WriteStartDocument( ) , it generates like <?xml version=1.0 encoding=utf-8?> ii) WriteStartElement(Element) , it is used for generate root element and parent elements. iii) WriteElementString(Element,Value) ,it is used for generate child elements. iv) WriteEndElement( )  v) WriteEndDocument( )

 417) What is the use of XmlDocument? “XmlDocument” is a class used to store the XML data for a temporary purpose.

 418) Which method is used for loading a XML file into XmlDocument? “Load ( )” is the method

 419) Which method is used for creating a XML element in XmlDocument? “CreateElement( )” is the method.

420) Which method is used for add the values into a XmlElement? “InnerText( )” is the method.

421) Which method is used for appending the XmlElement to Root Element? “AppendChild(elementName)” is the method.

422) What are the DOM objects? DOM objects are  i) XmlNodeList ii) XmlNode

 423) What is Crystal Reports? Crystal Reports is known as a reporting tool. This is used for development of database reports in the projects.

424) What is the extension of a report file? The extension of the report file is “.rpt”.

 425) Into which format a report file is to be exported? The report file can be exported into the formats like excel, word, xml, pdf and etc.

426) Which company developed the Crystal Reports? Seagate Corporation was developed the crystal reports.

 427) What are the sections of a report? Every report has 5 sections. They are i) ReportHeader ii) PageHeader
iii) Details iv) ReportFooter v) PageFooter

 428) What is deployment? After developing the code, you have to generate a setup program and give it to the client instead of giving all source code. The process of generating setup file is known as deployment.

 429) How can you deploy your project? Using the following steps you can deploy your project, i) Go to “Build” menu ii) Click on “Publish ProjectName1” iii) Specify the location where you want to save the .exe file iv) Click on next button v) Click on next button vi) Click on finish button

430) What are types of applications? i) Homogeneous applications ii) Heterogeneous applications

 431) What are homogeneous applications? Applications developed using same programming

language or technologies are known as homogeneous applications. It’s possible to communicate with each other.

432) What are heterogeneous applications? Applications developed using different programming languages or technologies are known as heterogeneous applications. It’s not possible to communicate with each other directly.

433) Write about Service Oriented Architecture (SOA) Programming? SOA Programming provides the communication among heterogeneous applications. SOA programming is followed by all the companies then Open Standard Message Format can be used to communicate with application developed in any technology.

 434) What is a message? A message is the self contained block of data i.e. to be transferred b/w two heterogeneous applications with open standard format. 435) Write some programming tools for SOA programming? i) Remoting ii) Web Services iii) WCF iv) TIBCO v) Web Methods vi) MSMQ vii) RMI viii) CORBA

 436) What is remoting? Remoting is a distributed technology. Using remoting we can distribute application features through channels. In remoting we have to implement i) Class library ii) Server application iii) Client application

437) What are the namespaces required for implement the server application and Client application? i) System.Runtime.Remoting ii) System.Runtime.Remoting.Channels iii) System.Runtime.Remoting.Channels.Tcp iv) User defined namespace (class library)

438) What the base classes inherited by a server application? i) MarshalByRefObject ii) User defined interface

439) What is the use of MarshalByRefObject class? Using MarshalByRefObject , we can perform marshalling and demarshalling.

440) What is marshalling? By default C# is giving Object format data. The object format data does
not communicate through channels. So object format data converts into Byte format. This conversion is called as Marshalling. Reverse of marshalling is known as demarshalling.

 441) What is the use of TcpServerChannel class? Using this class you can create the communication way b/w server application to the client application. Every channel represents a unique port.

 442) What is the default port supported by windows applications? 9040 is the default port.

 443) What is the use of ChannelServices class? Using this class you can register the created channel in the server machine.

 444) What is the use of RemotingConfiguration class? RemotingConfiguration class sends the information from server application to client application. But object format data does not communicate with protocols so this class converts the data from object to byte format. After that byte format data transfer through “WellKnownObjectMode”.

445) What are the constant values of WellKnownObjectMode? WellKnownObjectMode having two constant values i) SingleCall ii) SingleTon

446) What is SingleCall? In this constant values, each and every request creating one new object. Via the new object transfer the information.

 447) What is SingleTon? In this constant value, first request creating one object and second request onwards using same object memory.

 448) What is Activator class? Using Activator class, we are calling remote methods from client application to server application.

449) What is the use of RegisterChannel( ) method? It is a method of ChannelServices class. Using this method you can register the created channel.

450) What is the use of GetObject( ) method? It is a method of Activator class. Using this you can calls the remote methods of server application from client application.

 451) What is a web service? Web service is one of the distributed technologies. Every web service is having a service class.

 452) What is a service class? A service class is a class is having collection of web methods. 453) What is SOAP? SOAP is stands for Simple Object Access Protocol. SOAP is completely open standard format in the form of XML. SOAP is a communication protocol and can be set as HTTP + XML.

454) Which company develops SOAP? SOAP was developed in the year 1998 by Microsoft and IBM together.

 455) Is SOAP language independent or not? SOAP is language independent i.e. any programming language or technology can understand the SOAP format. 456) Is SOAP platform independent or not? Yes. SOAP is platform independent.

 457) What is SOAP envelope? SOAP transfers the data in the form of envelope called SOAP envelope.

 458) What are the parts of SOAP envelope? SOAP envelope contains three parts i) SOAPHeader ii) SOAPBody iii) SOAPFault or SOAPError

 459) What is a SOAPHeader contains? SOAPHeader contains application’s specific information.

 460) What is a SOAPBody contains? SOAPBody contains the original data i.e. to be transferred from one application to other.

461) What is a SOAPFault contains? SOAPFault contains any kind of errors that may occur while transferring the data.

462) Is it necessary to write SOAPHeader and SOAPFault within the envelope? No. writing SOAPHeader and SOAPFault is optional within envelope.

 463) What are WCF services? WCF Services technology enables cross platform integration by using HTTP, XML and SOAP for communication. WCF Services are industry standards to expose application functionality on the internet. They are independent of programming language, platform and device.

464) What is generated by WCF Services? WCF Service generates end point.

465) In which format of end point available? The end point is available in ABC format. A – Address B – Binding C -- Contracts

 466) What is Address in end point format? Address specifies where the service is located.

 467) What is binding in end point format? Binding specifies how to interact with service.

468) What are the types of Binding? i) TCP Binding ii) HTTP Binding

469) What is Contract in end point format? Contract specifies which features are available in the service.

 470) What are the WCF Contracts? i) Service contract ii) Operation Contract iii) Data Contract iv) Message Contract v) Fault Contract
    

471) What is Service Contract? The service contract specifies which classes are available in the service and which classes are exposed to others.

 472) What is Operation contract? The operation contract specifies which methods are available in the service and which methods are exposed to others.

473) Is a WCF services support any GUI features? No. WCF service does not support any GUI features.

 474) What are the files you get when you open a WCF service? Whenever you open a WCF service, you are getting two files i) An interface “IService1.cs” ii) A class “Service.svc”

 475) What is DataContract? DataContract is serializes the class and exposes it to the client. You can use Serializable instead of DataContract also.

 476) Which is fast, DataContract or Serializable? Compare to Serializable , DataContract is very fast.

477) What is the extension of ADO.NET entity data model template file? “.edmx” is the extension.

478) Is it possible to combine more than one table data in the view or page using entity frame work? Yes. It is possible to combine the data from more than one table in your view or page.

479) What is the name of the entity data model form? The name of the entity data model form will be the combination of database name what you used and “entities”. For example, if you use “MyDb” database then your entity data model form named as “MyDbEntities”.

480) What is a Queue? Queue is a generic FIFO (First In First Out) collection class that is present in System.Collections.Generic namespace.

 481) What is the syntax of Queue? Queue<Type>  objectName = new Queue<Type> ( );

482) How can you insert the elements into a queue? Using “Enqueue ( )” is the method used for inserting the elements into the queue.

 483) How can you remove and returns the elements of the queue? Using “Dequeue ( )” is the method used for removing and returning the elements of queue

. 484) Is it possible to first remove last inserted element in the queue? No. It is not possible; you can remove the first inserted element first only
.
485) What is a Stack? Stack is a generic LIFO (Last In First Out) collection class that is present in System.Collections.Generic namespace.

 486) What is the syntax of a Stack? Stack <Type> objectName = new Stack <Type>( );

 487) How can you insert the data into a stack? Using Push ( ) is the method for inserting the elements into a stack.

 488) How can you remove and returns the element in the stack? Using Pop ( ) is the method used for removing and returning the elements in the stack.

 489) Is is possible to first remove the first inserted element in the stack? No. Its not possible to first remove the first inserted element. Always remove the elements from last inserted element to first inserted elements.

490) What is the use of Peek ( )? Peek ( )  method returns the element of queue or stack without removing it.

491) What are generics? Generics are known as general data types. Using generics we will write  i) Generic functions ii) Generic classes

492) In which framework of .NET , the generics are introduced? The generics are introduced in .NET framework version  2.0.

493) In which namespace, the generic classes are available? ‘System.Collections.Generics” and “System.Collections.ObjectModel” are the namespaces.

 494) Using which you can implement the generics? You can implement the generics with classes, structures, interfaces, methods, events and delegates.

 495) What are advantages of generic classes? i) Maximize code reusability ii) Type safety iii) Performance iv) Avoids the function overloading.

 496) What are things used to work with generics? To work with generics, you should use two things. They are i) Place holder, represented by  < > ii) Type parameter. always type parameter should be enclosed within the placeholder like <typePrameter>

497) What is a SqlHelper? SqlHelper is a predefined class. This class provides a set of predefined methods. Using those methods you can perform insert, update, delete and select operations.

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment