Sie sind auf Seite 1von 4

Define an array. Give an example.

An array is a collection of data items, all of the same type, accessed using a
common name. A one-dimensional array is like a list; A two dimensional array is
like a table; The C language places no limits on the number of dimensions in an
array, though specific implementations may.

Eg: int a[10];

Here a[10] is an array with 10 values.

Give example on call by reference.

The call by reference method of passing arguments to a function copies the


address of an argument into the formal parameter. Inside the function, the address
is used to access the actual argument used in the call. It means the changes made
to the parameter affect the passed argument.

What are the statements used for reading a file.


The fopen() function is used to open a file and associates an I/O stream with it.
The functions fread/fwrite are used for reading/writing data from/to the file opened
by fopen function.
The fseek() function is used to set the file position indicator for the stream to a new
position.
The fclose() function first flushes the stream opened by fopen() and then closes the
underlying descriptor.
Define the need for Union in C.

A union is a special data type available in C that allows to store different data types
in the same memory location. You can define a union with many members, but
only one member can contain a value at any given time.

What are abstract data types?

In computer science, an abstract data type (ADT) is a mathematical model for


data types where a data type is defined by its behavior (semantics) from the
point of view of a user of the data, specifically in terms of possible values, possible
operations on data of this type, and the behavior of these operations.

What is circular linked list?

In a circularly linked list, all nodes are linked in a continuous circle, without using
null. For lists with a front and a back (such as a queue), one stores a reference to
the last node in the list. The next node after the last node is the first node. ...
Circularly linked lists can be either singly or doubly linked.

Give the applications of Stack

Expression evaluation and syntax parsing. Calculators employing reverse Polish


notation use a stack structure to hold values. Expressions can be represented in
prefix, postfix or infix notations and conversion from one form to another may be
accomplished using a stack.
1. Expression evaluation

2. Backtracking (game playing, finding paths, exhaustive searching)

3. Memory management, run-time environment for nested language features.

What is doubly ended queue?

Double-ended queue. ... In computer science, a double-ended queue (dequeue,


often abbreviated to deque) is an abstract data type that generalizes a queue, for
which elements can be added to or removed from either the front (head) or back
(tail).

Define extendible hashing.

Extendible hashing is a type of hash system which treats a hash as a bit string,
and uses a trie for bucket lookup. Because of the hierarchical nature of the system,
re-hashing is an incremental operation (done one bucket at a time, as needed). This
means that time-sensitive applications are less affected by table growth than by
standard full-table rehashes.

Differentiate internal and external sorting.

In internal sorting all the data to sort is stored in memory at all times while
sorting is in progress. In external sorting data is stored outside memory (like on
disk) and only loaded into memory in small chunks. External sorting is usually
applied in cases when data can't fit into memory entirely.

Internal Sorting takes place in the main memory of a computer. The internal sorting
methods are applied to small collection of data

List out the Conditional and Control statements in C.

Conditional statements
1. if statement
2. if-else statement
3. ternary statement or ternary operator
4. nested if-else statement
5. switch statement

Control statements
while loop
do...while loop
for loop

What is function? List out merits of functions

A function is a group of statements that together perform a task. ... A function


declaration tells the compiler about a function's name, return type, and
parameters. A function definition provides the actual body of the function. The C
standard library provides numerous built-in functions that your program can call.

merits of functions
Modular and Structural Programming can be done
1. We can divide c program in smaller modules.
2. Modular programming makes C program more readable.
3. Modules once created , can be re-used in other programs.

Define fread() and fwrite()


fwrite() function
The fwrite() function is used to write records (sequence of bytes) to the file. A record may be an
array or a structure.

Syntax of fwrite() function

fwrite( ptr, int size, int n, FILE *fp );

fread() function
The fread() function is used to read bytes form the file.

Syntax of fread() function

fread( ptr, int size, int n, FILE *fp );


How does an append mode differ from a write mode?
Append mode is used when you need to reatin the data in the file while adding new
data into it.
write mode will remove the existing contents of the file and retain only the data that
is newly added.
Write mode over writes the existing file and if not present creates a new one.
Append mode never over writes the existing file.

Define List ADT


The ADT List is a linear sequence of an arbitrary number of items, together with.
The name list is also used for several concrete data structures that can be used
to implement abstract lists, especially linked lists. Many programming languages
provide support for list data types, and have special syntax and semantics for lists
and list operations.

Define polynomial ADT


A polynomial object is a homogeneous ordered list of pairs
<exponent,coefficient>, where each coefficient is unique. Operations include
returning the degree, extracting the coefficient for a given exponent, addition,
multiplication, evaluation for a given input.

Differentiate linear Search and Binary Search.


A linear search starts at the beginning of a list of values, and checks 1 by 1 in
order for the result you are looking for. A binary search starts in the middle of a
sorted array, and determines which side (if any) the value you are looking for is on.
Linear search, also known as the sequential search is the simplest search algorithm.
It searches for a specified value in a list by checking every element in the list.
Binary search is also a method used to locate a specified value in a sorted list.
Binary search method halves the number of elements checked (in each iteration),
reducing the time taken to locate the given item in the list.

List out the various types of sorting Techniques


Bubble sort
Selection sort
Insertion sort
Shell Sort
Merge Sort
Quick Sort
Radix Sort
Heap Sort

Das könnte Ihnen auch gefallen