You are on page 1of 3

PCPP Questions

1. What is difference between C and C++?

C C++
1. C++ is non Procedural i.e Object oriented
1. C is Procedural Language.
Language.
2. The concept of virtual Functions are used in
2. No virtual Functions are present in C
C++.
3. The concept of polymorphism is used in C++.
3. In C, Polymorphism is not possible. Polymorphism is the most Important Feature of
OOPS.
4. Operator overloading is one of the greatest
4. Operator overloading is not possible in C.
Feature of C++.
5. Bottom up approach adopted in Program
5. Top down approach is used in Program Design.
Design.
6. Namespace Feature is present in C++ for
6. No namespace Feature is present in C Language.
avoiding Name collision.
7. Multiple Declaration of global variables are 7. Multiple Declaration of global varioables are
allowed. not allowed.
8. In C 8. In C++
scanf() Function used for Input. Cin>> Function used for Input.
printf() Function used for output. Cout<< Function used for output.

9. Mapping between Data and Function is difficult and 9. Mapping between Data and Function can be
complicated. used using "Objects"
10. In C, we can call main() Function through other 10. In C++, we cannot call main() Function
Functions through other functions.
11. C requires all the variables to be defined at the 11. C++ allows the declaration of variable
starting of a scope. anywhere in the scope i.e at time of its First use.
12. No inheritance is possible in C. 12. Inheritance is possible in C++
13. In C, malloc() and calloc() Functions are used for
13.In C++, new and delete operators are used
Memory Allocation and free() function for memory
for Memory Allocating and Deallocating.
Deallocating.
14. It support both built-in and user define data
14. It supports built-in and primitive data types.
types.
15. In C++, Exception Handling is done with Try
15. In C, Exception Handling is not present.
and Catch block.

2. What is a flowchart?
A flowchart is a graphic representation of how a process works, showing, at a
minimum, the sequence of steps. The flowchart is a means to visually
present the flow of data through an information processing systems, the
operations performed within the system and the sequence in which they are
performed. A flowchart is a diagram that represents a process or algorithm.
The steps are represented by a series of boxes or other specialized symbols,
then connected with arrows.

3. What is pseudo code?


Pseudocode (pronounced SOO-doh-kohd) is a detailed yet readable description
of what a computer program or algorithm must do, expressed in a formally-
styled natural language rather than in a programming language.

4. What is Unified Modeling Language (UML)?


The Unified Modeling Language (UML) is a general-purpose modeling
language in the field of software engineering, which is designed to provide a
standard way to visualize the design of a system.

5. What is the difference between Java and C++?

Java C++
Java does not support pointers, templates, unions, C++ supports structures, unions, templates, operator
operator overloading, structures etc. overloading, pointers and pointer arithmetic.

The Java language promoters initially said "No


pointers!", but when many programmers questioned
how you can work without pointers, the promoters
began saying "Restricted pointers." Java supports
what it calls "references". References act a lot like
pointers in C/C++ languages but you cannot perform
arithmetic on pointers in Java. References have types,
and they're type-safe. These references cannot be
interpreted as raw address and unsafe conversion is
not allowed.

Java support automatic garbage collection. It does not C++ support destructors, which is automatically
support destructors as C++ does. invoked when the object is destroyed.

Java does not support conditional compilation and Conditional inclusion (#ifdef #ifndef type) is one of
inclusion. the main features of C/C++.
Java has built in support for threads. In Java, there is C++ has no built in support for threads. C++ relies on
a Thread class that you inherit to create a new thread non-standard third-party libraries for thread support.
and override the run() method.

Java does not support default arguments. There is no C++ supports default arguments. C++ has
scope~resolution~operator (::) in Java. The method scope~resolution~operator (::) which is used to to
definitions must always occur within a class, so there define a method outside a class and to access a global
is no need for scope resolution there either. variable within from the scope where a local variable
also exists with the same name.
There is no goto statement in Java. The C++ has goto statement. However, it is not considered
keywords const and goto are reserved, even though good practice to use ofgoto statement.
they are not used.
Java doesn't provide multiple inheritance, at least not C++ does support multiple inheritance. The
in the same sense that C++ does. keyword virtual is used to resolve ambiguities
during multiple inheritance if there is any.
Exception handling in Java is different because there While in C++, you may not include the try/catch even
are no destructors. Also, in Java, try/catch must be if the function throws an exception.
defined if the function declares that it may throw an
exception.
Java has method overloading, but no operator C++ supports both method overloading and operator
overloading. The String class does use overloading.
the + and += operators to concatenate strings
and Stringexpressions use automatic type
conversion, but that's a special built-in case.

Java has built-in support for documentation C++ does not support documentation comments.
comments (/** ... */); therefore, Java source files
can contain their own documentation, which is read by
a separate tool usuallyjavadoc and reformatted into
HTML. This helps keeping documentation maintained
in easy way.
Java is interpreted for the most part and hence C++ generates object code and the same code may not
platform independent. run on different platforms.

You might also like