C questions for interview –

Document Sample
C questions for interview – Powered By Docstoc
					C questions for interview –

1) What do you mean when you say, “char takes 1 byte to store while integer
    takes 2 bytes”?
2) Write a structure for a linked list that is used to create a hierarchy of
    categories
3) Contrast structures with classes
4) What do you mean by the return type of function main
5) Why is main a static function
6) Where do you initialize the static variables
7) How would you explain referencing an array element syntax in terms of
    pointers
8) How are File pointers used
9) How do you pass pointers to functions
10) How can you swap 2 numbers without using a temporary variable
11) What are B-Trees, and height balanced trees (I am not sure what you call
    these trees, I think they are called AVI trees)
12) How do you relate the infix notation to stacks
13) Write the condition to find out when the queue is full
14) What is insertion sort / bubble sort
15) How is binary search conducted
16) What are binary trees
17) How do you invoke a system call
18) What is the difference between executable code and object code
19) What are directives, libraries and include files
20) What is the role of linker
21) How is error handling done in C
22) Can you write the main four statements to do multiplication of two matrices
    given that the matrices are stored in 2D arrays
23) What are register variables
24) What are bitwise operators, explain how do you add 2 numbers
25) Give an example of how to use enumerations in C
Language: C


1. What is recursion?

2. Write code for a simple link list in C using structures.

3. Write steps for adding a new node at the begging and at the end in a simple link
   list.

4. Write steps for deleting a node from a simple link list.

5. Which function is used to free the memory used by node in a link list?

6. Define a stack and a queue. What is the difference between them?

7. What is the difference between inflex notation and postfix notation of arithmetic
   expression?

8. Convert the following arithmetic expressions in to inflex notation:
   XZ – Y +
   XZY + -

9.   Convert the following arithmetic expressions in to postfix notation:
     X–(Y*6)
     (X–Y)*6

10. What is the advantage of a doubly link list over singly link list?

11. What is the value of the pointer PRIOR of the first node and the pointer NEXT of
    the last node in a doubly link list?

12. Write steps to search a node in sorted binary tree.

13. What is hashing technique? What is the main purpose of hashing?

14. Explain sequential access, random access and indexed access methods for
    accessing data on a disk.

15. Give the out put of the following program:
    int i = 0 ;
    int j = 0 ;
    for( i = 0 ; i < 50 ; i ++ ) ;
    j ++ ;
    printf ( “ i = %d j = %d ” , i , j ) ;

16. Explain enumeration constant.

17. “Function arguments can be passed by value or by reference”, explain.
1.    Why is VB not a complete OO language?
2.    What is .NET?
3.    What is structure of https header?
4.    How many types of protocols are there?
5.    Difference between TCP/IP and Datagram and which is faster?
6.    What is DSN?
7.    What are limitations of Java?
8.    DLL? What is difference between in-process and out-process DLL?
9.    Concept of signed applet
10.   How do you get digital signature (agencies)?
11.   What is EJB? Explain its architecture.
12.   Difference between Java Beans and EJBs
13.   What is client for EJBs?
14.   What is difference between JSP and Servlets?
15.   What is an applet and what are its limitations?
16.   How is session maintained?
17.   What is role of cookies in session ID and session tracking?
18.   What is RAM database?
19.   What are types of webservers available in the market?
20.   Difference between VB script and Java script (advantages)
21.   Will Java survive after .NET?
22.   What is XML?
23.   WAP/GPRS/
24.   How do you make ftp server in VB
25.   How do you make multithreaded application in VB
26.   What is multi-threading?
27.   Why is J2E n tier
28.   If servlets can do everything then why JSP since we have to code in Java Beans
      anyways?
29.   Application servers
30.   How many types of EJBs are there?
31.   What is DOM and how can you use it to load XML in Java?
32.   What is lifecycle of a servlets?
33.   What are http headers and their structure?
34.   How do you maintain sessions?
35.   What is sand box for an applet and how can it come out of sand box
36.   What are ports?
37.   What is difference between server socket and client socket?
38.   Difference between swing and AWT
39.   Why is Java Script more popular than VB Script?
40.   SIP Protocol
41.   TCP/IP Protocol
42.   Why is TCP/IP faster than UDP?
43.   Working across firewall (yahoo and msn)
44.   Concept of firewall
45.   SNMP (which port does it work on?) DMZ
46.   Difference between VB5 and VB6
47.   How to load XML doc in VB
48.   What is XML schema?
49.   Why do we have different XML schema for different industries
50.   ActiveX DLL and ActiveX EXE
51.   Explain VBA
52.   What is SOAP?
53.   What is MUTEX in multi-threaded model?
54.   What is difference between server side ASP and Client side ASP?
Questions on C

Q1.   What r the different type of data structures?
A     Stack
      Queue
      Link List      Doublly Link
                     Circular Link
                     Reverse Link
      Trees          Binary
      B-Tree

Q2.   difference bet Link List and Arrays
A     Link list can grow dynamically but the values stored r not coninous

