Interview Question


Country: India




Comment hidden because of low score. Click to expand.
0
of 0 vote

By taking left shift of that number by 1

int res = num<<1;

- saurabh(vit) April 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

bitwise shift operator used

- dabbcomputers April 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

bitwise shift operator used

- dabbcomputers April 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

without using operator means you are not allow to use any operator either it is bitwise logical or any other

- istiyak916 April 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

What do you mean by operator? At the very least, we need an assignment operator of some kind, so I would think this not possible. Operators are what manipulate values.

- eugene.yarovoi April 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Well, it's possible for 0, I guess :)

- eugene.yarovoi April 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

try this one:
main()
{
short int *p=0,k;
printf("enter no:\n");
scanf("%hd",&k);
printf("%d",&p[k]);
}

inside:
p[a] means *(p+a) and if we take & then we get address means
(p+a);
try this in linux.

- istiyak916 April 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

'&' is an operator too ('address-of' operator)...

- david.rebatto@gmail.com April 20, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

read the number in a string
then for each character
if str[i]=='0' then if carry then str[i]='1' else srr[i]='0';
if str[i]=='1' then if carry then str[i]='3' else str[i]='2';
...
if str[i]=='5' then if carry then str[i]='1' else str[i]='0', carry=true;
...

- Anonymous April 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

main()
{
int a;
scanf("%d",&a);
if(a>0)
printf("%d",printf("%*c%*c",a,' ',a,' '));
else if(a==0)
printf("%d",a);
else
printf("-%d",printf("%*c%*c",a,' ',a,' '));
}

- ASHISH KUMAR GARG September 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

this programe is that without using any arithmetic operator.

- ashish kumar garg September 01, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More