Sei sulla pagina 1di 5

C-LANGUAGE

1.What is C language?

2.What does static variable mean?

3.What are the different storage classes in C?

4.What is hashing?

5.Can static variables be declared in a header file?

6.Can a variable be both constant and volatile?

7.Can include files be nested?

8.What is a null pointer?

9.What is the output of printf ("%d")?

10.What is the difference between calloc () and malloc ()?

11.What is the difference between printf() and sprintf ()?

12.How to reduce a final size of executable?

13.Can you tell me how to check whether a linked list is circular?

14.Advantages of a macro over a function?

15.What is the difference between strings and character arrays?

16.Write down the equivalent pointer expression for referring the same
element a[i][j][k][l] ?

17.Which bit wise operator is suitable for checking whether a particular bit
is on or off?

18.Which bit wise operator is suitable for turning off a particular bit in a
number?

19.Does there exist any other function which can be used to convert an
integer or a float to a string?

20.What is encapsulation?

21.What is polymorphism?

22.What is inheritance?

23.What is hashing? Why do we use hashing and not arrays? How do we implement
a Hash table?

24.What are function pointers? Give the syntax for the same.

25.What is the output of printf("%d")?


26.What is Dangling pointer?

27.What is Namespace?

28.Can we have "Virtual Constructors"?

29.What is the difference between "overloading" and "overridding"?

30.What are all the implicit member functions of the class? Or what are all the functions
which compiler implements for us if we don't define one?

Ans:
default ctor
copy ctor
assignment operator
default destructor
address operator

31.What is diff between malloc()/free() and new/delete?

Ans:

Malloc allocates memory for object in heap but doesn't invoke object's constructor to
initiallize the object.
new allocates memory and also invokes constructor to initialize the object.
malloc() and free() do not support object semantics
Does not construct and destruct objects
string * ptr = (string *)(malloc (sizeof(string)))
Are not safe
Does not calculate the size of the objects that it construct
Returns a pointer to void
int *p = (int *) (malloc(sizeof(int)));
int *p = new int;
Are not extensible
new and delete can be overloaded in a class
"delete" first calls the object's termination routine (i.e. its destructor) and then releases
the space the object occupied on the heap memory. If an array of objects was created
using new, then delete must be told that it is dealing with an array by preceding the
name with an empty []:-
Int_t *my_ints = new Int_t[10];
...
delete []my_ints;

32.What is the diff between "new" and "operator new”?

"operator new" works like malloc.

33.What is difference between template and macro?

Ans:

There is no way for the compiler to verify that the macro parameters are of compatible
types. The macro is expanded without any special type checking.
If macro parameter has a post incremented variable ( like c++ ), the increment is
performed two times.
Because macros are expanded by the preprocessor, compiler error messages will refer
to the expanded macro, rather than the macro definition itself. Also, the macro will show
up in expanded form during debugging.

34.What are C++ storage classes?

Ans:

auto
register
static
extern

auto: the default. Variables are automatically created and initialized when they are
defined and are destroyed at the end of the block containing their definition. They are not
visible outside that block

register: a type of auto variable. a suggestion to the compiler to use a CPU register for
performance

static: a variable that is known only in the function that contains its definition but is never
destroyed and retains its value between calls to that function. It exists from the time the
program begins execution

extern: a static variable whose definition and placement is determined when all object
and library modules are combined (linked) to form the executable code file. It can be
visible outside the file where it is defined.

35.What are storage qualifiers in C++?

Ans:

They are...
const
volatile
mutable

Const keyword indicates that memory once initialized, should not be altered by a
program.

Volatile keyword indicates that the value in the memory location can be altered even
though nothing in the program code modifies the contents. For example if you have a
pointer to hardware location that contains the time, where hardware changes the value
of this pointer variable and not the program. The intent of this keyword to improve the
optimization ability of the compiler.

Mutable keyword indicates that particular member of a structure or class can be altered
even if a particular structure variable, class, or class member function is constant.
struct data
{
char name[80];
mutable double salary;
}
const data MyStruct = { "Satish Shetty", 1000 }; //initlized by complier
strcpy ( MyStruct.name, "Shilpa Shetty"); // compiler error
MyStruct.salaray = 2000 ; // complier is happy allowed
DATA STRUCTURE

1.What is a data structure?

2.List out the areas in which data structures are applied extensively

3.What are the major data structures used in the following areas: RDBMS, Network data
model & Hierarchical data model?

4.If you are using C language to implement the heterogeneous linked list, what pointer
type will you use?

5.Minimum number of queues needed to implement the priority queue?

6.What is the data structures used to perform recursion?

7.What are the notations used in Evaluation of Arithmetic Expressions using prefix and
postfix forms?

8.Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent Prefix and


Postfix notations.

9.Sorting is not possible by using which of the following methods?

(a) Insertion

(b) Selection

(c) Exchange

(d) Deletion

10.A binary tree with 20 nodes has null branches?

11.What are the methods available in storing sequential files?

12.How many different trees are possible with 10 nodes?

13.List out few of the Application of tree data-structure?

14.List out few of the applications that make use of Multilinked Structures?

15.In tree construction which is the suitable efficient data structure?

16.What is the type of the algorithm used in solving the 8 Queens problem?

17.In an AVL tree, at what condition the balancing is to be done?

18.What is the bucket size, when the overlapping and collision occur at same time?
19.There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could
have formed a full binary tree?

20.Sort the given values using Quick Sort? 65, 70, 75, 80, 85, 60, 55, 50, 45

21.For the given graph, draw the DFS and BFS?

22.Classify the Hashing Functions based on the various methods by which the key value
is found.

23.What are the types of Collision Resolution Techniques and the methods used in each
of the type?

24.In RDBMS, what is the efficient data structure used in the internal storage
representation?

25.Draw the B-tree of order 3 created by inserting the following data arriving in sequence
– 92 24 6 7 11 8 22 4 5 16 19 20 78

26.Of the following tree structure, which is, efficient considering space and time
complexities?

(a)Incomplete Binary Tree

(b)Complete Binary Tree

(c)Full Binary Tree

27.What is a spanning Tree?

28.Does the minimum spanning tree of a graph give the shortest distance between any
two specified nodes?

29.Which is the simplest file structure?

(a)Sequential

(b)Indexed

(c)Random

30.Whether Linked List is linear or Non-linear data structure?

31.Draw a binary Tree for the expression:A * B - (C + D) * (P / Q)

Potrebbero piacerti anche