MAQ Interview Question for Java Developers


Country: India
Interview Type: Written Test




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

2100010006

- Shubham November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Ans: 1000000000

- sundar November 13, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

... well then 2100010006

- grumpycat November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

you have 8th digit as 0, but in your 10 digit number 8 is occurring once.

- anilsk89 November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

plzz explain

- Netesh November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

algos - u have used 9 zeroes so your last or tenth digit should be 8 as in that case only 8 zeroes will left

grumpycat you have used 7 zeroes so your last digit should be 7

Guys please before posting anything think first, posting your comments without thinking is of no use........

- Shubham November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The 1st digit describes the no. occurence of 1 - this is 2
The 2nd - no. of occurence of 2 - this is 1.
From 3 to 9 - no occurences
And the last digit is just 1.

- grumpycat November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ThereĀ“s no info about zeros in your question.

- grumpycat November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

0123456789 (index)
6210001000 ->

- shashi_kr November 09, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

can u tell me ur approach ?

- Ujvala August 02, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

incomplete question. how about the 10th digit ?? should it describe the number of occurrences of the number 10 ?? or 0 ?? ... stupid

- alies December 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

9876543210

a number can have 3 0's... duh

- grow up April 21, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

question was written poorly

- Anonymous April 21, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hey bro..10 is not a digit, its a number.So, obvious 10th digit will be 0 as digits are
{0,1,2,3,4,5,6,7,8,9} and we have to use digits to form the number.Thus only one possible no. will be 2100010006

- Rjan December 30, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

9000000000
first digit represent no.of zeros and so on...

- Anonymous January 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

0000010006

- akash March 20, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I took it as this:
13432 => 12110
number has:
1 '4'
2 '3'
1 '2'
1 '1'
0 '0'

public static int totalDigitNumber(int n)
	{
		System.out.print(n);
	    //get lowest sig fig, incrament place, and divid by 10. loop till 0.
	    boolean isNegative = false;
	    if(n<0)
	    { 
	       isNegative = true;
	       n*=-1;
	    }
	    int totalDigit = 0;
	    for(; n>0; n/=10)
	    {
	        int lsd = n%10;
	        totalDigit+=Math.pow(10,lsd);
	    }
	    if(isNegative)
	    	totalDigit*=-1;
	    System.out.println(" => " + totalDigit);
	    
	    return totalDigit;
	}

- simple, and all you guys make no sense April 21, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

2100010006

- Chetan May 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{cannot be formed: because it may lead to infinite loop with repeating (10 digit) number. I n the code below I considered array of size 10 instead of 10 digit number}
void generate(){
int a[]={9,0,0,0,0,0,0,0,0,0};
int k=0;
while(true)
{
int b[]={0,0,0,0,0,0,0,0,0,0};
for(int i=0;i<10;i++)
{
// System.out.println(a[i]+"---"+b[a[i]]);

b[a[i]]=b[a[i]]+1;
}
for(int i=0;i<10;i++)
{
a[i]=b[i];

System.out.print(a[i]+" ");
}
System.out.println();
k++;
}
}

- Bhumi August 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

0010000017.....(9876543210 index)

- arti December 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>


void toarray(int *p, unsigned long i);
int main(){
unsigned long i;
int a[9];
int count;

for(i = 100000000; i <= 999999999; i++){
int k;
toarray(a, i);
for(k = 0; k < 9; k++){
int j;
count = 0;
for(j = 0; j < 9; j++){
if((k + 1)%9 == a[j]){
count++;
}
}
if(count != a[k]){
break;
}
}
if(k == 9 && count == a[k-1]){
printf("%lu\n", i);
}
}
}

void toarray(int *p, unsigned long i){
int j;
int k = 10;
for(j = 8; j >= 0; j--){
p[j] = i % k;
i = i / k;
}
}
ans : 210010005

Checked it for 4 - 9 digit numbers .. above code is for a 9 digit number .
ps: it is a brute force method.

- Rakesh February 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

1000000008

- Senthilkumar November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

2100000001

- grumpycat November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

1111111111

- huh November 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

1111111111

- algos November 08, 2013 | Flag Reply


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