ashutosh


{ City }
< Country > india
* Profession *
User No # 47074
Total Questions Posted # 0
Total Answers Posted # 5

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

Users Marked my Answers as Correct # 207
Users Marked my Answers as Wrong # 72
Questions / { ashutosh }
Questions Answers Category Views Company eMail




Answers / { ashutosh }

Question { TCS, 20305 }

what is the diff b/w MUTEX and semaphore?


Answer

Mutex is used for mutual exclusion, only one thread at a
time can use the resourse.
If Mutex is locked by one thread can not unlocked by
another thread.

Semaphore is used when we want one or more thread can use
the resouse at a time.
If Sem object is locked by one thread, it can be unlocked
in other thread.

Is This Answer Correct ?    9 Yes 0 No

Question { 5923 }

out put of printf(ā€œ%dā€,printf(ram));


Answer

ram3
printf will print ram and printf function returns the
number of character it prints, so it will return 3, and
hence it will print ram3

Is This Answer Correct ?    19 Yes 4 No


Question { InterGraph, 43444 }

Program to find the sum of digits of a given number until
the sum becomes a single digit


Answer

int n = 123456789; //any numer of you want sum
int sum = 0;
while (n > 0)
{
int p = n % 10;
sum = sum + p;
n = n / 10;
if(n==0 && sum>9)
{
n=sum;
sum=0;
}
}
printf("%d",sum);

Is This Answer Correct ?    157 Yes 63 No

Question { Impiger, 5475 }

Write down the program to sort the array.


Answer

for(i=0;i {
for(j=0;j {
if(arr[j] >a[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}

Is This Answer Correct ?    15 Yes 4 No

Question { IBM, 9281 }

why all c++ program must have default constructor?


Answer

To initialized objects of class, if you do not create your
own.Its a inbuilt feature of C++ compiler.

Is This Answer Correct ?    7 Yes 1 No