Posts

Showing posts from October, 2019

Difference between function overloading and function overriding.

S. No.              Function Overloading                     Function overriding   1. In a function overloading prototype are different . In a function overriding prototype are same.   2. The overloaded function name does not precede with any keywords. The name of an overridden function precede with the keywords “virtual” in base class only.   3. Which overloaded function is to be invoked are resolve during compile time. Which overridden function to be invoked is resolve during runtime.   4. Constructor can be overloaded but destructor can not be overloaded. Constructor can not be overridden but destructor can be overridden.   5. Overloading achieve early binding. Overridden achieve late...

Java features which makes the java most popular language..

Image
The java is a most popular programming language platform present in the world today. More than 30 Millions devices which run on java technology. Following are the most important properties of java which have made it no #1 choice for programmer around the world. 1) P latform Independent:-   Before we say and can understand meaning of the word platform, In programming the word platform means the environment In which a programs runs in simple words it is the combination of operating system and central processing unit. So window 10+ core i5 is one platform while Linux + core i7 is another platform. Now being platform independent means that a programmer which is compiled on window platform can directly executed on Linux platform without re-writing or re-compiling and java has speech up using it’s important component called 1. Bytecode 2. JVM. Whenever we compiled a java program the compiler never generates machine code rather the java compiler converts our program fro...

Concept of Stream and It's bytestream class in c++

Image
Concept of streams:- Concept of stream  A stream is general name given to flow of data A stream is a sequence of byte. The source stream that provides data to programs is called input stream. The destination stream receive output from the program is called output stream. In header <iostream>, a set of class is defined that supports I/O operations. The classes used for input/output to the devices are declared in the IOSTREAM file. The classes used for disk file are declared in the FSTREAM file. Input/output stream :- Input and output stream in c++ Stream class for console I/O operations :- stream class in c++ ios class contains basic facilities that are used by all other input and output classes (Necessary for formatted input/output). Also contains pointer to a buffer object(streambuf). streambuf provided an interface to physical devices through buffer. iostream class inherits proper...

Exception Handling in java

The word exception in world in java means run time error and the word exception handling means the way our program behaves whenever the run time error occurs. But we can understand the importance of exception handling we must first understand how the java behaves by default when a exception occurs.      When a exception occur in java the jvm takes two action by default.  1) It immediately terminates our program as soon as an exception occur.       2) It displays a technical error message related to the exception on our output screen.          Both the above behavior are very much non-user friendly because        1)   Termination a program will not allow further code to execute even if that code has no relation with exception that has occurs.    2)   If the error message will be technical the user will not be able to understand the problem and might repeat wrong ...

What is the interface in java?

An interface in java , like an abstract class can be used to achieve run time polymorphism (dynamic method dispatch). Following are important point we must remember with respect to an interface:-     1)  Just like a class an interface also can contain data but all the data members declared is an interface are by default public static and final.     2)  Just like a class an interface also can contains method but every method declared as an public and abstract.      3)  Just like a class inherits another class it can also inherit an interface but the keyword use in inheritance for interface is implements.     4)  Just like an abstract class we can create reference of an interface but we can never create an object. However we can creates object of child class of an interface and assign it to the reference of the interface and using that reference we can call those method of the child class whic...

Binary Tree traversal

Traversal of a binary tree is to access every node of binary tree at most once. Breadth First :- ·         Level order Depth First :-                   Pre order                    In order                  Post order Pre order :- <root>   <left>   <right> In order :- <left>   <root>   <right> Post order:- <left>   <right>   <root> Pre order  algorithm 1)visit root 2)visit left subtree 3)visit right subtree typedef   struct   node { char data; node *left; node *right; }node; void preorder(node *root) { if(root==NULL) return 1 ; printf(“%c”,root->data); preorder(root->data); preoder(root->right); } void   inorder(node *root...

What is function in programming language

In programming world, function is a set of statement which use to perform particular task. There are basically two type of function: 1. Built-in(library) function:-                     System provided function which store in library called library function. e.g. scanf(), printf(), strcpy(), strcmp(). 2. User define function:-                    Those function  which define by user to perform required task according to need called                          user define function. *Parts of function: 1 declaration. 2 definition. 3 function call. *Declaration is also known as prototype of function. e.g.  syntax:         int addition (int,int); where: int is a return type of function              addition is a name of function   ...

Question based on C language..

1) What are the key features of C programming language? ·          C is a platform-dependent language. ·          C offers the possibility to break down a large program into small modules. ·          Also, the possibility of a programmer to control the language. ·          C comes with support for system programming and hence it compiles and executes with high speed when compared to other high-level languages. 2) What is the use of header files in C? Header files contain the definitions and set of rules of the functions being used in the programs. For example:-   when you use printf() or scanf() in your program, you nee to include stdio.h library function. Else your compiler will show an error. This is because, the standard input and output functions printf() and scanf() are stored in this hea...