Tuesday, 27 September 2016

C++ objective type question

C++

1) With every use of memory allocation function, what function should be used to release allocate memory which is no longer needed

Unalloc()
Dropmem()
Dealloc()
Free()

2) What is the fundamental use of classes?

Define object
Define a new type &new scope
Make programming easy
Classify the programmers

3) Member function defined inside the class definition, by default is called

Member function
Inline function
Constructor
Parametrized constructed

4) Which is not a valid constructor

Inline
Copy
Default
Parametrized

5) How many private, public, or protected sections can be there in a class

1
2
3
Multiple

6) The member of a class can be

Data
Member function  
Type definition
All of the above

7) Classes with pointer member variable must not

Explicitly overload the assignment operator
Include cop constructor
Include destructor
Use a non member operator function

8) A member function always access the data

In the object of which it is a member
In the class of which it is a member
In any object of class of which it is a member
In the public port of its class

9) when overloading an operator which of these is not true?

Can’t change precedence or associativity
Default arguments can’t be used
Can’t change no of arguments that an operators takes
Can change basic behavior of operator


Sunday, 25 September 2016

Unix | shell variables

Shell variables

The shell support variables that are useful both in command line and shell programming .you will deal with three basic variables.

   1.    Positional variables
   2.    Special variables
   3.    Named variables

1) positional variables : on several occasions, you may require the shell programs to accept an arguments from the command line itself . To facilitate this process, positional parameters are provided. Using these parameters you can pass up to nine arguments to the shell programmers from the command line itself. These parameters may be file name, pathname, username, and so on. These parameters are invoked like normal shell variables with a preceding ‘$’sign as $1,$2,-----------------$q. the first arguments specified after the shell program will be assigned to $1, the second to $2 and so on.
Example: 
$ cat>name
 echo ”your first name is” :$1
 echo ”your middle name is” :$2
 echo ”your last name is” :$3
   (Ctrl + d)
    $

2) special variables  : there  are two special parameters that are of special interest to us. They also pertain to arguments specified at the command line.
 
 $ # this parameter returns the number of arguments that are specified on the command line.
Example: 
$ cat>how-many-arguments
Echo ”the number of arguments specified is” :$#
(ctrl + )
$

$ How-many-arguments: just testing this programs.
The number of arguments specified is: 4

$* this parameter, when referenced within the shell programs ,retuen a string with all the parameters with which the shell programs was invoked
Example: 
$ cat>display-args
 Echo “ the args are”: $*
  (Ctrl + d)
    $
$ display args hello word I am except in Unix
The args are : hello word I am except in Unix

3) Named variables: a named variable is a user defined variable that can be assigned the value of named variable can be retrieved by preceding the variable name with a”$” sign
Exampl:
 $myvar=hello
 $ echo $ myvar
   Hello

The first character of a variable name must be a letter or  an underscore. The rest of the name may be composed of letter, digit and underscore combined










neural network


Neural Network(NN)


    1)    which of the following is true?
  • On average, NN have higher computation rats than conventional computers
  • NN learn by example
  • NN mimic the way the human brains work
  • All of the above
    2)    associative network is
  • A NN that contain no loop
  • A NN that contain feedback
  • A NN that has only one loop
  • None of the above
    3)    preceptron can learn
  • AND
  • XOR
  • A & B
  • NO
    4)    preceptron is a
  • Feed forward NN
  • Back propagation algorithm
  • Back tracking algorithm
  • Feed forward backward algorithm
    5)    In inputs neurons has weights 1,2,3,4 the transfer function is linear with the constant of proportionality being equal to 2. The inputs are 4,10,5,20 respectivly.the output
  • 238
  • 345
  • 222
  • 123



software engineering

SOFTWARE ENGINEERING


1) spiral model developed by?
Ans    Berry Bohem

2) which model is popular for students & projects?
Ans    waterfall model

3) project risk factor is consider under which model?
Ans    Spiral model

4) Build and fix model has how many phase?
Ans    2 phase

5) SDLC stand for?
Ans    Software development model

6) SRS stand for?
Ans    software requirement specification

7) RAD stand for?
Ans    Rapid application development

