Horizontal Nav

Tuesday, 18 August 2015

Basic Data Types in C++



The variable type specifies the type of data that can be stored in it. Each variable is declared by its type.
C++ has five basic data types:

          i)          int                    Integer
            ii)         float                Floating Point
            iii)        double            Double Precision
            iv)        char                Characters
            v)         bool                Boolean



Floating Point Data Type

The float represents real or floating type data. The real type data is represented in decimal or exponential notation. The storage capacity for float type variable is four byte.

For Example:

            float var_name;

Integer Data Type

The int represents the integer data. It is used to declare integer type variable. An integer is a whole number i.e. a number without a fraction or a decimal point. The storage capacity for integer type variable is two bytes.

For Example:

            int var_name;

Character Data Type

The char stands for character. It is used to declare character type variable. In character type variable, alphabetic characters, numeric digits and special characters can be stored. The storage capacity for character type variable is one bytes.

For Example:

            char var_name;

Monday, 27 July 2015

Standard Input/Output in C++



The standard streams are pre-connected input or output channels between a computer program and its environment (typically a text terminal) when it begins execution.

Standard Input (stdin):
Standard input is data (often text) going into a program.

Standard Output (stdout):
Standard output is the stream where a program writes its output data.

Types of Code in C++



There are two types of codes that are as follows:

Source Code:

A program written in a high-level language is called source code. Source code is also called source program. Computer cannot understand the statements of high-level language. The source code cannot be executed by computer directly. It is converted into object code and then executed.

Object Code:

A program in machine language is called object code. It is also called object program or machine code. Computer understands object code directly.

Monday, 13 July 2015

Errors in C++

Debugging

An error in a computer program is known as bug. The programmer can make different errors while writing programs.
The process of finding and removing bugs is known as debugging.

Run Time Error

A type of error that occurs during the execution of program is known as run-time error. It is caused when a statement directs the computer to execute an illegal operation such as dividing a number by zero.
The run-time errors are detected and displayed by the computer during execution. Run-time errors are normally caused due to wrong input from the user. The computer stops executing the program and displays error message if a run-time error occurs.

Example: 
The user may ask the program to open a file that does not exist. Similarly, the user may enter wrong type of data etc.

Logical Errors

A type of error that occurs due to poor logic of programmer is known as logical error. A logical error occurs when the program follows a faulty algorithm. A statement with logical error may produce unexpected and wrong results. For example, the programmer may have written a wrong formula to computer an answer. The formula will be executed without any error but will produce wrong results.

Program Flowchart and Compilation

Program Flowchart

Flowchart is combination of two words flow and chart. A chart consists of different symbols to display information about any program. Flow indicates the direction of processing that takes place in the program.

Flowchart is a graphical representation of an algorithm. It is a way of visually presenting the flow of data, operations performed on data and sequence of these operations.

Program Compilation


The process of checking the program for errors in order to execute it properly is called program compilation.

Monday, 8 June 2015

C++ Program Analysis And Designing

Program Analysis

The program first studies the problem. The study of a problem involves the study of the available data & knowledge of the required output. This step is important because to solve a problem the programmer must know the problem specification. Only then he can write or design a good program to solve a problem. The output report always depends on the programmer’s instruction.

Program Designing

A computer program is written to solve a complex problem by the computer. A programmer writes a program according to the requirements of the problem.
The steps involved in solving a problem by the computer include:
  1. Problem Analysis or understanding the problem.
  2. Logic Design
  3. Coding
  4. Testing & Debugging
  5. Documentation

Wednesday, 3 June 2015

C++ IDE and Algorithm

C++ IDE:

Turbo C++ is an integrated development environment (IDE) to write C++ programs. It is the implementation of Borland International. It is used to create, edit and save C++ programs. It also provides a powerful debugger. The debugger helps the users in detecting and removing errors in programs.

Algorithm & Pseudo Code:

