## .Net/C# Interview Questions

- 0of 0 votes

AnswersThere are N cars parked in a row in a parking lot of the newly constructed club. as it is demonstrated in the picture below.

- shivanandtripathi02 October 27, 2019 in India

There is a gasoline and diesel fueling station installed.at the left and right side of the park.

An automatic fueling robot carries the fuel from station and fill up the parked car with fuel.

The cars are divided into 2 types depending on whether it is a gasoline or diesel car.

1 is denoted as gasoline cars and 2 is denoted as diesel cars.

The automatic robot will be used to provide a cost free fueling service which is filling up

all cars with 1 litre of each corresponding fuel.

The robot will move in between the 2 fuelling stations as below :

1) The robot carries 2 litre of gasoline at the gasoline station and starts moving from there.

2) The robot can fill up the cars of the same type of gas it carries 1 litre each.

3) The robot can go back to the fuelling station at any time, Independent from the current amount of fuel it carries.

4) When the robot arrives at the fuelling station, it gets 2 litre of supply of the corresponding fuel.(If the robot has some remaining fuel it will be discarded).

the picture is not there. so, i will explain how the arrary must look like. suppose the arrary is arr od

size x. then at index = 0, there is gas station and at index = x - 1 there is dielsel station. Remaining all indexes are filled with vehicle type. 1 represents gas type and 2 represents diesel type.| Report Duplicate | Flag | PURGE

Samsung SDE1 .Net/C# - 0of 0 votes

AnswerGuys,

- zuhaibaliraja November 23, 2018 in United States

I have an interview in Google exactly after 2 weeks for software engineer position. I recently have done my MS in Information Science and I applied in google. They shortlisted my profile and sent me sample code exam which I have passed. Now it's my technical interview and I am very beginner into programming. Can please anyone help me what type of questions do they ask and how to tackle those questions. I am not good in data structures and algorithm. I self-taught programming online classes. I am so scared to face the interview. Please suggest me something| Report Duplicate | Flag | PURGE

xyz Jr. Software Engineer .Net/C - 0of 0 votes

Answerhow can i apend two array in C# like this

- lalityad2012 October 30, 2018 in India

a1 = [1, 2, 3, 4];

a2 = ["a", "b", "c"];

result a3 = [a1, b2, c3, d4];| Report Duplicate | Flag | PURGE

Jr. Software Engineer .Net/C# - 0of 0 votes

AnswerWhich is the best mvc training institute in noida?

- mritunjayjaywebtracker September 08, 2018 in United States| Report Duplicate | Flag | PURGE

.Net/C - -1of 1 vote

AnswerBinance Support +1-800-571-6109 Binance customer service

- krakenexchange0 August 06, 2018 in United States| Report Duplicate | Flag | PURGE

247quickbookshelp Associate .Net/C - 0of 0 votes

AnswersWhat is the difference between Interface and abstract classes? Give practical example from experience.

- Jaideep July 18, 2018 in India| Report Duplicate | Flag | PURGE

Deloitte Consulting LLP Applications Developer .Net/C - 0of 0 votes

