Motorola Technical Interview Questions

1. What is the value of z?
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;

a) 5 b) 6 c) 10 d) 11

2. What is the output of the program?
void main()
{
int const * p=5;
cout<<++(*p);
}

a) 5
b) memory value
c) Compiler error
d) Garbage value

3. What is the output of the program?
main()
{
char s[ ]='man';
int i;
for(i=0;s[ i ];i++)
cout< }

a) mmmm
aaaa
nnnn
b) man
c) Compiler error
d) None of the above

4. What is the output of the program?
main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
cout<<'I love U';
else
cout<<'I hate U';}
a) I hate U
b) I love U
c) Garbage value
d) None of the above

5. Write a program to reverse the words in a sentence, i.e. 'My name is hero' becomes 'hero is name My.'
6. Write a program to find the substring?
7. What is the difference between #define and const?
8. What is the difference between partial specialization and template specialization?

Shared by: Susant Kumar