All Stories
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, 13 January 2014

21.What are wrapper classes?
primitive data types may be converted into object types by using the wrapper classes contained in the java.lang package.
Exampes : int, float, long, char, double
22.What is the difference between an instance variable and a static variable?
Class variables are called static variables. There is only one occurrence of a class variable per JVM per class loader.When a class is loaded the class variables are initialized.
Instance variables are non-static and there is one occurrence of an instance variable in each class instance.Also known as a member variable or a field.
23Where and how can you use a private constructor?
Private constructor is used if you do not want other classes to instantiate the object and to prevent subclassing.The instantiation is done by a public static method (i.e. a static factory method) within the same class.
24.What is type casting?
Type casting means treating a variable of one type as though it is another type.
Examples :
int m = 5;
byte n =i;
25.What is a user defined exception?
User defined exceptions may be implemented by defining a new exception class by extending the Exception class.

<<<PREV                                                                                              NEXT>>>

Java Language Interview Question and Answers : 5

21.What are wrapper classes?
primitive data types may be converted into object types by using the wrapper classes contained in the java.lang package.
Exampes : int, float, long, char, double
22.What is the difference between an instance variable and a static variable?
Class variables are called static variables. There is only one occurrence of a class variable per JVM per class loader.When a class is loaded the class variables are initialized.
Instance variables are non-static and there is one occurrence of an instance variable in each class instance.Also known as a member variable or a field.
23Where and how can you use a private constructor?
Private constructor is used if you do not want other classes to instantiate the object and to prevent subclassing.The instantiation is done by a public static method (i.e. a static factory method) within the same class.
24.What is type casting?
Type casting means treating a variable of one type as though it is another type.
Examples :
int m = 5;
byte n =i;
25.What is a user defined exception?
User defined exceptions may be implemented by defining a new exception class by extending the Exception class.

<<<PREV                                                                                              NEXT>>>

Posted at 04:56 |  by Pritam
16.What is an array?
Array is a group of related data items that share a common name.For instance, we can define an array name salary to represent a set of salaries of a group of employees.
Examples : salary[10]
17.What is a list iterator?
The List and Set collections provide iterators, which are objects that allow going over all the elements of a collection in sequence. The java.util.Iterator interface provides for one-way traversal and java.util.ListIterator is an iterator for lists that allows the programmer to traverse the list in either direction (i.e. forward and or backward) and modify the list during iteration.
18What is the main difference between a String and a StringBuffer class?
String is immutable : you can’t modify a string object but can replace it by creating a new instance. Creating a new instance is rather expensive.

StringBuffer is mutable : use StringBuffer or StringBuilder when you want to modify the contents. StringBuilder was added in Java 5 and it is identical in all respects to StringBuffer except that it is not synchronized,which makes it slightly faster at the cost of not being thread-safe.
19.When to use serialization?
A common use of serialization is to use it to send an object over the network or if the state of an object needs to be persisted to a flat file or a database.
20.What is the main difference between shallow cloning and deep cloning of objects?
Java supports shallow cloning of objects by default when a class implements the java.lang.Cloneable interface.
Deep cloning through serialization is faster to develop and easier to maintain but carries a performance overhead.

<<<PREV                                                                                                  NEXT>>>

Java Language Interview Question and Answers : 4

16.What is an array?
Array is a group of related data items that share a common name.For instance, we can define an array name salary to represent a set of salaries of a group of employees.
Examples : salary[10]
17.What is a list iterator?
The List and Set collections provide iterators, which are objects that allow going over all the elements of a collection in sequence. The java.util.Iterator interface provides for one-way traversal and java.util.ListIterator is an iterator for lists that allows the programmer to traverse the list in either direction (i.e. forward and or backward) and modify the list during iteration.
18What is the main difference between a String and a StringBuffer class?
String is immutable : you can’t modify a string object but can replace it by creating a new instance. Creating a new instance is rather expensive.

StringBuffer is mutable : use StringBuffer or StringBuilder when you want to modify the contents. StringBuilder was added in Java 5 and it is identical in all respects to StringBuffer except that it is not synchronized,which makes it slightly faster at the cost of not being thread-safe.
19.When to use serialization?
A common use of serialization is to use it to send an object over the network or if the state of an object needs to be persisted to a flat file or a database.
20.What is the main difference between shallow cloning and deep cloning of objects?
Java supports shallow cloning of objects by default when a class implements the java.lang.Cloneable interface.
Deep cloning through serialization is faster to develop and easier to maintain but carries a performance overhead.

