Pages

Monday, February 18, 2008

Questions based on C++


Basic concepts of OOPS:-
  1. Class
  2. Objects
  3. data Abstraction
  4. Data Encapsulation
  5. Inheritance
  6. Dynamic Binding
  7. Message Passing
Below some FAQS.
Q1:What is C++?
Ans:C++ is high level programing language that allows a software engineer to efficiently communicate with a Computer.

Q2:what is data type? and How many types?
Ans:A data type defines a set of values and the operations that can be performed on them.

Data type Description Size(bytes) Range
char character
1
0 to 255
int integer
2
-32767 to +32767
float floating point
4
approx 7 digits of precision
double floating point
8
approx 15 digits of precision
Q3:Steps in learning C++ language are: Ans:1.Character Set Alphabets,Digits and Special Symbols 2.Data types,Constants,Variables and Keywords 3.Instructions 4.Functions,Program Q4:Rules to write C++ program Ans:1.All C statements must end with semicolon. 2.C is case sensitive. 3.Braces must always match upon pairs 4.Comments cannot be enclosed. Comments stars with/*ends with*/This type of comment can span Multiple lines. The other type of comment begin with//and goes to end of the line. Q5:what are pre-processor commands? Ans:C supports two state statements.They are 1.#include 2.#define
Q6:What is function?
Ans:A function is a self contained block of statements that perform a coherent task of
some kind.

Q7:what is an Operater?
Ans:An operator is a symbol that tells the computer to perform certain mathematical
or logical manipulations.

Q8:Write a small Programe to addition of Two Numbers
Ans: /******************************
* To Addition of two Numbers *
*******************************/
//Author : Murali
#include<iostream.h>>
void main()
{
int a,b,c;
cout<<"Enter two Numbers : ";
cin>>a>>b;
c=a+b;
cout<<a;
}

Q9: Programs from conception to execution
Ans:C++ programs are written in a high-level language using letters,numbers,and the other symbols you find on a computer keyboard.Computers actually execute a very low-level language called machine code(a series of numbers).So,before a program can be used,it must undergo several transformations.

Programs chart out as an idea in a programmer's head.He writes down his thoughts in a file,called a source file or source code,using a text editor. This file transformed by the compiler into an Object file.

Q10:What is Recursion?
Ans:Recursion is a process by which a function calls itself repeatedly until specified condition is satisfied.
This process is used for(respective)repeated Calculations.

Q11:What is Stream?
Ans:A Stream is a sequence of bytes. It acts either a source form which the input can be obtained or as a destination to which the output can be sent.

Q12:What is Stream Clause?
Ans:The C++ I/O Stream contains a Hierarchy of clause that are used to define various streams to deal with both the console and disk files these clause are called "Stream Clause".

Q13:What is OOP?
Ans:Object Oriented Programing methodology that Associates Data Structures with a set of operators which acts upon it.

Q14:What is Template?
Ans:We can define Templates for both clause and functions a template can be used to create a family of classes or function.Template can be constructed as a kind of Macro.
Syntax:- template
class class_name
{
//class number specification with anonymous type T where Appropriate.
}

Q15:What is Inheritance?
Ans:Inheritance is the process by which objects of one class acquire the properties of another class. It supports the concept of hierarchical classification.

Q16:What is Pointer?
Ans: A Pointer is a variable that represents the location(rather than value) of a
data item. Such as a variable or an array element in pointer are used frequently in C and C++ as they have a number of useful applications, for example pointer can be used to pass information book and forth b/w reference and Point.

Q17:What is Class?
Ans:Class is a unique which consist both data and member function.
A class is enclosed with the both the data and functions that operate on the data, into single unit. The Variable and Function enclosed in a class are called data member function respectively.

Q18:What is Object?
Ans:Object are the basic runtime entities in an object oriented system.

Q19:What is Dynamic Arrays?
Ans:A Dynamic array is an array whose size is not specified when we write the program, but is determined while the programe is running in C++, an array variable is actually a pointer variable that points to the first indexed variable of the array.

Q20:What is Operator Overloading?
Ans:To define an additional task to an operator, we have to specify its new meaning. This can be done with a special function called operator function, which describes the true.

Q21:What is Control Statement?
Ans: Control Statement is used for the programe follow and check the condition of given expression or variable a constant the key word of control statement are normally a predefine or presort words.

Q22:What is Flow of Control?
Ans: The order in which the statements in your program are performed is called "Flow of Control".

Q22:What is Array?
Ans:"An Array is group of logically related data items of the same data type address by a common name and the items are stored in location is called Array".

Q23:What is String?
Ans: "A sequence of characters is called String".

Q24:What is Class Template?
Ans: Class can also be declared to operate on different data types such classes are called Class Template.

Q26:What is Inheritance?
Ans: "Inheritance is a tequnic of organization information in hierarchical form".

Q27:What is Linked List?
Ans: Linked List is a list of nodes in which each node as a member variable that is a pointer that points to next node in the list.

Q28:What are Nodes?
Ans: A Structure consists of items while we have drawn as boxes connected by arrows the boxes are called 'Nodes'. And the arrows represents pointer each of the node in point to other node not to the individual items such as 10 or rows that are inside the node.

Q29:What is Data Structure?
Ans:Data may be organized in many different ways,the logical or mathematical model of a particular organization of data is called Data Structure.

Q30:What is Stack?
Ans:The Stack is an order list in which all insertion and the deletion will made one end called top(Position) Stack.

No comments: