Fresherinfo - C Language Interview Question and Answers For TCS, Wipro, Infosys
Fresherinfo - C Language Interview Question and Answers For TCS, Wipro, Infosys
THIS fresherinfo ARE USEFUL TO HELP THEM TO LEARN ABOUT THE ALL ASPECTS OF THE THINGS
RELATED TO YOUR CAREER AS JOBs COLLEGES SUBJECTS INFO .
C Language
Interview Question and Answers for tcs,wipro,infosys
1. What is C language?
C is a programming language developed at AT & T's Bell
Laboratories of
USA in 1972.The C programming language is a standardized
programming language developed in the early 1970s by Ken Thompson
and Dennis
Ritchie for use on the UNIX operating system. It has since
spread to many
other operating systems, and is one of the most widely
used programming
languages
§ Primary
constants
§ Secondary
constants
§ Type
Declaration Instruction
§ Arithmetic
Instruction
§ Control
Instruction
4. What is a pointer?
Pointers are variables which stores the address of another
variable. That
variable may be a scalar (including another pointer), or an
aggregate
(array or structure). The pointed-to object may be part of a larger
object,
such as a field of a structure or an element in an array.
§ It
is used for dynamic memory allocation.
§ It
is used in Call by reference.
§ It
is used in data structures like trees, graph, linked list etc.
§ It is
the starting function.
§ It
returns an int value to the environment that called the program.
§ Recursive
call is allowed for main( ) also.
§ It is a
user-defined function.
There
are four types of storage classes.
§ Automatic
§ Extern
§ Regiter
§ Static
123456789
. Define destuctors?
What is a macro?
§ It
reduces the Complexity in a program by reducing the code.
§ Function
are easily understanding and reliability and execution is faster.
§ It also
reduces the Time to run a program.In other way,Its directly proportional to
Complexity.
§ Its
easy to find-out the errors due to the blocks made as function definition
outside the main
function.
We can declare an array by specify its data type, name and the
number of
elements the array holds between square brackets immediately
following
the array name.
syntax :
data_type array_name[size];
A structure variable contains
each of the named members,
and its size is large enough to
hold all the members. Structure
elements are
of same size.
Array is
collection of similar datatype. it is a static memory allocation means we can
not
increment and decrement the arry size once we allocated. and we can not
increment the base
address, reassign address.
Pointer is a
dynamic memory allocation. we can allocate the size as we want, assigning
into
another variable and base address incrementation is allowed.
Dynamic binding (also known as late binding) means that the code
associated with a given
procedure call is not known until the time of the
call at run time.It is associated with
polymorphism and inheritance.
§ By
default, the members ot structures are public while that tor class is
private.
§ structures
doesn’t provide something like data hiding which is provided by the classes.
§ structures
contains only data while class bind both data and member functions.
1234567891011121314
What is
static
identifier?
§ Code
reusability
§ Saves
time in program development.
While overloading a function, the return type of the functions need to be the
same.
123456789101112131415
Define
a
class?
const char* const p - p is the constant pointer which points to the constant
string, both value and
address are constants.
Realloc(ptr,n)
function uses two arguments.
§ The
first argument ptr is a pointer to a block of memory for which the size is
to
be altered.
§ The
second argument n specifies the new size.The size may be increased or
decreased.
§ New
initializes the allocated memory by calling the constructor. Memory allocated
with new should
be released with delete.
§ Malloc
allocates uninitialized memory.
§ The
allocated memory has to be released with free.new automatically calls the
constructor while
malloc(dosen’t)
What is recursion?
§ An
array holds elements that have the same data type.
§ Array elements
are stored in subsequent memory locations
§ Two-dimensional
array elements are stored row by row in subsequent memory locations.
§ Array
name represents the address of the starting element
48. What is the differentiate between for loop and a while loop?
What are it uses?
Examples :
Pointer
variable are initialized in two ways :
§ Static
memory allocation
§ Dynamic
memory allocation
12345678910111213141
What is
dynamic
array?
62. What are macros? What are its advantages and disadvantages?
What are
register
variables?
What are
the
advantages
of using
register
variables?
What is
storage
class?
What
are the
different
storage
classes
in C?
75. In C, why is the void pointer useful? When would you use it?
Pointer
variables are initialized by one of the following ways.
§ Static
memory allocation
§ Dynamic
memory allocation
§ The
same auto variable name can be used in different blocks.
§ There
is no side effect by changing the values in the blocks.
§ The
memory is economically used.
§ Auto
variables have inlierent protection because of local scope.
What is
pointer
to a
pointer?
**p2,
v=10;P1=&v; p2=&p1;
The functions that are predefined and supplied along with the
compiler are known as built in
functions. They are also known as library functions.
Can a
Structure
contain a
Pointer
to itself?
Array
§ Array
allocates space automatically.
§ It
cannot be resized
§ It
cannot be reassigned.
§ size of
(arrayname) gives the number of bytes occupied by the array.
Pointer
§ Explicitly
assigned to point to an allocated space.
§ It can
be sized using realloc() 3-pointer can be reassigned.
§ sizeof
(p) returns the number of bytes used to store the pointer variable p.
Syntax Error
§ These
involves validation of syntax of language.
§ compiler
prints diagnostic message.
Logical Error
§ logical
error are caused by an incorrect algorithm or by a statement mistyped in such
a way that it
doesn’t violet syntax of language.
§ difficult
to find.
#include“filename”
#include - the first form is used to search the directory that contains the
source file.If
the search fails in the home directory it searches the
implementation defined
locations.In the second form ,the preprocessor
searches the file only in the
implementation defined locations.
The arguments of
memmove() can
overlap in memory.
The arguments
of
memcpy() cannot.
What are
the pointer
declarations
used in C?
§ Array
of pointers, e.g , int *a[10]; Array of pointers to integer
§ Pointers
to an array,e.g , int (*a)[10]; Pointer to an array of into
§ Function
returning a pointer,e.g, float *f( ) ; Function returning a pointer to float
§ Pointer
to a pointer ,e.g, int **x; Pointer to apointer to int
§ pointer
to a data type ,e.g, char *p; pointer to char
wwwcareercomcom.blogspot.in
No comments:
Post a Comment
Home
View web version
Powered by Blogger.
About Me
Unknown