ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories >> Software >> Programming-Languages >> C
 
 


 

Back to Questions Page
 
Question
Average of a couple 10 years ago was 25. The average 
remains same after having a child and twins after 3 years. 
What is the present age of the first child
Rank Answer Posted By  
 Question Submitted By :: Surya
This Interview Question Asked @   IBM , Infosys
I also faced this Question!!   © ALL Interview .com
Answer
ans plz
 
0
Surya
 
 
Answer
5 years
 
0
Ranjana Gupta
 
 
Answer
3
 
0
Shashikant
 
 
 
Answer
35
 
0
Om
 
 
Answer
since the age of child is asked,his present age is
3yrs.
 
0
Dilpreet
 
 
Answer
Can any one explain the solution? plz
 
0
Dinesh
 
 
Answer
the average is not important at all,
tricky question.
10 years ago, the child was born,3 years later, the twins 
were born....what is the present age
the answer is 10!!!!
who gives a damn about the average???!
 
0
Boomer
 
 
Answer
Ans:
The present age of the first child is 13 yrs
Explanation:
Here the average of couple is in concern. 10 years ago the 
average of couple was 25. And it is said that the average 
of couple remains same after having a child and twins after 
3 years. Now that means, 10 years ago they were having 3 
children with their first child 3 years old and twins with 
0 yrs. And hence the present age of the first child is 3+10 
which is 13.
 
2
Deepa
 
 
Answer
Ans=21

Explanation:
10 years ago the average of couple was 25 and their current
ave is also 25.
Total number of People=5
25*5=125
so the current total of their ages=125
and current total age of couple=25*2+10*2=70

125-70=55

So the current total of the ages of 3 children=55
age of the twins=17 each and present age of the first child=21.
 
0
Kirti
 
 
Question
1,1,5,17,61,217,?,?.
Rank Answer Posted By  
 Question Submitted By :: Balu
I also faced this Question!!   © ALL Interview .com
Answer
773,2753

The logic looks like this
The number at position x will be
(number at x-1) * 3 + (number at x-2) *2
 
0
Prasad Shetty
 
 
Answer
356
 
0
Hari
 
 
Answer
1025
 
0
Vignesh1988i
 
 
Question
1,4,8,13,21,30,36,45,54,63,73,?,?.
Rank Answer Posted By  
 Question Submitted By :: Basheer
This Interview Question Asked @   Franklin-Templeton , Amb, Franklin
I also faced this Question!!   © ALL Interview .com
Answer
8*2=16-3=13
8*3=24-3=21
8*5=40-4=36
8*6=48-3=45
8*7=56-2=54
8*8=64-1=63
8*9=72+1=73
8*10=80+2=82
8*11=88+3=91
8*12=96+4=100.
i dont no wheather this answer is right or wrong.any body 
knows this question answer plz send email
 
0
Sandhya.murukutla
 
 
Answer
1
1 + one (3 letters) = 4
4 + four (4 letters) = 8
8 + eight (5 letters) = 13
13 + thirteen (8 letters) = 21
21 + twenty one (9 letters) = 30
and so forth
 
0
Thomas
 
 
Answer
84
 
0
Vignesh1988i
 
 
Answer
85
 
0
Hitesh Patel
 
 
Answer
83.85
 
0
Mody
 
 
Question
N O S I E R
 + A S T R A L
----------------
   7 2 5 6 1 3
Rank Answer Posted By  
 Question Submitted By :: Balu
This Interview Question Asked @   Honeywell
I also faced this Question!!   © ALL Interview .com
Answer
0 3 8 4 5 1
6 8 7 1 6 2
-----------
7 2 5 6 1 3

0-N, 1-R, 2-L, 3-O, 4-I, 5-E, 6-A, 7-T and 8-S
 
0
Chakkaravarthi Ss
 
 
Answer
INLETS
 
0
Yfrkgf
 
 
Question
O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N
Rank Answer Posted By  
 Question Submitted By :: Surya
This Interview Question Asked @   ADP
I also faced this Question!!   © ALL Interview .com
Answer
O-> One
T-> Two
like
 