<<<PREV                                                                                                  NEXT>>>

Posted at 04:52 |  by Pritam
11.What is an abstract class?
Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. An abstract class can contain no abstract methods also i.e. abstract class may contain concrete methods.
12.what are class variables
Class variables are global to a class and belong to the entire set of objects that class creates. Only one memory location is created for each variable.
13.What is the Collection interface?
The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.
14.What must a class do to implement an interface?
The class must provide all of the methods in the interface and identify the interface in its implements clause.
15.What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects.

<<<PREV                                                                                               NEXT>>>

Java Language Interview Question and Answers : 3

11.What is an abstract class?
Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. An abstract class can contain no abstract methods also i.e. abstract class may contain concrete methods.
12.what are class variables
Class variables are global to a class and belong to the entire set of objects that class creates. Only one memory location is created for each variable.
13.What is the Collection interface?
The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.
14.What must a class do to implement an interface?
The class must provide all of the methods in the interface and identify the interface in its implements clause.
15.What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects.

<<<PREV                                                                                               NEXT>>>

Posted at 04:49 |  by Pritam

Saturday, 11 January 2014

6.What is variables and then types?
    Variables is an identifier that denotes a storage location used to store a data values.unlike constants that remain unchanged during the execution of a program, a variable may takes different values at different times during the execution of the program.
  • Instance variables
  • Class variables
  • Local variable
  • Parameters
7.what is dot operator?
The dot operator(.) is used to access the instance variables and methods of class objects.It is also used to access classes and sub-packages from a package.
Examples : 
Person1.age ---------> Reference to the variable age
8.Define strings?
Strings represent a sequence of characters.The easiest way to represent a sequence of characters in java is by using a character array.
9.What is serialization?
Serialization is the process of converting a objects into a stream of bytes.
10.What are different types of access modifiers?
    Access specifiers are keywords that determine the type of access to the member a class.
  • Public
  • Protected
  • Private
  • Default

<<<PREV                                                                                             NEXT>>>

Java Language Interview Question and Answers : 2

6.What is variables and then types?
    Variables is an identifier that denotes a storage location used to store a data values.unlike constants that remain unchanged during the execution of a program, a variable may takes different values at different times during the execution of the program.
  • Instance variables
  • Class variables
  • Local variable
  • Parameters
7.what is dot operator?
The dot operator(.) is used to access the instance variables and methods of class objects.It is also used to access classes and sub-packages from a package.
Examples : 
Person1.age ---------> Reference to the variable age
8.Define strings?
Strings represent a sequence of characters.The easiest way to represent a sequence of characters in java is by using a character array.
9.What is serialization?
Serialization is the process of converting a objects into a stream of bytes.
10.What are different types of access modifiers?
    Access specifiers are keywords that determine the type of access to the member a class.
  • Public
  • Protected
  • Private
  • Default

<<<PREV                                                                                             NEXT>>>

Posted at 22:26 |  by Pritam
1.What is Java?
A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.
2.what are the main features of java?
    The main features of java are
  • Compiled and Interpreted
  • Object oriented
  • Robust and secure
  • Type safe
  • High Performance.
3.What are pass by reference and passby value?
Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.
4.What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
5.What is the Java Virtual Machine (JVM)?
The Java Virtual Machine is software that can be ported onto various hardware-based platforms.

                                                                                                                 NEXT>>>
   

Java Language Interview Question and Answers :1

1.What is Java?
A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.
2.what are the main features of java?
    The main features of java are
  • Compiled and Interpreted
  • Object oriented
  • Robust and secure
  • Type safe
  • High Performance.
3.What are pass by reference and passby value?
Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.
4.What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
5.What is the Java Virtual Machine (JVM)?
The Java Virtual Machine is software that can be ported onto various hardware-based platforms.

                                                                                                                 NEXT>>>
   

Posted at 22:15 |  by Pritam
21.What is the difference between macro and iniine?
Inline follows strict parameter type checking, macros do not.
Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
22.How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
23.What is multiple inheritance?
A class can inherit properties from more than one class which is known as multiple inheritance.
24.what is the use of virtual destructor in c++?
  • A destructor is automatically called when the object is destroyed.
  • A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.
