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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Programming-Languages
 
  C (726)  C++ (457)  Delphi (508)  Programming-Languages-AllOther (219)
 


 

Back to Questions Page
 
Question
Write a program or provide a pseudo code to flip the 2nd bit
of the 32 bit number ! (Phone Screen)
Rank Answer Posted By  
 Question Submitted By :: Ankit Parikh
This Interview Question Asked @   NetApp , Wipro, Ptu
I also faced this Question!!   © ALL Interview .com
Answer
x-OR the number with 0x02.
 
0
Ankit Parikh
 
 
Question
What is Iteration Hierarchy?
What is what is Object behavioral concept?
Rank Answer Posted By  
 Question Submitted By :: Guest
I also faced this Question!!   © ALL Interview .com
Answer
Iteration heirarchi is means looping.
In c++ everything is based on Object.Object is the reference
to the class.
 
0
Deepthi
 
 
Question
Why not virtual functions to handle messages?
Rank Answer Posted By  
 Question Submitted By :: Abhijit
I also faced this Question!!   © ALL Interview .com
Answer
Implementing virtual mechanism to handle messages would 
have made the message dispatch process very expensive as
* every class of any window type would have a huge virtual 
function dispatch table associated with it.

Instead having static array of function pointers ensures 
only one copy for a given class
 
0
Abhijit
 
 
 
Answer
In MFC we have lot of base classes those are having so many
virtual functions. For each class one virtual table will be
created. This will consume lot of memory and our application
performance will go down. This is the only reason MFC is not
using virtual function for message mapping.
 
0
Chandrasekharreddy Siddamreddy
 
 
Question
if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')
Rank Answer Posted By  
 Question Submitted By :: Madhu
I also faced this Question!!   © ALL Interview .com
Answer
main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
   while(num!=0);
    {
      k=num%10;
      sum=sum+k;
      num=num/10;
    }
printf("%d",sum);
}
 
0
K.kavitha
 
 
Answer
void main()
{
long int num;
int sum=0,temp;
clrscr();
printf("Enter the numbe\n");
scanf("%ld",&num);
while(num!=0)
{
temp=num%10;
sum=sum+temp;
num=num/10;
}
printf("%d",sum);
getch();
}

 
0
Sriharsha
 
 
Answer
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
scanf("%d",&i);
if((i%9)==0)
printf("The sum of digit is 9");
else
{
j=i%9;
printf("%d",j);
}
}
 
0
Jegadeesh
 
 
Answer
#include<stdio.h>
void main()
{
int i,j;
scanf("%d",&i);
if((i%9)==0)
printf("The sum of digit is 9");
else
{
j=i%9;
printf("%d",j);
}
}

//the above will print result as 6 if given as 12345 since
1+2+3+4+5=15 and proceeding 1+5 we get as 6.....
is this an apt answer...
 
0
Jegadeesh
 
 
Answer
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,sum=0;
clrscr();
printf("\n enter a number",i);
scanf("%d",&i);

while(i<=0)
  {
    j=i%10;
    sum=sum+j;
    i=i/10;
   }
printf("\n the sum of the digits 
        are:%d\n");
getch();
}
 
0
Aha Na
 
 
Question
void swap(int a,int b)
{
a=a+b;
b=a-b;
a=a-b;
}

in this code always gives the same result for all case
Rank Answer Posted By  
 Question Submitted By :: Bala
This Interview Question Asked @   TCS , Accenture
I also faced this Question!!   © ALL Interview .com
Answer
NO,if the values of a&b are 10,20 respectively., Then
   a=a+b becomes "a=30"
   b=a-b becomes  b=30-20  i.e., "b=10"
   a=a-b gives  a=30-10    i.e., "a=20"
 
0
K.kavitha
 
 
Answer
provided a+b is between the int minimum and int maximum

so the answer is no.
 
0
Mangala Pandi P
 
 
Answer
NO 
Means we can give diff values give different answer.
like
we can give a=80,b=100
a=180,b=20,a=20
 
0
Sunny
 
 
Answer
Sorry, it does nott.. :-)
it works proper..
 
0
Shruti
 
 
Answer
no,result will depend on the values of a nd b
 
0
Sourabh
 
 
Question
Which is not valid in C?


		

	1) class aClass{public:int x;} 	 


	2) /* A comment */ 	 


	3) char x=12; 	 


Rank Answer Posted By  
 Question Submitted By :: Viju
I also faced this Question!!   © ALL Interview .com
Answer
1) class aclass{public:int x;}
 
0
Deepthi
 
 
Answer
class aClass{public:int x;}
 
0
K.kavitha
 
 
Answer
1) class aClass{public:int x;}
 
0
Bhavesh Kashikar
 
 
Answer
I think char x=12 is also not valid

Because 1.maximum length of the character can be 1 character 
2.It should enclosed within single inverted commas, like
'1',or 'a'.
 
0
Sriharsha
 
 
Question
Which of the following is not a valid declaration for main
()?


	

1) int main() 	 


2) int main(int argc, char *argv[]) 	 


3) They both work 	 

Rank Answer Posted By  
 Question Submitted By :: Viju
I also faced this Question!!   © ALL Interview .com
Answer
3.both are works well.
 
0
Chandrakala
 
 
Answer
3) They both work
 
0
K.kavitha
 
 
Question
True or false: If you continuously increment a variable, it 
will become negative?


	

1) True 	 


2) False 	 


3) It depends on the variable type 	 

Rank Answer Posted By  
 Question Submitted By :: Viju
I also faced this Question!!   © ALL Interview .com
Answer
2) false
 
0
K.kavitha
 
 
Answer
It depends upon the variable type. Ex: if the variable is
declared as unsigned int then if we increment the value will
not become negative.
 
4
A Programmer
 
 
Answer
It will not become negative if we use unsign data type.
 
0
K Sriharsha
 
 
Answer
after a limit of the variable ,it becomes -ve.
for ex:-
#include<stdio.h>
void main()
int i;
if(i<=32767)
{
printf("%d",i);
i++;
}
}after printing 1 to 32767,it tries to become 32768 which is
outside the limit,so it goes to the other side and become
-32768 and loops become indefinite.
 
0
Sachin
 
 
Question
What character terminates all strings composed of character 
arrays?


	

1) 0 	 


2) . 	 


3) END 	 

Rank Answer Posted By  
 Question Submitted By :: Viju
I also faced this Question!!   © ALL Interview .com
Answer
1)0
 
0
K.kavitha
 
 
Answer
May be the options are not correct. Do u feel that 0 is
ascii zero or numeric zero. If numeric zero, then the answer
is wrong. Every string will be terminated with the special
character '/0'.
 
0
A Programmer
 
 
Answer
The answer is '\0' not /0
 
0
Jegadeesh
 
 
 
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