Q3    Difference between Stack and Queue?
A     Stack is based on LIFO members are POP and Push
      Queue is based on FIFO members r Add, remove, dqueue ,etc

Q4    a small code for implementing Stack

Q5    What r binary trees and what r its usage?
A     Used If data in Binary form eg Searching

Q6    What is the purpose of B-Tree?
A     gives both sequential and random acces

Q7    How r Binary Trees implemented?
A     In 2 ways    -Pointers
                   -Arrays

Databases

Q8    How many types of normalization?
A     1nF to 5nF. Most commonly used is 3nf = bnf
      4nF and 5NF make it slow

Q9    Relationships
A     1to1, 1toM, MtoM, 2toM, Mto1

Q10   design a small database

Q11   full form of ODBC




Networking

Q12   what r 7 layers of protocol
A     P      physical
      D      Data Link
      N      Network
      T      Transport
      S      Session
      P      Presentation
      A      Application

Q13   Name email protocols

Q14   default ports for Http and ftp
A     Http
      ftp


For Computer Branch

Sorting

Q     What r different types of Sorting?
A     Bubble         for less elements(10-30)
      Quick          for medium size
      Heap           for large size
      Merge          ----do---
      Radix          for special cases
      Simple
      Mostly used r Bubble and Quick

Q     what is the order for Bubble sort
A     o(n2)
      For Quick      o(nlogn)


Searching

Q     different type of Searching
A     Linear
      Binary          needs sorted data

Q     what is the prefered sorting order for Binary search –asc or desc
A     does not matter

Algorithms

Q     Different types of Algos
A     divide and rule (mostly used)
      Dynamic program
      Back tracking – branch and mount
OS

Q       What r different thread scheduling techniques?
A       round robin
        Priority based

Q       What is dead locking
A

Q       How to resolve it


Questions on VB

     1. Why is VB not a complete OO language
     2. What is the difference between ActiveX dll and ActiveX exe
     3. Does Vb support inheritance
     4. What r different types of functions
     5. use of friend function
     6. What is the difference bet ByVal and Byref
     7. what is the default value
     8. advantages of MTS
     9. What is Option Explicit
     10. How do u make a read only property
     11. Difference between Let and Set
     12. Can v change the array bound? How
     13. From which interface is VB classes defined? (Iunknown-Idispatch)
     14. Can v make a flat dll in VB ? no
     15. can v do conditional compilation in VB? Yes

.net

Q1. What is the CLR, CTS, CLS?
Ans. Common Language Runtime, Common Type System, Common Language
Specification

Q2. What is .NET execution engine DLL name?
Ans. mscoree.dll

Q3. What is the name of .NET namespace for Windows form?
Ans System.Windows.Forms

Q4. public static int Main(string[] args)
   {
        HelloClass c1 = new HelloClass();
        ...
   }
Is there any memory leak in above program?          Ans. No

Q5. What is boxing?
Ans. Mechanism to convert value types to reference type.

Q6. what is unboxing?                 Ans. oposite of 5th

Q7. What are the delegates?
Ans= type Safe cstyle function pointer. >net delegate is a class that derives from
multicast delegate rather than a raw memory address.

Q1. What is the CLR, CTS, CLS?

Ans. Common Language Runtime, Common Type System, Common Language
Specification

Q2. What is .NET execution engine DLL name?

Ans. mscoree.dll

Q3. What is the name of .NET namespace for Windows form?

Ans System.Windows.Forms

Q4. public static int Main(string[] args)
  {
       HelloClass c1 = new HelloClass();
       ...
       ...
  }

Is there any memory leak in above program?

Ans. No

Q5. What is boxing?

Ans. Mechanism to convert between value types and reference type.
      refre Page 83

Q6. what is unboxing?

Ans. oposite of 5th

Q7. What are the delegates?

Ans. refer page 20
1. Your application contains the following class named Class1 with a
  property named MyProperty. You run the following code :

       Dim A as Class1
       Dim B as New Class1
       B.MyProperty = 3
       Set A = New Class1

  How many instances of Class1 exists after you run this code.
  A) 0
  B) 1
  C) 2 (*)
  D) 3

2. You have created a class. You want other members of your project to access it.
  You want them to access it like an app object. How do you set the instancing.
  A) Globalmultiuse
  B) multiuse
  C) publicnotcreatable
  D) Private

3. To handle the events raised by an object that raises events , which keyword
  is used to decalre the object of that class.
  A) CatchEvents
  B) WithEvents
  C) Events
  D) TrapEvents

4. what will happen when the following code is executed.

  Private Sub Form_Load()
        Dim lCount        as long
     dim sCompany         as String

       lCount = 10
       sCompany = "Newgen" & lCount
       Unload me
  End Sub

  A) Complile time error
  B) Run time error
  C) None of the above

5.

  Public Sub IncementIt( lTest as long)
       lTest =lTest + 1
  End Sub
 What will be the output