8) RAD model was purposed by?
Ans    IBM

9) waterfall model is not suitable for?

Ans    complex projects

Java | Static VS Non-Static Nested Classes

Static VS Non-Static Nested Classes

     1.      The instance of static nested class is created without the reference of outer class, which means it does not having enclosing instance
The instance of non-static nested class is created with the reference of object of outer class, in which it has defined , this means it has enclosing instance
    2.      Static nested classes does not need reference of outer class. Non-static nested class requires the outer class reference . you can’t create instance of inner class without creating instance of outer class
   3.      Another difference between static and non-static nested classes is that you can’t access non-static members example: methods and fields into nested static class directly, if you do, you will get error like non-static member can’t be used in static context. While inner class can access both static and non-static no of order classes

If you make a nested class non-static then it also referred as inner class




Class outer
     {
 Private static String message =  ”hello”;
//static nested class
            Private static class MessagePrinter
                        {
//onlystatic member of outer class is directly accessible in nested static class
                        Public void PrintMessage()
                                    {
//compile time error if message field is not static
            System.out.println(“message from nested static class : “ + message);
                                    }
                        }
//non-static nested class also called inner class
            Private class inner
                        {
//both static and non-static member of outer class is accessible in the inner class
                        Public void display()
                                    {
           
System.out.println(“message from non-static nested  class : “ + message);
                                    }
                        }
//create static and non-static nested classes
            Public static void main(String[] args)
                        {
//creating instance of nested static class
            Outer.MessagePrinter printer = new outer. MessagePrinter();
//calling non-static method of nested static class
                        Printer. printMessage();
//creating instance of  non-static nested class
                        Outer.Inner inner = outer.new Inner();
//calling non-static method of inner class
                        Inner.display();
//we can also combine above steps
                        Outer.Inner nonstaticIner = new Outer.new inner();
                        Non-staticIner.display();
                        }
            }

Output :    
                       message from nested static class : hello
                       message from nested static class : hello












operating system | some best practice question

     OPERATING SYSTEM

     1)    Primitive scheduling is the strategy of temporally suspending a running process ?

    Before CPU time slice expires
    To allow starving process to run
    When it request I/O

     2)     which of the following explain the working of OS?

    It is event driven
    It is an object oriented
    It is procedure based system software

     3)    Blocking and caching are the terms associated with which OS functions respectively?

    MM &disk scheduling
    ICOS & disk scheduling
    ICOS & MM

     4)    Applications like banking & reservations required which type of OS?

    Real time
    Hard real time
    Soft real time

5)  which is not a goal of scheduling algorithm for different OS?

    fairness
    Max throughput
    Balance

     6)    Disadvantage of FCFS

    Convey effect
    No preemption
    Simplicity

    7)    what is the duration of time quantum in round robin scheduling?

    10 – 100 ms
    100 – 1000 ms
    1 – 1000 ms  

     8)    which is a valid page replacement policy

    LPU
    PU policy
    onlya







Computer objective type question

  OBJECTIVE TYPE QUESTION   


     1)   Best known example of MAN(metropolitan area network) ?
  Ans  cable tv 

      2)   The number of int between 1 and 250 that are divisible by 2,5,7 is ?  
  Ans   3

      3)   in a broadcast network , a layer that is often thin or non existent is?
             Ans  Network layer

     4)    sql command end with?
            Ans  Semicolon

     5)   Which data structure used to implement recursion?
Ans  Stack

     6)   In BCD adder to add 2 decimal digit needs minimum of?
Ans 5 full adder , 2 half adder

    7)   In order to build mod-18 counter the minimum no. of flip flops needed is equal to?
Ans  5

    8)   The dual of switching fun f=x+yz is given by?
Ans  x(y+z)

     9)   Context free grammar is what type of grammar?
 Ans type 2









operating system | some best practice ouestion

OPERATING SYSTEM