3
Surya
 
 
Answer
n-- 1st
o-- 2nd
t-- 3 rd

Series is repeated again.
 
5
Pritam
 
 
Answer
o-1
t-2
t-3
f-4
f-5
s-6
s-7
e-8
n-9
T-10
E-11
T-12
t-13
f-14
.
.
.
.
n-19
it is simply the 1,2,3... order
 
5
Nishanth
 
 
Answer
o-1
t-2
t-3
f-4
f-5
s-6
s-7
e-8
n-9
T-10
E-11
T-12
t-13
f-14
f-15
s-16
s-17
e-18
n-19
it is Just numarical order in  alpha betical manner
 
0
Harish
 
 
Answer
N
O
T
it is reapetedly 
like:
O,T,T,F,F,S,S,E,N,n,o,t,T,F,F,S,S,E,N,.....
 
0
Raghavendra Reddy
 
 
Answer
1  = One    = O
2  = Two    = T
3  = Three  = T
4  = Four   = F
5  = Five   = F
6  = Six    = S
7  = Seven  = S
8  = Eight  = E
9  = Nine   = N
10 = Ten    = T

Just look at the first letter of the number and then that 
will be you letter
 
0
Jacob
 
 
Answer
by seeing we can understand that .....N O T fit as the
correct possible
 
0
Gallanticscorp
 
 
Answer
one - 1
Two - 2
and so on 
Nine - 9 
Ten - 10
Eleven - 11
twelev - 12
 
0
Ranjitha
 
 
Answer
Just stating the obvious:

T, E, T

Given that they are the first letters of the positive integers.
 
0
Tom The Frog
 
 
Question
what is the advantage of function pointer
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   TCS , LG Soft
I also faced this Question!!   © ALL Interview .com
Answer
code complexcity is less
 
3
Rajesh
 
 
Answer
It is useful when you want to send function as argument to 
another function.
 
1
Yogesh
 
 
Answer
Functional pointer are more readable and executed run time
 
0
Satty
 
 
Answer
function of pointer is  more useful for use of large 
function argument.it creats less complecty in function 
argument.
 
0
Maskfriend
 
 
Answer
Function pointers are very important while implementing 
Callback in C, for instance if Software has layered 
archiecture, Function pointer are used bye upper layer to 
register with below layer on certain conditions (i.e. some 
event or interrupt)
 
3
Mahend
 
 
Answer
TO implement call back functions.......
 
0
Ajay
 
 
Answer
Function pointers are very useful to send the function as a 
parameter to the another function.so,execution time will be 
saved.code complexity will be redused
 
