## abc Interview Questions

- 0of 0 votes

Answershow to restrict creation of object inside the function fun

- jkl June 19, 2016 in India

although destructor and constructor is private??

#include <iostream>

class ABC

{

private :

~ABC()

{

}

ABC()

{

std::cout <<"ABC";

}

public:

static void fun()

{

ABC t;

}

};

int main()

{

ABC::fun();

}| Report Duplicate | Flag | PURGE

Microsoft abc - -5of 5 votes

Answerswkhdqwdhqowdh

- saim May 08, 2016 in United States for qwe| Report Duplicate | Flag | PURGE

A9 abc Android - 0of 0 votes

AnswersWrite a java program:

- sarath.chalasani46 April 26, 2016 in India

There is plant species (say P) in a desert that has a specific living pattern. A rectangular

field of the land is divided into squara cell.The land will have R rows and C columns of the

cell.Each cell will be surrounded by up-to eight neighboring cells(note that the cells at the

edge of the field will have fewer then eight nuighboring cells). A cell can either be empty

(having no plant in it) or living(having a plant in it).A particular cell is said to have N

neighbors(1<N<8), if exactly N cells in the neighborhood have living plants.

the plants fallow a certain rules for survival.the rules are as fallows.

1) if a cell with plant s1 to s2 neighbors (1<=s1<=s2<=8), it survives to the next generation.

i.e. the plant dies if it has less than s1 neighbors or more than s2 neighbors.

2) If an empty cell has B1 to B2 neidhbors (1<=B1<=B2<=8), a new plant takes birth in that cell

in the next generation.

Input Specification:

theinput will have two arrays, as fallows

1)An integer array: {R,C,S1,S2,B1,B2,G}

where R and C specify size of the field in row and columns respectively, with 1<=R<=2000 and

1<=C<=2000 s1,s2,B1 and B2 are integers as explained in the survival rules. G is the number of

generations for wich the simulation has to be run.

2)An integer array specifying intial state of the field: size of the array will be R*c

the data will be expressed in the array as fallows:{E11,E12,E1c,E21,....,E2C,ER1,ERC} where Eij

is cell in the field at ith row and jth column. Eij can have value 0 or 1. 0 corresponds to

empty cell and 1 corresponds to living cell.

output specification:

output will be an integer array specifying state of the field at the end of the simulation in

the same manner as in input.

Examples:

Example 1:

input1: {3,4,2,3,3,3,3}

input2: {0,1,0,0,0,1,1,0,1,0,1,0}

output : {0,1,1,1,0,0,0,1,0,0,1,0}

Example 2:

input1: {3,4,2,3,3,3,4}

input2: {0,1,0,0,0,1,1,0,1,0,1,0}

output: {0,0,1,1,0,1,0,1,0,0,0,0}

Method Signature:

public static int[] survivalcells( int[] input1,int input2){

}| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

Answersyou are given an MxN matric.Every cell of the matrix has a cost associated. initially you are at(0,0) and you have to reach (M-1,N-1). Question is to find the minimum cost path from (0,0) to (M-1,N-1) and also the minimum cost. From a cell you can only make a move to right cell or down cell or diagonally lower cell.

- sarath.chalasani46 April 26, 2016 in India

Input Specification:

Input1: A string array containing rows of the cost matrix as element.

input2: An integer having number of rows in the cost matrix.

For above example, the matrix would be {5#7#2#4,1#8#1#3,6#2#9#5,1#6#2#8} and number of rows would be 4.

output Specification:

The output will be a string containing minimum cost and the path chosen separated by the comma.

For Example , Given the cost matrix

5 7 2 4

1 8 1 3

6 2 9 5

1 6 2 8

1) minimum cost value is 5+1+2+2+8=18

2) minimum cost path from (0,0,) to (M-1,N-1) is BDDR

B- for down move

D- Diagonal Move

R- Right move

NA- No solution

Hence your output will be 18,BDDR

method signature:

public static String minimumCost(String[] input1, int input2) {

}| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

AnswersThere are N friends sitting in a circle, they are numbered clockwise 1 to N. Game starts with

- sarath.chalasani46 March 28, 2016 in India

player 1 receiving the ball. A player needs to pass the ball to other player based on some

conditions.

1. if he is receiving ball for pth time,he passes that ball to persion L places to left if P is even

or L places right if P is odd.

2. if any player receives the ball M times then game is over.

Eample :

Input 1(N):5

Input 1(M):3

Input 1(L):2

Output: 10

Explanation:

First player 1 gets tha ball. since he has held the ball 1 time , he passes the ball to player 4,

who is two places to his right. this is player 4 first time holding the ball, so he gives it to

player 2, who passes it to player 5. player 5 then passes the ball to player3. who passes it

back to player 1.since player 1 has now held the ball 2 times, hepasses it to player 3, who

passes it to player 5, who then passes the ball to player 2. finally, player 2 passes the ball to

player 4, who then passes it to player 1. player 1 has now held the ball 3 times, and the game

ends.| Report Duplicate | Flag | PURGE

ADP abc - 0of 0 votes

AnswersGiven a binary tree, we are supposed to find nth smallest element.

- nick.dom1519 February 06, 2016 in India| Report Duplicate | Flag | PURGE

xyz abc Algorithm - 1of 3 votes

AnswersYou have 12 marbles. They all weigh the same, except one. You don't know if that one is heavier or lighter. You have a balance scale.What would be the minimum number of weighing required to find the odd one.

- Divya Bolla August 07, 2015 in India| Report Duplicate | Flag | PURGE

abc Applications Developer Brain Teasers - 0of 0 votes

AnswersIn java, how will you implement hashset in which the insertion order of elements is preserved?

- Vpn June 09, 2015 in India| Report Duplicate | Flag | PURGE

abc Data Structures - 0of 0 votes

AnswersGiven a binary search tree and a number n, write a program to find the greatest number in the binary search tree less than or equal to N.

- gowthamiss27 December 21, 2014 in India

Given the following tree construction, what is the output for N=44?| Report Duplicate | Flag | PURGE

abc Applications Developer Online Test - 0of 0 votes

Answersyou have a numbers between 1 to n. a set of number i.e. (4,5) means that person number 4 is connected to person number 5. find all the ways the a group of n pepole can be connected. i.e. for 0 and 1 there is the empty set, for 2 there is 2 ways, empty set and {1,2} only for 3 there are 4 ways: {}, {(1,2)} {(2,3)}, {(3,1)}

- Patrick November 28, 2014 in United States

for 4 there are 10 ways ({},{(1,2)}, {(1,2),(3,4)},.......

you can do it by factorial and cobination but there is another way that state that:

T(n)=T(n-1) + (n-1)*T(n-2)

(while T(n) is the function that computes the number of ways..

can someone explain why this equation is true?

Thanks...| Report Duplicate | Flag | PURGE

abc Computer Scientist Algorithm - 0of 0 votes

AnswersIf i have a graph which have n vertices and n-k edges than How many connected component it has ?

- Raj Hirani November 13, 2014 in India for code| Report Duplicate | Flag | PURGE

abc Developer Program Engineer Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.