"Karmanyevadhikaraste ma phaleshu kadachana, Ma karma phala hetur bhurmatey sangostva akarmani."

interviewqns-5

   If the log file is really big , how to check last few logs of log file  
Grep test /etc/logfile |  tail  -l


first n lines Syntax: head -n N FILENAME
$ head -n 15 /var/log/maillog
Ignore last 250 lines:$ head -n -250 /var/log/secure
Last n lines: $ tail -n 50 /var/log/messages
To view newer contents: $ tail -f /var/log/syslog
 
 
   How to remotely access other linux machine
Configure remote access in the ubantu machine
In windows install vnc programme and add the remote machine address in it
In ubantu install ssh and make the port open 22
In windows install ssh client software i.e putty and enter login pwd and start accessing linux
SQL/Databasewhat is rowid in Oracle database
ROWID is the physical location of a row. Consequently it is the fastest way of locating a row,
It is address of the row..

             what is primary key and unique constrain 
                  A primary key is a unique field on a table but it is special in that the table considers that row its key. That means that other tables can use this field to create foreign key relationships to themselves.
A unique constraint simply means that a particular field must be unique.


Technical questions:
1)java: what is object, encapsulation. Overloading, overriding

Encapsulation:Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding.
Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface.
The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code.

Example:

Let us look at an example that depicts encapsulation:
/* File name : EncapTest.java */
public class EncapTest{

   private String name;
   private String idNum;
   private int age;

   public int getAge(){
      return age;
   }

   public String getName(){
      return name;
   }

   public String getIdNum(){
      return idNum;
   }

   public void setAge( int newAge){
      age = newAge;
   }

   public void setName(String newName){
      name = newName;
   }

   public void setIdNum( String newId){
      idNum = newId;
   }
}
The public methods are the access points to this class' fields from the outside java world. Normally, these methods are referred as getters and setters. Therefore any class that wants to access the variables should access them through these getters and setters.
The variables of the EncapTest class can be access as below::
/* File name : RunEncap.java */
public class RunEncap{

   public static void main(String args[]){
      EncapTest encap = new EncapTest();
      encap.setName("James");
      encap.setAge(20);
      encap.setIdNum("12343ms");

      System.out.print("Name : " + encap.getName()+ 
                             " Age : "+ encap.getAge());
    }
}
This would produce the following result:
Name : James Age : 20

OverRiding:
  • The argument list should be exactly the same as that of the overridden method.
  • The return type should be the same or a subtype of the return type declared in the original overridden method in the superclass.
  • The access level cannot be more restrictive than the overridden method's access level. For example: if the superclass method is declared public then the overridding method in the sub class cannot be either private or protected.
  • Instance methods can be overridden only if they are inherited by the subclass.
  • A method declared final cannot be overridden.
  • A method declared static cannot be overridden but can be re-declared.
  • If a method cannot be inherited, then it cannot be overridden.
  • A subclass within the same package as the instance's superclass can override any superclass method that is not declared private or final.
  • A subclass in a different package can only override the non-final methods declared public or protected.
  • An overriding method can throw any uncheck exceptions, regardless of whether the overridden method throws exceptions or not. However the overriding method should not throw checked exceptions that are new or broader than the ones declared by the overridden method. The overriding method can throw narrower or fewer exceptions than the overridden method.
  • Constructors cannot be overridden.

Using the super keyword:

When invoking a superclass version of an overridden method the super keyword is used.
class Animal{

   public void move(){
      System.out.println("Animals can move");
   }
}

class Dog extends Animal{

   public void move(){
      super.move(); // invokes the super class method
      System.out.println("Dogs can walk and run");
   }
}

public class TestDog{

   public static void main(String args[]){

      Animal b = new Dog(); // Animal reference but Dog object
      b.move(); //Runs the method in Dog class

   }
}
Object:
Objects have states and behaviors.

2) sql queries
3) some unix commands,
4) selenium coding for some test case
5) some coding in java and selenium