1) Which of the following memory allocation scheme suffer from external fragmentation?

  •  Segmentation 
  •  swapping
  •  Pure demand paging    
  •  paging
  
          2)  Resources are allocated to process on non-shareable basis is?

  •  Mutual exclusive      
  •  hold & wait
  •  Non preemption 
  •  circular wait

        3) In round robin scheduling as time quantum is increased the average turnaround time?        

  •    Increase    
  •    Remains constant
  •    Decrease      
  •    varies irregular

       4) Pool based allocation of memory achieves better usage. Memory can be preempted from inactive         programs & used to accommodate active programs called?

  •    Preemption         
  •     swapping
  •     Spooling   
  •     scheduling

    5) What is the example of virtual resources?

  •    Print service           
  •    virtual machine
  •    Virtual memory      
  •     All of the above

    6) What of these is/are the desirable feature of OS?

  •    Extensible
  •    Portable
  •    Reliable   
  •    All of the above

   7) Which is not a term of describing the collection of operating programs?

  •    Monitor         
  •    kernel
  •    Server           
  •    supervisor

   8) Transparency is a feature of which type of OS?
  • Batch processing OS  
  • Time division 
  • Distributed OS   
  •  Multiprogramming OS

    9) Program priories, preemption are the key concept of which OS?
  •  Batch processing OS
  •  Time division OS
  •  Distributed OS    
  •  Multiprogramming OS

  10) If the disk head is located initially at 32 find number of disk moves required with FCFS if the disk queue of I/O blocks requested are 98,37,14,124,65,67?

  •    239 
  •    310
  •    321 
  •    325



 


Saturday, 10 September 2016

Java | Anonymous Inner class

Anonymous Inner class

An inner class declared without a class name is known as anonymous inner class. In case of anonymous inner classes we declare and instantiate them at the same time. Generally they are used whenever you need to override the method of a class or an interface.
Anonymous inner classes are declared without any name at all. They are created in two ways.
  •     An subclass of specified type

Class demo
   {
      Void show()
           {
                 System.out.println(“show method of super class”);
           }
   }
Class flavour1 demo
    {
//An anonymous class with demo as base class
Static demo d= new demo()
    {
Void show()
       {
                 Super.show();
                  System.out.println(“I am in flavour1 demo class”);
        }
   };
Public static void main(String[] args)
     {
d.show();
      }
}
}

  Output :       

  show method of super class
   I am in flavour1 demo class

 
                      

In above code demo act as super class and anonymous class act as a subclass. Both have show() method. In anonymous class show() method is overridden

  •      As implementation of specified interface

 Interface hello
      {
             Void show();
       }
Class helloworld
  {
//An anonymous class that implements Hello interface
Static Hello h = new Hello()
    {
          Public void show()
                  {
               System.out.println(“ Anonymous class”);
             }
};
Public static void main(String[] args)
{
h.show();
}
}

 Output :

  Anonymous class                       
                                 
 
                       
In above code we can create an object of anonymous inner class but this anonymous inner class is an implementer of the interface Hello. Any anonymous inner class can implement only one interface at one time. It can either extend a class or implement interface at a time

Advantages of anonymous inner class:

·         Generally an inner class can be easily onverted into a method with anonymous inner class, which helps reduce verbosity
·         The advantage to non-anonymous is that you can resues the clad. I believe the only reason to use an anonymous inner class is brevity
·         One advantage of anonymous inner classes is that no one can ever use it anywhere else, whereas a named inner class can be used.
·         Anonymous inner classes are hard to debug in Eclipse.
·         The key benefit of an anonymous class is encapsulation (or clutter reduction)






Class demo    {

Void show()     

DBMS

DBMS

*    Usage of preemption and transaction rollback prevents.

a.     Unauthorized usage of data files
b.     Deadlock situation
c.      Data manipulation
d.     File preemption
Ans. Deadlock situation

*    Views are useful for ____ unwanted information and for collecting together information from more than one relation in a single view.

a.     Hiding
b.     Deleting
c.      Highlighting
d.     All above
Ans. Hiding

*    The decision tree classifier is widely used technique for.

a.     Classification
b.     Association
c.      Partition
d.     Clusters
Ans. Classification

*     Thoma’s write rule is ____.

a.     2-phase locking protocol
b.     1-phase locking protocol
c.      Time stamp ordering protocol
d.     Sliding window protocol
Ans. Time stamp ordering protocol