0
Prakash
 
 
Answer
Answer:
Pointers to functions are interesting when you pass them to
other functions. A function that takes function
pointers says, in effect, “Part of what I do can be
customized. Give me a pointer to a function, and I’ll call
it when that part of the job needs to be done. That function
can do its part for me.” This is known as a
“callback.” It’s used a lot in graphical user interface
libraries, in which the style of a display is built into the
library but the contents of the display are part of the
application.
As a simpler example, say you have an array of character
pointers (char*s), and you want to sort it by the value
of the strings the character pointers point to. The standard
qsort() function uses function pointers to
perform that task. (For more on sorting, see Chapter III,
“Sorting and Searching Data.”) qsort() takes four
arguments,
u a pointer to the beginning of the array,
u the number of elements in the array,
u the size of each array element, and
u a comparison function,
and returns an int.
The comparison function takes two arguments, each a pointer
to an element. The function returns 0 if the
pointed-to elements compare equal, some negative value if
the first element is less than the second, and some
positive value if the first element is greater than the
second. A comparison function for integers might look
like this:
int icmp( const int *p1, const int *p2 )
{
return *p1 - *p2;
}
C Programming: 146 Just the FAQs
The sorting algorithm is part of qsort(). So is the exchange
algorithm; it just copies bytes, possibly by calling
memcpy() or memmove(). qsort() doesn’t know what it’s
sorting, so it can’t know how to compare them. That
part is provided by the function pointer.
You can’t use strcmp() as the comparison function for this
example, for two reasons. The first reason is that
strcmp()’s type is wrong; more on that a little later. The
second reason is that it won’t work. strcmp() takes
two pointers to char and treats them as the first characters
of two strings. The example deals with an array
of character pointers (char*s), so the comparison function
must take two pointers to character pointers
(char*s). In this case, the following code might be an
example of a good comparison function:
int strpcmp( const void *p1, const void *p2 )
{
char * const *sp1 = (char * const *) p1;
char * const *sp2 = (char * const *) p2;
return strcmp( *sp1, *sp2 );
}
The call to qsort() might look something like this:
qsort( array, numElements, sizeof( char * ), pf2 );
qsort() will call strpcmp() every time it needs to compare
two character pointers (char*s).
Why can’t strcmp() be passed to qsort(), and why were the
arguments of strpcmp() what they were?
A function pointer’s type depends on the return type of the
pointed-to function, as well as the number and
types of all its arguments. qsort() expects a function that
takes two constant void pointers:
void qsort( void *base,
size_t numElements,
size_t sizeOfElement,
int (*compFunct)( const void *, const void *) );
Because qsort() doesn’t really know what it’s sorting, it
uses a void pointer in its argument (base) and in
the arguments to the comparison function. qsort()’s void*
argument is easy; any pointer can be converted
to a void* without even needing a cast. The function pointer
is harder.
For an array of character arrays, strcmp() would have the
right algorithm but the wrong argument types. The
simplest, safest way to handle this situation is to pass a
function that takes the right argument types for
qsort() and then casts them to the right argument types.
That’s what strpcmp() does.
If you have a function that takes a char*, and you know that
a char* and a void* are the same in every
environment your program might ever work in, you might cast
the function pointer, rather than the pointedto
function’s arguments, in this way:
char table[ NUM_ELEMENTS ][ ELEMENT_SIZE ];
/* ... */
/* passing strcmp() to qsort for array of array of char */
qsort( table, NUM_ELEMENTS, ELEMENT_SIZE,
( int (*)( const void *, const void * ) ) strcmp );
Casting the arguments and casting the function pointer both
can be error prone. In practice, casting the
function pointer is more dangerous.
The basic problem here is using void* when you have a
pointer to an unknown type. C++ programs sometime
solve this problem with templates.
 
0
Vastram Naik
 
 
Answer
Function pointers are used to call functions at runt time 
instead of compile time .
 
0
Vels
 
 
Answer
It is more efficient. So it mostly used in real type 
application.
The use of pointer is to store address location of a 
variable or a function.as similar we are storing a variable 
address in a pointer variable and refering it ,we can store 
the address of a function in pointer variable.
 
0
Vidhya
 
 
Question
IS  STRUCTURES CAN BE USED WITHIN AN ARRAY?
Rank Answer Posted By  
 Question Submitted By :: Venugopal
This Interview Question Asked @   Caritor , Caritor
I also faced this Question!!   © ALL Interview .com
Answer
YES ,THEY CAN BE,BECAUSE ARRAY CAN HOLD SIMILAR DATA 
TYPED   ONES,WE ARE USING ONLY STRUCTURE VARIABLES 
THEMSELVES.IT WILL BE POSSIBLE.
 
4
Venugopal
 
 
Answer
yes. structures can be used within an array. variables are 
declared in an arrays in structures.
 
0
E-mail
 
 
Answer
Yes... Sure...
 
0
Sathish
 
 
Answer
no
 
0
Mathan
 
 
Answer
No. Because arrays are homogeneous datatype and 
 structures are heterogeneous datatype. So we cann't
 
0
Swamy S T
 
 
Answer
yesss.

we do used structures within arrays..

struct student
{
  char name[20];
  int roll_no;
}s[10]

this is array of structures..

we use "."(dot) operator to access the element
s[i].name = ""
s[i].roll_no = ...
 
2
Shruti
 
 
Answer
generally in turbo c++ 3.0 to above version it can't
possible but possible if we declared float linking point
declaration 
in such way globally after header file 
             float a,*b;
               b=&a;
