Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Recursion in C

A programming technique in which a function may call itself.... Recursive programming is


especially well-suited to parsing nested markup structures

What does static variable mean in C?

Static is an access qualifier that limits the scope but causes the variable to exist for the
lifetime of the program....

Differences between structures and arrays

The following are the differences between structures and arrays: Array elements are
homogeneous. Structure elements are of different data type....

Differentiate between the = symbol and == symbol?

The = symbol is usually used in mathematical operations. It is used to assign a value to a


given variable while the == symbol is a relational operator that is used to compare two
values.

What is the use of printf() and scanf() functions?


The printf() function is used for output and scanf() function is used for input.

What is the difference between local variable and global variable in C?


Local variable: A variable which is declared inside function or block is known as local
variable.

Global variable: A variable which is declared outside function or block is known as global
variable.

What is array in C?
Array is a group of similar types of elements. It has contiguous memory location. It makes
the code optimized, easy to traverse and easy to sort.

What is pointer in C?
A pointer is a variable that refers to the address of a value. It makes the code optimized
and makes the performance fast.

What are the usage of pointer in C?

● Accessing array elements

● Dynamic memory allocation

● Call by Reference

● Data Structures like tree, graph, linked list etc.

What is structure?
Structure is a user-defined data type that allows to store multiple types of data in a single
unit. It occupies the sum of memory of all members
What is C++?
C++ is an object oriented programming language created by Bjarne Stroustrup. It is
released in 1985.

What are the advantages of C++?


C++ doesn't only maintains all aspects from C language, it also simplify memory
management and add several features like:

● Includes a new datatype known as a class.

● Allows object oriented programming.

What is the difference between C and C++?


N
C C++
o.

C follows the procedural style C++ is multi-paradigm. It supports both


1)
programming. procedural and object oriented.

In C++, you can use modifiers for class


2) Data is less secured in C. members to make it inaccessible for outside
users.

3) C follows the top-down approach. C++ follows the bottom-up approach.

C does not support function


4) C++ supports function overloading.
overloading.

In C, you can't use functions in


5) In C++, you can use functions in structure.
structure.

C does not support reference


6) C++ supports reference variables.
variables.

In C, scanf() and printf() are C++ mainly uses stream cin and cout to perform
6)
mainly used for input/output. input and output operations.

What is a class?
Class is a user-defined data type. Class defines the type definition of category of things. It
defines a datatype, but it does not define the data it just specifies the structure of data.

You can create N number of objects from a class.

What is an object?
Object is the instance of a class. A class provides a blueprint for objects. So you can create
an object from a class. The objects of a class are declared with the same sort of declaration
that we declare variables of basic types.

What are the C++ access specifiers?


The access specifiers are used to define how to functions and variables can be accessed
outside the class.

There are three types of access specifiers:


● Private: Functions and variables declared as private can be accessed only within the
same class and they cannot be accessed outside the class they are declared.
● Public: Functions and variables declared under public can be accessed from
anywhere.
● Protected: Functions and variables declared as protected cannot be accessed
outside the class except a child class. This specifier is generally used in inheritance.

What is Object Oriented Programming (OOP)?


OOP is a methodology or paradigm that provides many concepts. The basic concepts of
Object Oriented Programming are given below:

Classes and Objects: Classes are used to specify the structure of the data. They define
datatype. You can create any number of objects from a class. Objects are the instances of
classes.

Encapsulation: Encapsulation is a mechanism which binds the data and associated


operations together and thus hide the data from outside world. Encapsulation is also known
as data hiding. In C++, It is achieved using the access specifiers i.e. public, private and
protected.

Abstraction: Abstraction is used to hide the internal implementations and show only the
necessary details to the outer world. Data abstraction is implemented using interfaces and
abstract classes in C++.

Some people confused about Encapsulation and abstraction. But they both are different.

Inheritance: Inheritance is used to inherit the property of one class into another class. It
facilitates you to define one class in term of another class.

What is overloading?
C++ facilitates you to specify more than one definition for a function name or an operator in
the same scope. It is called function overloading and operator overloading respectively.

What is function overriding?


If you inherit a class into a derived class and provide a definition for one of the base class's
function again inside the derived class, then this function is called overridden function and
this mechanism is known as function overriding.

What is constructor?
Constructor is a special method that initializes object. It name must be same as class name.

Scope resolution operator in c++


Scope resolution operator (::) is used to define a function outside a class or when we want to use
a global variable but also has a local variable with same name.

Queue
queues are a type of container adaptor, specifically designed to operate in a FIFO context (first-
in first-out), where elements are inserted into one end of the container and extracted from the
other.
Stacks
Stacks are a type of container adaptor, specifically designed to operate in a LIFO context (last-in
first-out), where elements are inserted and extracted only from one end of the container.

Linked Lists
A linked list is a linear data structure where each element is a separate object. Each element (we will call
it a node) of a list is comprising of two items - the data and a reference to the next node. The last node
has a reference to null.

You might also like