25.What do you mean by reference variable in c++?
A reference variable provides an alias to a previously defined variable.
Data -type & reference-name = variable name

                <<<PREV                                                                                                       NEXT>>>

C++ Interview Question and Answers : 5

21.What is the difference between macro and iniine?
Inline follows strict parameter type checking, macros do not.
Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
22.How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
23.What is multiple inheritance?
A class can inherit properties from more than one class which is known as multiple inheritance.
24.what is the use of virtual destructor in c++?
  • A destructor is automatically called when the object is destroyed.
  • A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.
25.What do you mean by reference variable in c++?
A reference variable provides an alias to a previously defined variable.
Data -type & reference-name = variable name

                <<<PREV                                                                                                       NEXT>>>

Posted at 22:05 |  by Pritam
16.What are the few advantages of Inline function?
  • It offers an improved macro facility.
  • By using the inline functions, the user can split a large function with many nested modules of statement blocks into many small inline functions.
17.What is copy constructor?
Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.
18.What is default constructor?
A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.
19.What is a scope resolution operator?
The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
20.What is the difference between Object and Instance?
  • An instance of a user-defined type is called an object. We can instantiate many objects from one class.
  • An object is an instance of a class.
                   <<<PREV                                                                                                 NEXT>>>

C++ Interview Question and Answers : 4

16.What are the few advantages of Inline function?
  • It offers an improved macro facility.
  • By using the inline functions, the user can split a large function with many nested modules of statement blocks into many small inline functions.
17.What is copy constructor?
Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.
18.What is default constructor?
A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.
19.What is a scope resolution operator?
The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
20.What is the difference between Object and Instance?
  • An instance of a user-defined type is called an object. We can instantiate many objects from one class.
  • An object is an instance of a class.
                   <<<PREV                                                                                                 NEXT>>>

Posted at 22:00 |  by Pritam

Wednesday, 8 January 2014

11.Define Constructors?
A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.
12.How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
13.Define destuctors?
  • A destructor is called for a class object when that object passes out of scope or is explicitly deleted.
  • A destructors as the name implies is used to destroy the objects that have been created by a constructors.
  • Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
14.What is a class?
A class is a collection of objects.
15.what is the difference between c & c++?
    C++ ia an object oriented programing but C is a procedure oriented programing.
  • C is super set of C++.
  • C can’t suport inheritance, function overloading, method overloading etc. but c++ can do this.
  • In c program the main function could not return a value but in the c++ the main function shuld return a value.

                 <<<PREV                                                                                                  NEXT>>>

C++ Interview Question and Answers : 3

11.Define Constructors?
A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.
12.How variable declaration in c++ differs that in c?
C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
13.Define destuctors?
  • A destructor is called for a class object when that object passes out of scope or is explicitly deleted.
  • A destructors as the name implies is used to destroy the objects that have been created by a constructors.
  • Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
14.What is a class?
A class is a collection of objects.
15.what is the difference between c & c++?
    C++ ia an object oriented programing but C is a procedure oriented programing.
  • C is super set of C++.
  • C can’t suport inheritance, function overloading, method overloading etc. but c++ can do this.
  • In c program the main function could not return a value but in the c++ the main function shuld return a value.

                 <<<PREV                                                                                                  NEXT>>>

Posted at 20:12 |  by Pritam

6.What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.
7.What is message passing?
An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.
8.What are tokens in C++?
    The smallest individual units of a program is known as tokens. c++ has the following tokens :
  • Keywords
  • Identifiers
  • Constants
  • Strings
  • Operators
9.What is the use of enumerated data type?
An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.
10.What is the use of default constructor?
A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameterless constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.

                   <<<PREV                                                                                             NEXT>>>          

C++ Interview Question and Answers : 2


6.What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.
7.What is message passing?
An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.
8.What are tokens in C++?
    The smallest individual units of a program is known as tokens. c++ has the following tokens :
  • Keywords
  • Identifiers
  • Constants
  • Strings
  • Operators
9.What is the use of enumerated data type?
An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.
10.What is the use of default constructor?
A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameterless constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.

                   <<<PREV                                                                                             NEXT>>>          

Posted at 19:44 |  by Pritam

Tuesday, 8 October 2013