after this declaration structure can take array
 
0
Biranchi Parida
 
 
Question
what information does the header files contain?
Rank Answer Posted By  
 Question Submitted By :: Mohancvk
This Interview Question Asked @   BSNL , GDA TECHNOLOGIES, What Should Not Contain A Header File?
I also faced this Question!!   © ALL Interview .com
Answer
header file is a file containing C declarations and macro 
definitions  to be shared between several source files
 
0
Naveena
 
 
Answer
the header files consists of file-inclusions,macro 
definitions and declarations which get replaced with the 
textual source code at preprocessor level ie., before 
compilation process.
 
0
Mohancvk
[Virtuasa]
 
 
Answer
Header files contain line- and field-oriented ASCII text 
It contain declerations,macro definitions.
 
0
Avinandan
[Virtuasa]
 
 
Answer
Header files contain the definations of the functions that 
are to be used in the program.In order to recognise the 
defined functions ex, printf, scanf etc you need to define 
the header file STDIO.h where the defination of these 
functions are declared.Which makes writting of the program 
very easy
 
0
Dips
[Virtuasa]
 
 
Answer
In computer programming, particularly in the C and C++
programming languages, a header file or include file is a
file, usually in the form of source code, that a compiler
automatically includes when processing another source file.
Typically, programmers specify the inclusion of header files
via compiler directives at the beginning (or head) of the
other source file.
 
0
Shashi
[Virtuasa]
 
 
Question
post new interiew question and aptitude test papers
Rank Answer Posted By  
 Question Submitted By :: Asder
I also faced this Question!!   © ALL Interview .com
Answer
and answer ofthat
 
0
Asder
 
 
Question
write a program to find out number of on bits in a number?
Rank Answer Posted By  
 Question Submitted By :: Rasmita
This Interview Question Asked @   Huawei , Microsoft
I also faced this Question!!   © ALL Interview .com
Answer
int setbit=1; //Lets start checking from first bit
int numBitSet=0; //Number of bits set in the number

while(setbit>0)
{

if(number&setbit)  //bit wise and
numBitSet++;

setbit=setbit<<1;
}
 
