shruti


{ City } pune
< Country > india
* Profession * sap - technical consultant
User No # 13969
Total Questions Posted # 0
Total Answers Posted # 68

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 1350
Users Marked my Answers as Wrong # 556
Answers / { shruti }

Question { TCS, 12960 }

The C language terminator is
a.semicolon
b.colon
c.period
d.exclamation mark


Answer

terminator in C language is a SEMICOLON...

Is This Answer Correct ?    12 Yes 1 No

Question { TCS, 23254 }

What is true about the following
C Functions
a.Need not return any value
b.Should always return an integer
c.Should always return a float
d.Should always return more than one value.


Answer

Need not return any value.

its acceptable if a function does not return any value
provided its return type is "void"..

if its return type is char , int , float.. then it has to
return that respective type of value

Is This Answer Correct ?    8 Yes 0 No


Question { FCI, 18485 }

Which of the following about automatic variables within a
function is correct ?
a.its type must be declared before using the variable
b.they are local
c.they are not initialised to zero
d.they are global.


Answer

yup options a , b , c are correct..

Is This Answer Correct ?    1 Yes 5 No

Question { TCS, 10614 }

Write one statement equalent to the following two statements
x=sqr(a);
return(x);
Choose from one of the alternatives
a.return(sqr(a));
b.printf("sqr(a)");
c.return(a*a*a);
d.printf("%d",sqr(a));


Answer

i think both a and d will work..

Is This Answer Correct ?    6 Yes 1 No

Question { TCS, 23357 }

Which of the following is not an infinite loop ?
a.while(1){
....
}
b.for(;;){
...
}
c.x=0;
do{
/*x unaltered within theloop*/
...
}while(x==0);
d.# define TRUE 0
...
while(TRUE){
....
}


Answer

a.

while (1) is an infinite loop..

Is This Answer Correct ?    3 Yes 9 No

Question { TCS, 18323 }

what does the following function print?
func(int i)
{
if(i%2)return 0;
eale return 1;
}
main()
{
int =3;
i=func(i);
i=func(i);
printf("%d",i);}


Answer

if eale is else
and
int = 3 is int i = 3

then,

the answer is 1...

Is This Answer Correct ?    7 Yes 3 No

Question { Microsoft, 18562 }

# define prod(a,b)=a*b
main()
{
int x=2;
int y=3;
printf("%d",prod(x+2,y-10)); }

the output of the program is
a.8
b.6
c.7
d.none


Answer

the syntax for writting the macro is wrong..

we can't have "=" sign while writing macro..
i.e. #define -----

Is This Answer Correct ?    8 Yes 0 No

Question { Assurgent, 14152 }

which of the following statements is incorrect
a.typedef struct new{
int n1;
char n2;
} DATA;
b.typedef struct {
int n3;
char *n4;
}ICE;
c.typedef union {
int n5;
float n6;
} UDT;
d.#typedef union {
int n7;
float n8;
} TUDAT;


Answer

b and d are wrong..

Is This Answer Correct ?    2 Yes 6 No

Question { HCL, 24282 }

main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?




Answer

-> while(*p2++ "=" *p1++)
the syntax of while is
while("condition");

in condition statement the assignment operator is used in a
wrong way..
when we are using loop it should be "=="..

we cannot copy the value of p1 in p2, the way its mentioned
here..


** It will either give an error or display some garbage
value in p2 , or no value..
depends on what p2 is initialised to implicitly..

Is This Answer Correct ?    1 Yes 12 No

Question { TCS, 54193 }


main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n",x,y);
}

output??


Answer

the ans is 11 and 16..

y = ++y;

wont make any differance as a statement.

we will have to think about it only if we are using it in
loops.. or conditional statements etc.. :-)

so dont get confused.
dont forget ur basics..

C is a procedural language.
hence

x = x++;
will be completely executed first
the value of x = 11.

and then

y = ++y;
will be executed and value will be changed to 16

Is This Answer Correct ?    11 Yes 11 No

Question { 2898 }

Suppose I want to write a function that takes a generic
pointer as an argument and I want to simulate passing it by
reference. Can I give the formal parameter type void **, and
do something like this?

void f(void **);
double *dp;
f((void **)&dp);


Answer

why **??

function that takes generic pointer argument.
declare pointer as void *

void f(void *);

Is This Answer Correct ?    1 Yes 0 No

Question { MAHINDRA, 81887 }

what is the difference between arrays and linked list


Answer

the main differance between arrays and linked list is:

In array we follow static memory allocation.
i.e we assign memory to the particular element in advance.


in linked list -> dynamic memory allocation.
i.e we assign memory to the particular element at run-time..


hence we reserve only the amount of memory which is
required.

there is no problem of memory shortage or wastage, in
linked list. which we very frequently come accross in the
arrays..

Is This Answer Correct ?    137 Yes 21 No

Question { 7256 }

How can I return multiple values from a function?


Answer

use of pointers.
call by refrance.

Is This Answer Correct ?    2 Yes 1 No

Question { Microsoft, 59628 }

how to check whether a linked list is circular.


Answer

consider home pointer as the starting pointer of the linked
list.
consider temp as the temporary pointer.


temp = home;
while(temp != NULL)
{
if(temp -> next == start)
{
flag = 1;
break;
}
else
flag = 0;
temp = temp -> next;
}

if(flag == 1)
printf("Circular");
else
printf("Not circular");

Is This Answer Correct ?    30 Yes 30 No

Question { TCS, 45646 }

print a semicolon using Cprogram without using a semicolon
any where in the C code in ur program!!


Answer

Does anyone know why its working??

("%c", 59)???

because 59 is the ascii value for a semicolon..

hence we are printing a character against a number..

This was juss as little information..
few may get confused.. :-)

Is This Answer Correct ?    11 Yes 2 No

Prev    1    [2]   3   4   5    Next