1.What is C++
C++ is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.
2.What are the basic concepts of object oriented programming?
    It is necessary to understand some of the concepts used extensively in object oriented programming.These include
  • Objects
  • Classes
  • Data abstraction and encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message passing
3.Define inheritance?
The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch. Inheritance is the process by which objects of one class acquire properties of objects of another class.
4.Define polymorphism?
Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances.
5.What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

                                                                                                            NEXT>>>

C++ Interview Question and Answers : 1

1.What is C++
C++ is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.
2.What are the basic concepts of object oriented programming?
    It is necessary to understand some of the concepts used extensively in object oriented programming.These include
  • Objects
  • Classes
  • Data abstraction and encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message passing
3.Define inheritance?
The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch. Inheritance is the process by which objects of one class acquire properties of objects of another class.
4.Define polymorphism?
Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances.
5.What is encapsulation?
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

                                                                                                            NEXT>>>

Posted at 22:48 |  by Pritam
21.What are the differences between structures and union?
A structure variable contains each of the named members, and its size is large enough to hold all the members. Structure elements are of same size.

A Union contains one of the named members at a given time and is large enough to hold the largest member. Union element can be of different sizes.
22.What is the difference between arrays and pointers?
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.

Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed.
23.What is dynamic binding?
Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance.
24.what is an abstract base class?
An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function.
25.What is the difference between class and structure?
  • By default, the members ot structures are public while that tor class is private.
  • structures doesn’t provide something like data hiding which is provided by the classes.
  • structures contains only data while class bind both data and member functions.
<<<PREV                                                                                             NEXT>>>


C Language Interview Question and Answers : 5

21.What are the differences between structures and union?
A structure variable contains each of the named members, and its size is large enough to hold all the members. Structure elements are of same size.

A Union contains one of the named members at a given time and is large enough to hold the largest member. Union element can be of different sizes.
22.What is the difference between arrays and pointers?
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.

Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed.
23.What is dynamic binding?
Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance.
24.what is an abstract base class?
An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function.
25.What is the difference between class and structure?
  • By default, the members ot structures are public while that tor class is private.
  • structures doesn’t provide something like data hiding which is provided by the classes.
  • structures contains only data while class bind both data and member functions.
<<<PREV                                                                                             NEXT>>>


Posted at 22:35 |  by Pritam

Thursday, 19 September 2013

16.What is a macro?
Macros are the identifiers that represent statements or expressions. To associate meaningful identifiers with constants, keywords, and statements or expressions.
17.What is arrays?
Array is a variable that hold multiple elements which has the same data type.
18.What is the difference between #include‹ › and #include “ ”?
#include‹ › ----> Specifically used for built in header files.
#include “ ” ----> Specifically used for used for user defined/created n header file.
19.What are the advantages of the functions?
  • It reduces the Complexity in a program by reducing the code.
  • Function are easily understanding and reliability and execution is faster.
  • It also reduces the Time to run a program.In other way,Its directly proportional to Complexity.
  • Its easy to find-out the errors due to the blocks made as function definition outside the main function.
20.How do declare an array?
We can declare an array by specify its data type, name and the number of elements the array holds between square brackets immediately following the array name.
syntax :
data_type array_name[size];

<<<PREV
                                                                                         NEXT>>>

C Language Interview Question and Answers : 4

16.What is a macro?
Macros are the identifiers that represent statements or expressions. To associate meaningful identifiers with constants, keywords, and statements or expressions.
17.What is arrays?
Array is a variable that hold multiple elements which has the same data type.
18.What is the difference between #include‹ › and #include “ ”?
#include‹ › ----> Specifically used for built in header files.
#include “ ” ----> Specifically used for used for user defined/created n header file.
19.What are the advantages of the functions?
  • It reduces the Complexity in a program by reducing the code.
  • Function are easily understanding and reliability and execution is faster.
  • It also reduces the Time to run a program.In other way,Its directly proportional to Complexity.
  • Its easy to find-out the errors due to the blocks made as function definition outside the main function.
20.How do declare an array?
We can declare an array by specify its data type, name and the number of elements the array holds between square brackets immediately following the array name.
syntax :
data_type array_name[size];

<<<PREV
                                                                                         NEXT>>>

Posted at 21:36 |  by Pritam
© 2013 Knowledge To Grab. WP Theme-junkie converted by K-Grab
Blogger templates. Proudly Powered by Blogger.
back to top