An algorithm (pronounced AL-go-rith-um) is a step-by-step procedure to solve a problem. The process of solving a problem becomes simpler and easier with the help of algorithm. It is better to write algorithm before writing the actual computer program.

Examples of Algorithms

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
        sum←num1+num2
Step 5: Display sum
Step 6: Stop
                                                                                         

Sunday, 15 February 2015

5 Steps For Managing Project Risk

This simple 5 step process will help you manage project risk easily.
Step 1: Where are the risks?

The first step is to list everything that could have an impact on whether your project is a success. Think about all the potential problems that you could come across during the project and write them all down. It helps to do this with your team, as they will see things differently to you.

Step 2: What is the impact?

Now you have your list of risks it's time to see what impact they would have if they happened. You'll have the full spectrum: risks that won't cause big problems and risks that could potentially force your project to stop.

Prioritize the list of risks based on the impact: the ones with the largest impact are the highest priority. These are the areas you should focus on right now. Look at each individual risk, but also look at the risk profile overall—do all these risks add up to make your project really risky or is it going to be a low risk initiative? Use ProjectManager.com to present your project's risk profile as a report or dashboard, as that makes it easy for executive managers to see where potential problems lurk.

Thursday, 12 February 2015

C++ Language Interview Questions and answers

1) What is C++?
C++ is an object oriented programming language. It was developed by Bjame Stroustrup in 1983 at the AT & T Bell Laboratories, Now Jersey, USA. It is basically a super set of C, which provided low level features.

2) What are the basic concepts of OOP?
  • Objects
  • Classes
  • Data Abstraction and Encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message Passing

3) What is oops?
An object oriented program is a collection of discrete objects, which are self contained collections of both data structures and functions that interact with other objects.

4) What are the characteristic of C++ language?
  • It has the following characteristics :
  • Reduces complexity while solving problems
  • Correctness of results is ensured
  • Affordable in terms of hardware and other resources
  • Easier and cheaper for integrating existing software facilities and libraries
  • Portable i.e. can be used on different types of computers with little or no change in the programs.

 5) What are the types of character set?

  • We have two character sets in C++. These are :
  • Source characters
  • Escape sequences /Execution characters

6) What are the elements of OBJECT ORIENTED PROGRAMMING?

  • The main concepts of object oriented programming are :
  • Data Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

7)  What are the components of a class?
A class consists of two components data members and methods.

8) What are methods?
Methods are functions associated with the class. They are able to access even private data members.

9) What is the significance of class keyword in C++/Java?
The keyword class (in C++ and Java) specifies an Abstract Data Type (ADT). ADTs expose operations that provide a higher level functionality, and the lower level implementation details are isolated and hidden from the users of the class.

10)  What is the difference between source and escape sequences?
The source text is created with the help of source characters.

These are interpreted at execution time. The values of these characters are implementation defined.

Sunday, 25 January 2015

C Language Interview Questions and answers

1) Who invented C Language?
Dennis Ritchie in 1972 developed a new language by inheriting the features of both BCPL and B and adding additional features. He named the language as just C

2) Who invented B Language?
Ken Thomson at AT&T Bell Labs developed a language and named it B. Even the B language was found to have some short comings to support development of both business applications and system software.

3) Who invented BCPL Language?
Basic Combined Programming Language(BCPL) was developed by Martin Richards, Cambridge university.

4) Why C Language?
C is one of the high level languages. It is a general purpose language, which means it can be used to write programs of any sort.

5) What are the features of C Langauges?
  • In C one can write programs like that of high level languages as in COBOL, BASIC, FORTRAN etc. as well as it permits very close interaction with the inner workings of the computer.
  • It is a general purpose programming language. It is usually called system programming language but equally suited to writing a variety of applications.
  • It supports various data types
  • It follows the programming style based on fundamental control flow constructions for structured programming
  • Functions may be pre–defined or user defined and they may return values of basic types, structures, unions or pointers.