Wednesday 31 July 2013

MCQ on OSI Model in networking

 MCQ

OSI MODEL

Q.1) The Internet model consist of -----------  layer 

Ans ...            Five.

Q.2)  which of the following is an application layer service ..

A) mail system
B) File Transfer
C) Remote Log In 
D) All of them

Ans .......     D

Q.3) When a host on n/w A send a message to the host on n/w B which address does the router look at ?

Ans ...       Logical


Q.4 )   IPV6 has ........  bit address ?

Ans ........     128

Q.5) ICMPv6   includes .............

Ans .........   IGMP     and ARP

Q.6)  ............. is a process-to-process protocol that adds only port addresses, checksum error control, and length information to the data from the upper layer.

Ans ..........     UDP

Q.7)  The ________ address, also known as the link address, is the address of a node as defined by its LAN or WAN.

Ans .....     physical

Q.8)   Ethernet uses a ______ physical address that is imprinted on the network interface card (NIC).

Ans .....      6 byte

Q.9)   A port address in TCP/IP is ______ bits long.

Ans ....   16

Q.10)  The TCP/IP _______ layer is equivalent to the combined session, presentation, and application layers of the OSI model.

Ans ...........   Application

 

Q.11)   The ____ address uniquely defines a host on the Internet.

Ans ......    IP

Q.12)  The_____ address identifies a process on a host. 

Ans .....    port

Q.13)  Routers operate at which layer of the OSI Model?

Ans ...  Network

Q.14) Which of the following operates at the Presentation layer?

Ans .....  MIDI & JPEG

Q.15)   Which of the following are Transport layer protocols?

Ans .....     TCP  and UDP

Q.16)  Flow Control take place at which layer ?

Ans ....   Transport

Q.17)  Repeaters & hubs operate at whaich layer?

Ans .....    Physical 

Q.18)  Bit synchronization is handled at which layer of the OSI Model?

Ans ..... Session

Q.19)   Bridges operate at which layer of the OSI Model?

Ans .........Network

Q.20) What are the sublayers of the Data Link layer?

Ans ....   MAC   and LLC

Q.21)  Which layer is responsible for packet sequencing, acknowledgements, & requests for retransmission?

Ans ....   Transport

Q.22) Which layer translates between physical & logical addresses?

Ans ....   Network

Monday 8 July 2013

ARRAY EXAMPLE IN JAVA

Hello Friends,
                        It is very common to have objective question about Array creation in any competition exam.
and it is also possible to be confused and do mistake. 
So here I am giving you an program as an example.
This program illustrate correct as well as incorrect array syntax :



public class ArrayExample {

    /**
     * @param args
     */
    public static void main(String[] args) {

        //first way to create array. declairing,constructing and initializing in the same line
    int[] array1={1,2,4,6};
   
     //retrieving array elements
    for(int i=0;i<array1.length;i++)
    {
    System.out.println(array1[i]);
    }

    //second way to create array
    //declaire and construct an array
    int[] array2;
     array2 = new int[3];
 
     int x= -2;
     array2[x] = 7;
     System.out.println(array2[x]);
       //  Run time exception

   
   
     //it is not valid to give size at the time of declaration
   
    int[3] array3;
   
     //so above statement gives compilation error.
   
     int[] array4 = new int[3];
     byte b = 4;
     char c = 'a';
     short d = 7;
     array4[0] = b;
     array4[1] = c;
     array4[2] = d;
     for(int i=0; i<array4.length;i++)
     {
         System.out.println(array4[i]);
         
     }
 

     // constructing Multidimentional array
    String array2d[][] = new String[3][];
    //this is a valid syntax but
   
     String sw1[][] = new String[][3];
    //is not valid .
   
   
    //Second way to create 2-d array
    String array2d1[][] = {   {"ram","shiv","bholenath"}, {"o","m","n","a","m"}};
   
    //Second way to initialize 2-d array
    int array2d3[][] = new int[3][];
    array2d3[0]= new int [2];
    array2d3[0][0]=6;
    array2d3[0][1]=7;
   array2d3[0][2]=9; 

// run time exception 
    array2d3[1]= new int [1];
    array2d3[1][0] = 3;
    }

}

Friends just copy and paste this code and save the file ArrayExample.java , and Run it.
Code in blue colour work correctly but code in red colour gives u error.  So comment the code in red and then run it. and look carefully because it may lead you to a mistake.


Thank you ..........

Sunday 7 July 2013

ARRAYS in JAVA


                                                                  ARRAYS  IN JAVA


Some interesting facts about arrays in java :

A)  It is never legal to include the size of array at the time of array    declaration in JAVA.
int[7] marks;    is invalid
Because jvm does not allocate space until you actually initiate array object, then size matters.


B) Array objects created on heap. 

C) int array[][] = new int[3][];  is acceptable in java 
    but
    int[][] array = new int[][3];   is not acceptable 

   because jvm needs to know the size of object assigned to the     variable array.

D) Anonymous Array Creation :

  int[] test;
  test = new int {4,7,5};

In this anonymous array we construct and initialize and array and then assign the array to previously declare array reference variable.
      The preceding code create a int array object with three elements 4,7,5 and assign this object to previously declared array reference test.
       We do not specify the size  of anonymous array obj. , size is derived from the number of elements in the curly braces .
So  :   new Object[3] {null, new object(), new object()};
is invalid  size must not be specified.

E)  Just in Time array argument :

       public class Foo {
        void takeArray(int[] someArray)
        { 
             //  use array parameter
        }

       public static void main (String[] args) {
              Foo f = new Foo();
              f.takeArray(new int[]  {1,2,3,4,5});
        }
    }

      Here we are not assigning array object to any reference variable, just-in-time array is used as an argument to method.







Search This Blog

Total Pageviews