6. What will be the output when the following code is executed

 Dim bTest                   as boolean

 If bTest Then
       Msgbox "Hello"
 Else
       Msgbox "Bye"
 End If

 bTest = Not bTest & Test
 If bTest Then
       Msgbox "Dear"
 Else
       Msgbox "Enemy"
 End If

 A) Two messgae box with message "Hello" then "Dear".
 B) Two messgae box with message "Hello" then "Enemy".
 C) Two messgae box with message "Bye" then "Dear".
 D) Two messgae box with message "Bye" then "Enemy".

7. about variant

 Dim GuessWhat
 GuessWhat = 10


 End If

8. You want to provide feedback to users on the progess of a lenghty operation.
  Which one of the following is an advantage of using a StatusBar control
  instead of a Progressbar control.
  A) A StatusBar control can display proces information in a graphical fomrat
    whereas a Progressbar control cannot.
  B) A Statusbar control can display different text messages about an operation
    whereas a Progressbar control cannot. (
*)
  C) A StatusBar control can be placed on any form whereas a Progressbar control
    can only be placed on an MDI form
  D) A StatusBar control can consist of sixteen seperate Panel objects whereas
    a ProgressBar control can only consist of four Panel Objects.

9. Which of the following can be exposed by an ActiveX document.
  A) Events (*)
  B) Methods (*)
  C) Properties (*)
  D) USer Controls
10. You want to pass a BSTR to a DLL procedure that expects an LPSTR as an
  argument. How must you pass the BSTR ?
  A) By Reference.
  B) By Value (*)
  C) By Address
  D) By Pointer

11. Using the AddressOf operator , you want to pass the address of a procedure
  to a windows API function. How must the argument in the windows API function
  be declared in order to use the AddressOf operator ?
  A) As Any
  B) As Byte
  C) As Long (*)
  D) As String

12. Anil creates a control array that contains four instances of a control named
  ControlA at design time. During execution of the form containing this array
  , five more instances of this ControlA are created. Which instances of
  ControlA can be unloaded if Anil excutes the unload statement in the
  immediate window ?
  A) Only the first instance of ControlA.
  B) Only the last instance of ControlA.
  C) only the five run-time instances of ControlA. (*)
  D) All instances of ControlA

13. What is the purpose ofd the following Visual Basic statment
        Implements Thing1.Thing2
  A) It will allow your application to create objects of the Thing1 class
    as defined in the Thing2 type library.
  B) It will allow your application to create objects of the Thing2 class
    as defined in the Thing1 type library. (*)
  C) It will allow your application to expose the Thing2 method of the
    Thing1 object.
  D) It will allow your application to expose the Thing1 method of the
    Thing2 object.

14. You have a procedure that is normally called with four arguments.
  Occassionally , you want to pass a fifth argument to the procedure.
  Which Visual Basic keyword will enable you to declare the procedure so that
  it can be called with either four or five arguments. ?
  A) AddArg
  B) ExtendArg
  C) Additional
  D) Optional (*)

15. Which statment best describes the scope of a public object created in a
  standard module named Global.bas
  A) It can only be accessed from within Global.bas.
  B) It can only be accessed from within the application containing Global.bas (*)
  C) It can only be accessed from any application that has a run-time reference of
Global.bas.
  D) It can only be accessed from within the application containing Global.bas
   and from in-process applications.

16. Which property procedure is used to create a read-only property ?
  A) Property Get (*)
  B) Property Set
  C) Property Let
  A) Property Read

17. You are given the following Visual Basic Subroutine :
  Sub test()
       Dim Total             as Integer
       Dim W                 as Integer
       Dim X                 as Integer
       Dim Y                 as Integer
       Dim Z                 as Integer

       X=1
       Y=1
       Z=1
       For W = 1 To 3
             X = X +1
       Next W

       Do while Y < 3
             Y=Y+1
       Loop

       Do Until Z <=4
             Z = Z +1
       Loop

      Total = W + X + Y + Z
  End Sub

  What is the value of Total when this subroutine is finished executing ?
  A) 11
  B) 12 (*)
  C) 13
  D) 16

18. You want the execution of your code to halt when a variable changes.
  Which tool provides the simplest way to accomplish this ??
  A) The Immediate Window
  B) The Locals Window
  C) The Properties Window
  D) The Watch Window (*)
19. Procedure 1 in your application has error-handling code containing the
  statement Resume Next and Procedure2 contains no error-handling code.
  What will happen if Procedure1 calls Procedure2 and Procedure2 raises an error ?
  A) The error is not trapped because Procedure2 contains no error handling
    code
  B) The error handling code in procedure1 is invoked and the call to
    Procedure2 is re-executed.
  C) The error handling code in Procedure1 is invoked and the line in the
    procedure1 following the call to Procedure2 is executed.
  D) The error handling code in Procedure1 is invoked and the line in
    Procedure2 following the error is executed.

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:4
posted:1/8/2012
language:
pages:12
jianghongl jianghongl http://
About