Members BookmarksPolls Fresher Jobs Funny Pictures MCA Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

Advertisements


website counter



C Interview questions 2


Posted Date: 21 May 2008    Resource Type: Articles/Knowledge Sharing    Category: Jobs & Interviews

Posted By: Vidya       Member Level: Diamond
Rating:     Points: 1



1. What will be printed as the result of the operation below:
#define swap(a,b) a=a+b;b=a-b;a=a-b;

void main()
{
int x=5, y=10;
swap (x,y);
printf(“%d %d\n”,x,y);
swap2(x,y);
printf(“%d %d\n”,x,y);
}
int swap2(int a, int b)
{
int temp;
temp=a;
b=a;
a=temp;
return 0;
}

Answer: 10, 5
10, 5

2. What will be printed as the result of the operation below:
main()
{
char *p1;
char *p2;
p1=(char *)malloc(25);
p2=(char *)malloc(25);

strcpy(p1,”Hello”);
strcpy(p2,“Welcome”);
strcat(p1,p2);
printf(“%s”,p1);
}
Answer: HelloWelcome

12. What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf(“%d %d\n”,x,y);
}
Answer: 11, 16


13. What will be printed as the result of the operation below:
main()
{
int a=0;
if(a==0)
printf(“Hai Hello\n”);
printf(“Hai Hello \n”);
}
Answer: Two lines with “Hai Hello” will be printed.

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

Calloc() allocates a block of memory for an array of elements of a certain size.
By default the block is initialized to 0. The total number of memory allocated will be
(number of elements * size).

2. malloc() allocates memory blocks and returns a void pointer to the allocated
space, or NULL if there is insufficient memory available.


What will be printed as the result of the operation below:

main()
{
int x=32,y=45;

x=y++ + x++;

y= ++y + ++x;

printf(“%d%d\n”,x,y);
}
Answer : 79125


What is Preprocessor?
The preprocessor is used to modify your program according to the preprocessor
directives in your source code. Preprocessor directives (such as #define) give the
preprocessor specific instructions on how to modify your source code. The
preprocessor reads in all of your include files and the source code you are
compiling and creates a preprocessed version of your source code.

What is a const pointer?

A const pointer, or more correctly, a pointer to const, is a pointer which points to
data that is const (constant, or unchanging). A pointer to const is declared by
putting the word const at the beginning of the pointer declaration. This declares a
pointer which points to data that can’t be modified. The pointer itself can be
modified. The following example illustrates some legal and illegal uses of a const
pointer:
What is modular programming?
If a program is large, it is subdivided into a number of smaller programs that are
called modules or subprograms. If a complex problem is solved using more
modules, this approach is known as modular programming.


What is an lvalue?
An lvalue is an expression to which a value can be assigned. The lvalue expression
is located on the left side of an assignment statement, whereas an rvalue is located
on the right side of an assignment statement. Each assignment statement must
have an lvalue and an rvalue. The lvalue expression must reference a storable
variable in memory. It cannot be a constant.


Diffenentiate between an internal static and external static variable?
An internal static variable is declared inside a block with static storage class
whereas an external static variable is declared outside all the blocks in a file.An
internal static variable has persistent storage,block scope and no linkage.An
external static variable has permanent storage,file scope and internal linkage.


What is a pointer variable?
A pointer variable is a variable that may contain the address of another variable or
any valid address in the memory.

What is a pointer value and address?
A pointer value is a data object that refers to a memory location. Each memory
location is numbered in the memory. The number attached to a memory location is
called the address of the location.





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C Interview Questions
Previous Resource: Recruitment of Fresh Engineering Graduates at HAL
Return to Discussion Resource Index
Post New Resource
Category: Jobs & Interviews


Post resources and earn money!
 
Related Resources


Contact Us    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.