3
Vivek
 
 
Answer
int i,a;
{
cout<<enter the no whose bits you  want to find";
cin>>i;
a=i*8;
cout<<No. of bits in this number is<<a;
getch();
 
0
Jaskarann
 
 
Answer
#include<stdio.h>
main()
{
int setbit=1;
int number=16;//for example
int numBitSet=0;
clrscr();

while(setbit<=number)//important and optimized condition
{

if(number&setbit)
numBitSet++;

setbit=setbit<<1;
}
printf("%d",numBitSet);
getch();
}
 
0
Krishna Kanth
 
 
Answer
main()
{
int n,counter;
printf("enter a number");
scanf("%d",&n);// let n=5
while(n>0)
{
counter++;
n=n&(n-1);
}
printf("%d",counter);
getch();
}
 
4
Venkat Reddy
 
 
Answer
main()
{
  int n;
  printf("\n Enter The Number Whose bits have to find");
  scanf("%d",&n);
  i=i*8;
  printf("\n The number of bits in the given number is %d",i);
}
 
0
Sriharsha
 
 
Answer
int n ; \\any number
for(count=0;n&=(n-1); count++);
printf("%d", count);
 
0
Anilkumar
 
 
Answer
main()
{
int n,count=0,rem;
scanf("%d",&n);
while(n>0)
{
 rem=n%2;
 if(rem==1)
   count++;
 n=n/2;
}
printf("The number of on bits in the number is %d",count);
}
 
0
Vaishu And Hema
 
 
Answer
#include<stdio.h>
#include<conio.h>
void main()
{
int n,cnt,rem
scanf("%d",&n);
cnt=1;
while(n!=0)
{
rem=n%2;
n=n/2;
cnt++;
}
printf("number of bits of the number is = %d",cnt);
getch();
}

 
0
Anu
 
 
Answer
int setbit=1; //Lets start checking from first bit
int numBitSet=0; //Number of bits set in the number

while(setbit>0)
{

if(number&setbit)  //bit wise and
numBitSet++;

setbit=setbit<<1;
}
 
0
Kavitha
 
 
Answer
#include<stdio.h>
void main()
{
int a,count=0;
while(a>0)
{
if(a%2==1)
count++;
a=a>>1;
}
printf("no of on bits =%d ",count);
}
 
0
Rajkumar
 
 
Answer
#include <stdio.h>

main()
{
int number;
int setbit=1; //Lets start checking from first bit
int numBitSet=0; //Number of bits set in the number
printf("enter the number");
scanf("%d", &number);

while(setbit>0)
{

if(number&setbit)  //bit wise and
numBitSet++;

setbit=setbit<<1;
}
printf("%d",numBitSet);
}
full program of the first ans...
 
0
Madhu
 
 
Answer
void main()      
{         
  int number,a=0,b,count=0;
  printf("Enter the number : ");
  scanf("%d",&number);
  b = (number/2);
  while(b)
  {
	  if((number>>a)& 1)
	  {
		  count++;
	  }
	  a++;
	  b--;
  }
  printf("Number of ON Bits in the number : %d\n",count);
}
 
0
Ajay Vikram
 
 
Question
Who had beaten up hooligan "CHAKULI" in his early college days?
Rank Answer Posted By  
 Question Submitted By :: Niladri.pradhan
I also faced this Question!!   © ALL Interview .com
Answer
 This is not a valid question.Pls dont share these type of 
questions.Be professional.Hope u will look after it afterwards.
 
0
Niladri.pradhan
 
 
Question
What is function pointer and where we will use it
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   NetApp , Infy
I also faced this Question!!   © ALL Interview .com
Answer
A function pointer is a type of pointer in C, C++ and other 
C-like programming languages. When dereferenced, a function 
pointer invokes a function, passing it zero or more 
arguments just like a normal function. In programming 
languages like C, function pointers can be used to simplify 
code, such as replacing large switch statements.
 
0
Bsreddi
 
 
Question
What are the phases in s/w developed life cycle? 
wat is the diff b/w stack & queue...where do we use stack
Rank Answer Posted By  
 Question Submitted By :: Sanglap
I also faced this Question!!   © ALL Interview .com
Answer
Stack follows LIFO i.e last in first out.The last element 
entered would be removed first while Queue follows FIFO i.e 
first in first out.The element that ws entered first would 
be removed first.
 
0
Nisha
 
 
Answer
phases in SDLC

The phases may be diffred for different SDLC models.
some of the SDLC are

waterfall model(all requirements must be collected in the 
first phase itself)
spiral model(processing looks like a spiral fashion,the 
desired requirements can be added in next level spirals)
incremental model
prototype model

Stack and queue are data structures. stack is referred as 
Last In First Out(LIFO), uses a single pointer
queue is First In First Out(FIFO), uses 2 pointers , one 
for insertion and another for deletion.

stack is used for all arithmatic operations, eg. polynomial 
addition.
 
0
Prakash.m
[None]
 
 
Answer
stack follows-LIFO
-used to evaluate postfix/prefix expressions
queue follows-FIFO
-which has normal applications like-priority being given 
1st..i.e. first come-first serve basis..
 
0
Subha Raman
[None]
 
 
Answer
Stack follows LIFO. whereas queue follows FIFO. 

All local variables and function calls are stored
temporarily in stack during program execution. 

It is easy to manipulate stack operation rather than queue.
 
0
Rani
[None]
 
 
Answer
The phases of SDLC are:
**Communication.
**Requirements gathering
**Analysis
**Implementation
**Testing
**Maintainance


Differance between stack and queue..

Stack follows LIFO structure i.e -> last in first out.
the element which enters last exits first..

Queue follows FIFO structure. i.e -> first in first out.
the element which enters first exits first..


USE OF STACK:
 with refrance to C, we use stack wiht the program counter.
i.e when we jump to a function, we store the address to 
return to on a stack..

u can understand this in more detail if you study teh 
actual flow of program while calling functions.
 
0
Shruti
[None]
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com