AnswersA group of friends are tracking the miles per gallon for each of their cars. Each time one of them fills up their gas tank, they record the following in a file: His or her name The type of car they drove How many miles driven since they last filled up How many gallons purchased at this fill up Date of the fill Their data is formatted as a comma separate value (csv) file with the following format for each row:(#person,carName,milesDriven,gallonsFilled,fillupDate) Miles are recorded as floating-point numbers and gallons as integers. Please create a program that allows members of this group to determine the miles per gallon (MPG) of each of their cars during a specific time range. Note: person may have more than one so a time range query might need to output data for one or more cars. A skeleton class will be provided; your job will be to complete the program. The principal function for querying MPG is of the form (the exact name, data types, etc., can be learned by inspecting the "solution" class in the skeleton code): GetRangeMPG(PersonName, StartDate, EndDate) Returns list of objects containing (CarName, MPG) MPG is calculated as (total miles traveled during time period)/ (total gallons filled during time period. The dates you receive in the query should be treated inclusively.

- pragramticProgrammer May 15, 2018 in United States| Report Duplicate | Flag | PURGE

Amazon SDE1 .Net/C# - 0of 0 votes

AnswersGiven as list of movies in a csv file, extract the movie name and genre and be able to return a query based on the years and the genre.

- pragramticProgrammer May 13, 2018 in United States

Basically, Parsing a CSV input file and build an indexed data storage to allow search the data in time manner.| Report Duplicate | Flag | PURGE

Amazon SDE1 .Net/C# - 0of 2 votes

AnswersAll Sim characters are loaded with the same copy of your software. Imagine two of these sims are positioned somewhere on a line that extends to infinity in both directions, left and right. Using the below interface, write a C# method called "Collide" that ensures that the two sims will collide at some point in the future. Remember, the code that you write will be deployed to each Sim. You cannot write code that will be deployed to one and not the other. The method should have no parameters. You do not need to implement the ISim interface.

- IRM2708 March 22, 2018 in United States`public interface ISim { void MoveLeft(); // Moves the sim character one unit on the line to the left void MoveRight(); // Moves the sim character one unit on the line to the right void Relax(); // Commands the sim character to not do anything void MarkPosition(); // Puts a mark on the line at the current position of the sim character bool IsCurrentPositionMarked(); // Inspects the current position of the sim character for a mark and returns true if one is found, false if one is not found. }`

| Report Duplicate | Flag | PURGE

Graphic Systems Senior Software Development Engineer .Net/C# - 0of 0 votes

AnswerA number is special if it is possible to remove some digits from it to get a number having 3, 5 or 6 only.

- 16ucs077@srcw.ac.in March 06, 2018 in United States

For example, 38597 is special since it is possible to remove digits 8, 9, 7 to get 35. You cannot remove all the digits.

You can remove digits from left, right or middle.

Write a program in C which given a number N, calculate how many divisors of N are special| Report Duplicate | Flag | PURGE

.Net/C - 0of 0 votes

AnswersIf two strings are identical Stringcmp() returns

- si.connect2mba January 21, 2018 in India for Java

A. -1 B. 1 C. 0 D. Yes| Report Duplicate | Flag | PURGE

Surya Informatics Solutions Pvt. Ltd. Junior programmer .Net/C - 0of 0 votes

AnswersSo recently to someone I know a question was ask how do you rotate a 2 dimensional array? He was asked to white board it. He could get diagram the problem but had trouble coding it.

- glen@jetsoftdev.com December 15, 2017 in United States

This is not an easy answer because equal dimensional array are easy but require you know the trip that you divide the x and y dimension and then do four swapping rotation around the corners. Not equal X,Y are much harder. When I heard this question, I could get the equal dimensions done in an hour or two in a compiler. It took me two days to get the total program working. Here is the code:

{

#include <stdio.h>

int main()

{

#define xsize 4

#define ysize 8

int matrix[ysize*xsize] ;

typedef enum rotation

{

CW0,

CW90,

CW180,

CW270,

CCW0,

CCW90,

CCW180,

CCW270,

DONE0

} RotationTypes;

RotationTypes DesiredRotation = CW270;

#define min(a,b) ( (a) < (b) ? a : b)

int x,y,r,swap0, swap1,rotx,roty, rotidx;

//walk through every possibily

for (DesiredRotation = CW0; DesiredRotation <= DONE0 ; DesiredRotation++)

{

for (y=0;y<ysize;y++)

{

for (x=0;x<xsize;x++)

{

matrix[(y*xsize)+x] = y + x*10;

//print the base rotation for references

if ( DesiredRotation == CW0

|| DesiredRotation == CCW0

|| DesiredRotation == DONE0)

printf("%d ", matrix[(y*xsize)+x]);

}

if ( DesiredRotation == CW0

|| DesiredRotation == CCW0

|| DesiredRotation == DONE0)

printf("\n");

}

if ( DesiredRotation == CW0

|| DesiredRotation == CCW0

|| DesiredRotation == DONE0)

printf("\n");

//flips are generally more effeicient than rotation

//bu doing flips you only have to do one 90 degree

// type of rotation. flips work on uneven dimeions

if (DesiredRotation != CCW90 && DesiredRotation != CW270)

{

//horiztonal flip

for (y=0;y<ysize;y++)

{

for (x=0; x<xsize/2;x++)

{

swap0 = matrix[(y*xsize)+x];

matrix[(y*xsize)+x] = matrix[(y*xsize)+((xsize-1)-x)] ;

matrix[(y*xsize)+((xsize-1)-x)] = swap0;

}

}

//vertical flip

for (y=0;y<ysize/2;y++)

{

for (x=0; x<xsize;x++)

{

swap0 = matrix[(y*xsize)+x];

matrix[(y*xsize)+x] = matrix[(((ysize-1)-y)*xsize)+x] ;

matrix[(((ysize-1)-y)*xsize)+x] = swap0;

}

}

}

if (DesiredRotation != CW0

&& DesiredRotation != CW180

&& DesiredRotation != CCW0

&& DesiredRotation != CCW180

&& DesiredRotation != DONE0)

{

//do one CCW90 rotation which is the same as CW270

//if would be more effiecient to hard code every

//different combination but no way to make it elegant

int sqsize=min(ysize,xsize);

//first do the inplace square part because it is very efficient

for (y=0;y<sqsize/2;y++)

{

for (x=0;x<(sqsize+1)/2;x++)

{

rotx = x;

roty = y;

//store the top, left

int swap0 = matrix[(y*xsize)+x];

//rotate into top left from top right

matrix[(y*xsize)+x] = matrix[(x*xsize)+((sqsize-1)-y)];

//rotate into top right from bottom right

matrix[(x*xsize)+((sqsize-1)-y)] = matrix[(((sqsize-1)-y)*xsize)+((sqsize-1)-x)];

//rotate into bottom right from bottom left

matrix[(((sqsize-1)-y)*xsize)+((sqsize-1)-x)] = matrix[(((sqsize-1)-x)*xsize)+y];

//into into bottom left from original top left

matrix[(((sqsize-1)-x)*xsize)+y] = swap0;

}

}

//now the challenge is what to do with unequal array left overs

//we chose to hardcode inserting rotation and swapping until done

//we have to do two different sets of code if height is

//greater than width

if (ysize>xsize)

{

int rotinc=0;

int baseptr = sqsize*sqsize;

int rowsize = xsize;

for (x=xsize-1;x>=0;x--)

{

for (y=sqsize;y<ysize;y++)

{

//find where the extra non square starts after

//the sqaure part of the arrary

int rotptr = baseptr+((y-sqsize)*rowsize)+x;

//store it for later insertion

swap0 = matrix[rotptr];

//find where in the new dimensions

//the rotation from the end of the square should

//go

int swapptr = (((xsize-1)-x)*ysize)+y;

//swap upswards to make room for the

//insertion

while (rotptr>swapptr)

{

matrix[rotptr] = matrix[rotptr-1];

rotptr--;

}

//insert the rotation at the proper place

//which is now free

matrix[swapptr] = swap0;

}

//we have done one row so increase where the

//base pointer will be for the next time

baseptr+=ysize-sqsize;

//because we did one rotation the remaining rows

//are one rotation smaller

rowsize--;

}

}

//width is bigger than height

if (xsize>ysize)

{

int rotinc=0;

int rowsize = xsize;

for (x=sqsize;x<xsize;x++)

{

//insert happen at the begging of the array for

//this sizing

int swapptr = 0;

for (y=0;y<ysize;y++)

{

//find the rotation at the end of each row

int rotptr = rotinc+(y*rowsize)+sqsize;

//store it for latter use

swap0 = matrix[rotptr];

//swap upwards to made room for the insertion

while (rotptr>swapptr)

{

matrix[rotptr] = matrix[rotptr-1];

rotptr--;

}

//issert the rotation at the begining of the

//array

matrix[swapptr] = swap0;

//increasement the point

swapptr++;

}

//we have done one row so need to increase

//our start posiiton

rotinc+=ysize;

//we have done one row. the remain is one row smaller

rowsize--;

}

}

//print out the rotated and maybe flipped new array

for (x=0;x<xsize;x++)

{

for (y=0;y<ysize;y++)

{

printf("%d ", matrix[(x*ysize)+y]);

}

printf("\n");

}

} else {

//printout the vertical flipped only array

if (DesiredRotation != CW0

&& DesiredRotation != CCW0

&& DesiredRotation != DONE0)

{

for (y=0;y<ysize;y++)

{

for (x=0;x<xsize;x++)

{

printf("%d ", matrix[(y*xsize)+x]);

}

printf("\n");

}

}

}

printf("\n");

}

return 0;

}

}| Report Duplicate | Flag | PURGE

.Net/C# - 0of 0 votes

AnswersHow two compare two database using entity framework.

- Risu Raj November 28, 2017 in India| Report Duplicate | Flag | PURGE

.Net/C - 0of 0 votes

AnswersDescription : Develop an application that transfer data from the test database to live database after showing comparison and user selection.

- Risu Raj November 25, 2017 in India for 10

Precondition: database and schema information provided and list of tables.

Condition Of Acceptance:

1. Application should select the source and destination databases and be capable of showing comparisons.

2. It should be capable transferring data from source to destination database/deleting the selected data from destination.

Technologies: C#, Sql server, entity framework, object oriented design principle.| Report Duplicate | Flag | PURGE

.Net/C - 0of 0 votes

AnswersDear Friends,

- gashok406 November 06, 2017 in United States

please help to get the logic for the below , basically it is atoi implimentation question.

input : string as 0x1234

output : in int formate 0x1234

if input: 0x12Ab43

output should be 0x12Ab43

if input : 0xdY6

outpust : should give an error , since Y is out of scope.| Report Duplicate | Flag | PURGE

.Net/C - 0of 0 votes

AnswersTesting Strings

- pooja.senger86 October 29, 2017 in United States

Mr X and Mr Y, his friend are programmers and testers respectively working in the same company. So, once they faced the following scenario :

Mr X wrote an application that took as input some user data. The data the application took as input was a string in some strange language. That language consisted of

K

K distinct letters. However, due to some issues, the application got corrupted and one particular String among many was lost.

However, Mr X had seen that String once before it got lost. He remembers some info about it. Particu-larly, he remembers the lost String had length equal to

M

M.

Mr Y, being the chief QA person in his company needs to try and figure out the number of possible different possible candidate Strings for the lost String.

Mr X remembers N pieces of info. For each one, he gives you 2 numbers

L

L and

R

R and a number

Z

Z. He remembers for sure that the

Z

t

h

Zth letter of the language of the string did not occur between positions

L

L and

R

R inclusive of the lost String.

Input Format :

The first line contains

3

3 space separated integers

N

N ,

M

M and

K

K.

Each of the next

N

N contains

3

3 space separated integers, denoting

L

L ,

R

R and

Z

Z respectively.

Output Format :

You need to find and print the number of different possible candidate Strings for the lost String based on the info Mr X remembers. As the number of such Strings can be large, print it Modulo

10

6

+

3

106+3

Constraints:

1

≤

N

,

M

,

K

≤

10

5

1≤N,M,K≤105

1

≤

L

≤

R

≤

M

1≤L≤R≤M

1

≤

Z

≤

K

1≤Z≤K

Sample Input

1 2 26

1 2 1

Sample Output

625| Report Duplicate | Flag | PURGE

A9 abc .Net/C Java - 0of 0 votes

AnswerToday Jin has given a task to Shino, Shino has to travel from cell

- pooja.senger86 October 29, 2017 in United States

(

1

,

1

)

(1,1) to cell

(

N

,

M

)

(N,M) in a grid of size

N

∗

M

N∗M. But in order make this task interesting for Shino, Jin has decided to keep some special candies in some

K

K special cells of the grid, where each candy has an amount of happiness associated with it.

Shino can travel only in right & down direction in the grid, as he is too careful & does not want to fall out of grid. Now, we call the value of a path the happiness of all cells lying on the path. All non-special cells have happiness equal to

0

0.

Now, you need to find and print the sum of the values of all paths from

(

1

,

1

)

(1,1) to

(

N

,

M

)

(N,M), traveling only right and down to an adjacent cell.

As Shino is not good at counting help him find the answer.

Input Format

The first Line contains a single integer

T

T denoting number of test cases

The next line contains

3

3 space separated integers,

N

N,

M

M and

K

K where N * M is the size of grid & K denoting number of special cells

The next

K

K lines contains three integers

X

i

,

Y

i

,

H

i

Xi,Yi,Hi where

(

X

i

,

Y

i

)

(Xi,Yi) is cell coordinate &

H

i

Hi is the amount of happiness Shino will get from a candy at cell

(

X

i

,

Y

i

)

(Xi,Yi)

Constraints

1

≤

T

≤

3

1≤T≤3

1

≤

N

,

M

,

K

≤

10

5

1≤N,M,K≤105

1

≤

X

i

≤

N

,

1

≤

Y

i

≤

M

1≤Xi≤N,1≤Yi≤M

1

≤

H

i

≤

10

5

1≤Hi≤105

Output Format

For each test case you will output a single integer denoting the total amount of happiness Shino will get. As the answer can be quiet large you can output answer modulo

10

9

+

7

109+7

Sample Input

1

2 2 2

1 2 4

2 1 7

Sample Output

11| Report Duplicate | Flag | PURGE

A9 abc .Net/C Algorithm Java - 0of 0 votes

AnswerThe input consists of N cases(equal to about 10000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the numbers whose reverse you have to add

- www.dileeppasvan121 September 22, 2017 in United States| Report Duplicate | Flag | PURGE

.Net/C - 0of 0 votes

AnswerThe input consists of N cases(equal to about 10000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the numbers whose reverse you have to add

- www.dileeppasvan121 September 22, 2017 in United States| Report Duplicate | Flag | PURGE

.Net/C

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

Open Chat in New Window