Engineer Interview Questions
engineer interview questions shared by candidates
Top Interview Questions
Aptitude was easy only time limit was less so answer questions which you know confidently and try to guess rest if you are not sure. No Negative Markings. For GD round be confident and put forth your views clearly , Don't try to be harsh and don't shout . Remember its not a debate . If you don't speak a word you will be asked to conclude which means you don't have any chance for further shortlisting For final round just concentrate on your final year project and technologies which you have mentioned in your CV . They will ask all possible questions with regard to your current profile and you should be proficient to answer any of them 42 Answershow many people they are recruiting ? and what is the package they are offering ? please help me with the topics covered in the written test ?? i got most topics on percentages and sales problems . one pie chart or bar graph question for sure based on percentages . Also concentrate on simple interest ,Profit and loss , time -distance and some basic math. Solve quickly . Show more responses Hi Mukesh out of 90 people only 16 were filtered for final round and 4 got offer letter . package was 2.7 LPA Can u say me wat type of technical question askd? if your background is from ETC than you can expect quextion related to IC's , Protocols and basic Programming. For CS/IT Programming on C/C++/JAVA also networking. Most questions were project related with twists like why this technology ? why not others ? what was the success rate ? advancement you can do ? Hello, Can you tell me the likely date of joining? Date of Joining (immediate): 21st October 2013 topics asked in written test and interview ??plz help me also abt the GD.. hey! i got selected in AGC networks for GRADUATE ENGINEER TRAINEE, they told they vl send mail,not yet sent when they vl send its been 3days they told joinin is on 6th november, Show more responses did you get intend letter ? from which location ? we are undergoing training in mumbai now. .please consult the HR by visiting their office. i am from bangalore, i got selected on 19th of this month,they didnt send to any of our selected team,v enquired they said HR is outof station,so...they vl send na? what is intend letter? Yes your HR is in Mumbai conducting Induction Program for us , 2mrw is last day of our induction . So you can expect her after 26th. Intend letter is letter which states if you are intending to join the company thanks,feelin relieved hey! dey didnt send us any mail i don know why dey r delayin even v called and asked? how many members r der in training? i got selected from kolkata location but they have not sent any any offer letter yet.. they said they will send it within a week.its almost a week now @helper, @ shilpa ,, what was your location of interview? @helper, @shilpa, plz can u help me guys with the exact job profile and job description. and abt the package they are offering. bcoz when i asked them, they said its 2.5 lacs Show more responses ya..i got selected in bangalore, and job profile is graduate engineer trainee but they havent send any offer letter yet:( @shilpa , what is the package they are offering in bangalore ? same here... they havent sent any offer letter yet pune,mumbai and gandinagar ppl have already signed bond and have joined . Your joining must be delayed becoz they must be planning joining schedule and arranging resource ppl frm company for induction . Please wait for further communication . Package here is 2.7 lpa. hey! but its sure na they vl send offer letter??? and what is the bond period? about package i don hav clear idea...dey told long back dey vl send letter and v called and enquired dey r saying 2 more days..to everyone who calls 18 months .. in kolkata they said the bond shall be of 2 years hey guys .. plz send me the frnd request in Facebook, so that we can discuss efficiently .. my FB profile name is Mukesh Johnson Kujur hey! they told us dat joining vl be this month 6th...but no offer letter yet Show more responses @shilpa, did u call their HR ? @SHILPA, I hav sent them mails regarding the offer letter many times, but havn't got ny reply ya...called and talked to her, they said 2 more days v vl.. received the LOI today hey! wen s ur joining? even i got call from hr today,she said she vl send offer letter guyes got my offer letter @mukesh, I also gt selectd from Kolkata and I gt the call today only. They mentioned the designation as Trainee Engineer. What will be the designation after the training? Is this job all about field work? Do we have to roam everywhere? What is the average CTC for the post of GET? |
Software Engineer at IBM was asked...
Puzzle: How do you weight an elephant without using a weigh machine? 37 AnswersUse a pool -> calculate the volume of water of the pool and the water level, put the elephant in the pool, take note of the level after the elephant after it is in the pool. By Archimedes principle, the volume of water dislocated is the same as the weight. So the weight of the elephant is the same as the difference in water volume. Not quite. The volume of the water is not the same as the weight of the elephant. You'd have to estimate the density of an elephant and multiply that by the volume of the water to get the mass, then multiply that by the acceleration due to gravity in water system (SI, English Customary, etc.) you're using. Luckily, mammals are mostly water (humans are around 70% water on average), so about 2/3 of the weight of the elephant would be equivalent to the weight of the water displaced. So you would have to estimate how dense the rest of the elephant is (since it'd be minerals and such, I'd say it's more dense than water) and follow the steps described above. Apply a known force to the elephant and measure the acceleration. Use physics to deduce the mass. Show more responses As it is not specified that the International System of Units must be used, define the Elephant unit (E) as the weight of your elephant. Your elephant then weights exactly 1E. Kyle I have to disagree with you. According to Buoyancy principle: Any object, wholly or partially immersed in a fluid, is buoyed up by a force equal to the weight of the fluid displaced by the object. So if you calculate the displaced fluid weight, which is quite easy in water as it is very close or equal to 1kg/L, you can get very close to the real weight of the elephant. Hmm, I think Kyle is right... and so are you when you say "Any object, wholly or partially immersed in a fluid, is buoyed up by a force equal to the weight of the fluid displaced by the object". IMHO elephants don't float... Actually Kyle is right. If we put something in the water, such as an sealed box with a ten pound weight inside (does not float), it will displace a proportionate amount of water. However, if we fill it up with a 50 pound weight, the same amount of water will be displaced, however. Fernando, you are using the Buoyancy principle. The Buoyancy principle is meant for objects that float (hence the word buoyancy-it means pressure to keep afloat). As Wouzz said, elephants don't float. You could just put a boat in water, measure displacement. Then put the elephant in the boat and take the difference. The displacement is going to equal mass as long as it's floating so you're good in a boat. Kyle was right that if you just threw an elephant in a pool, you would have you figure out density and all that. I would say bring a female elephant and let them enjoy life.. Isn't that just an improvised "weighing machine"? it sounds like you all are trying to determine whether an elephant is a witch (Monty Python reference). Instead of dealing with the whole mess of a wet elephant, why not use other pneumatic tools like an inflatable platform, an air pump, and a pressure sensor. See how much air pressure is required to lift the elephant. My experience is this, you don't have to have a perfectly correct answer. The goal of the question is to see if you can think around a problem. Besides elephants, I have heard 747's and aircraft carriers used as the object. A good answer shows that you thought of an alternate way of measurement, so the water displacement and pressure sensor ideas work. PS, if they ask you to weigh a 747, I would answer "Land it on an aircraft carrier and measure the additional water displacement!" I would use a see saw to weight my elephant. Using my weight (212 lbs in work wear), move the elephant until we balance, and then compare my distance to the pivot point to Clancy's distance to the pivot. (I named my elephant Clancy). The hardest part... finding a see saw strong enough to hold Clancy. Show more responses Archimedes Law of the Lever states: Magnitudes are in equilibrium at distances reciprocally proportional to their weights. "Give me a place to stand on, and I will move the Earth." Elephants DO float, even in fresh water. They're blubbery. Simple answer : Use a beam balance . Put elephant on one side and start throwing weights on the other side . When the beam is balanced you got the weight of the elephant equal to the sum of weights on the other ! Just ask him... Just find a person having a bad day and weigh him/her, help that person feel better, then weigh him/her again. The difference is the weight of the elephant you removed off his/her back. Works for monkeys too. one "weight"(s) by putting a weight on it note that the answer above is referenced to the question on THIS page which has been transcribed wrongly from the "home page" question (the "t" has been added) I would ask if it was an Indian elephant or an African elephant. I would solicit bids and then sub-contract the task to a reputable, cost-effective elephant weight service vendor, and let THEM decide the best approach.They can use a weigh machine or use any other method that does not require ME to use a weigh machine. The question (and answer) are no different than any other variation of, "How do you accomplish a task when you don't have the needed resources?" by using first clas lever. keep an elephant at known distance from the fulcrum; make the effort distance long enough that your weight balances the weight of an elephant; by using the formula load*load distance = effor*effortdistance( principle of lever) you already know load distance, effort distance and effort now you can calculate load, which is nothing but elephan'ts weight Show more responses By using the momentum conservation law, First I find a heavy enough object mith exact mass of m1 and then throw it with speed V1 to the elephant which is standing on a friction-less surface like ice or on plate with wheels under it to reduce the friction. after they meet, the elephant will move. and the object will change its direction and speed. Then I calculate the speed and direction of elephant and reflecting object, and finally I solve the vector equation below: m.v1=m.v2+M.V v1=vector of initial speed of object v2=vector of final speed of object M=elephant mass V=vector of elephant speed elevate the elephant to height "h". it will have potential energy of "U=mgh". hurl the elephant into a well which is vacumed well to avoid friction. at the end of the well, there is a pool of water with exact mass of " m' " and temprature of T1. after elephant reaches the pool he will give all of his energy to water causing water to become warmer Q=U. so mgh=m'c(T2-T1) with knowing g,h,m',c,T1 and T2 m can be calculated easily. place elephant on an iron plate and move it horizontally with steady speed v. and pass them through a constant magnetic field of B. change B untill the elephant start to move upward. read B and V. F=V x B is the force of magnetic field ( x denotes vector multiplication) which is now equal to weght force W=mg. knowing g the gravity constant, solve m. use SEE SAW put elephant on one side and on other side some men when it get balanced weighs the men Possible answers: 1. Zero. Take the elephant to space. The weight = 0. 2. I can guess it to around 150 kg ( there is fat person who lives next door and we call him an elephant his weight is 150 kg) I got asked this question. But the water displacement has gotten old. They prompted me for another answer. I said you measure the elephant and find out its volume in cubic meters. Then weigh its leg and measure it. Lets say the leg weighs 20 kgs and has a volume of 20 cubic metres. Then, each cubic metre weighs 1 kg. So if the total volume of elephant is 350 cubic meters, it will weigh 300 cubic metres. Take heavy weight gym dumbells keep start hanging with the one end of the rope an the other end to elephant and the rope goes over the pully,keep adding weight till elephant gets lifted esimate the answer to certain range and put it on a boat and if the boat shrinks it is more than the estimate weight else less else use F=MA forumula apply certain force and the calculate acceleration and then mass OK guys i take a boat which can carry more than a load of an elephant i keep the elephant in that boat [ there fore designed load = load of elephant+ X load] i will add some more load by boarding some swimmers one by one into boat if it starts sinking it means it reached designed load [designed load By allowing him to sit on us Show more responses Fernando,Your answer is really very wierd. First of all: rise in level of water will be equal to elephant's volume not weight. There is a vast difference in volume and weight. Second: if you think that you will estimate it's density to calculate it's weight then it will be a wierd thing because you will never be able to guess it right. Third: rise in level of water of pool will indicate the volume of submerged part of elephant and not whole elephant. If you think that you will submerge whole elephant then obviously you are killing it .So your answer is scientifically and economically wrong. I might suggest that you should take a help of a strong boat to determine elephant weight. take the boat in water and elephant on the boat.the boat will obviously sink a little.mark the level. now get elephant off the boat and put some weights on the boat till it reaches same level. now measure the weights and you will get the weight of elephant THANK YOU by counting the elephant letters, 8 letters is the answer. You don’t need a weigh machine to weight the elephant. The elephant is the weight Check the elephant has ever been weighed in near past and rely on that data |
Junior Software Engineer at EPAM was asked...
tell me about yourself 36 AnswersHello, can you tell what type of questions they asked in 2nd coding round? Shortest path algorithm and implement a class that implements the interface and write all the methods as per their specification and reach all test cases . And what about the mcq questions? Show more responses They are a combination of databases , java , operating system, networking etc can you tell me about the detailed description of coding round 2 please it will help me a lot. Round 2 contains two coding questions and 10 mcqs. Mcqs based on core subjects of computer science and those two coding questions will be of level 3 - level 4 in difficulty . implementing the interfaces using inheritance , or sorting some data with some constraints , collections , algorithms implementation like shortest path , merge sort techniques etc . thanx, a lot for your time :) No mention , if you have the link of round 1, just send it to me . what are they asked in technical interview? Mostly on java typical questions about constructors, main method , oops concepts and collections and some advanced concepts like cloning , memory allocation and JVM architecture . tq what sites or materials are to be followed to crack can u tell us I am not sure about these online sites, its better you go and solve the previous questions of different companies only on java. That might help u a lot .... Show more responses thanks for your quick response what types of questions did they ask in 1 round? Hello, Is it necessary to code in java language?Because it has mentioned that first round is online coding on java and second round is online coding on java First round u can code in your own language... But i suggest to write in java and ...second round is mandatory to write in java. hello,is second round an elimination round? Thank you ! Hello, I see that you have already mentioned the questions asked in the second round, but I didn't really get the whole picture. would you please tell me which sections to focus on in the second round and for the technical part. do they ask questions on anything apart from core java and data structure? also, how is the company(assuming you joined)? what type of questions are given in coding round 1? what type of questions are given in coding round 1? there will be three programming questions,first one was displaying the particular array element whose index will be given input,but we need to use exceptional handling. the second question was finding repeated letter in a given word along with its count, and the third one was extracting string within given xml tags,ex:<div>hai</div> your output should be hai. 2 nd round coding programs were on real time statements or not? Show more responses Can you tell me what type of question answer is asked? second round coding are mostly in graphs and we will have a class diagram and need to implement code for that class diagram. one question was on list of records and we should display the particular record based on a search string they give as input. what will be the cut off criteria for clearing coding round 2? what areas are needed to be focused in order to clear the round 2? After how much time did you receive your joining letter/offer letter when you got selected. Actually i was also selected in the recent drive in July but haven't received the joining letter/offer letter although I have submitted all the docs they asked for.? Please answer i am quite nervous about my selection. Congratulations and Don't worry, you will get your offer ..it will take quite some time ... Thanks a lot for answering. I was not expecting anyone to reply but you did. Thanks Hello Duraivel, check your mail please. In second round how many coding questions will be der? In the first round I cleared two out of three questions will all test cases passed. I got 50/100. Can anybody tell me what are my chances for the second round?. Show more responses I got 58 in first round...will i qualify for second round? Hey, can I know if I am eligible for the second round? In the first round I got 95.5 out of 100(only one test case in 2nd question went wrong and rest all are correct). Also, can you please tell me how did you prepare for your second round(Because you mentioned that there will be a class diagram given and we have to implement it in java and also some graph questions). So how did you prepare for such questions? and also what about GD, is it moderate? What topics are generally asked(is it on current affairs or general topics)? In techincal interview is it ok if we have good logical skills and know concepts of OOPS thoroughly? This would help me a lot if get a response, I will soon start preparing so I wanted to know where to start and how to start. @Vyshnavi you must have cleared the first round. Have you already attended the drive or not? how was it? I will be attending on 2nd Aug. Please do answer One or more comments have been removed. |
write a program in c/c++/java to print the pattern 1 2*2 3*3*3 4*4*4*4 4*4*4*4 3*3*3 2*2 1 34 Answers#include int main() { int i,j,n; scanf("%d",&n); for(i=1;i=1;i--) { for(j=1;j<=i;j++) { printf("%d",i); if(j hi atul your answer is wrong it only printing 1 infinite time. i was able to solve that problem in exam and my program was working for all the test cases. #include void printPattern(int n) { int i,j; for(i=1;i=1;i--) { j=1; if(i==0) printf("%d",i); else { printf("%d",i); while(j Show more responses #include int main() { int n; int i, j; for(i = 1;i = 1;i--) { for(j = 1; j <= i; j++ ) { printf("%d",i); if(j!=i) { printf("*"); } } printf("\n"); } } #include int main() { int n; int i, j; for(i = 1;i = 1;i--) { for(j = 1; j <= i; j++ ) { printf("%d",i); if(j!=i) { printf("*"); } } printf("\n"); } } public class JavaApplication4 { public static void main(String[] args) { // TODO code application logic here for(int i = 1; i 0) { System.out.print("*"); } } System.out.println(); } for(int i = 4; i >= 1; i--){ for(int j =1; j 0) { System.out.print("*"); } } System.out.println(); } } } #include void printPattren(int n); int main(){ int n; scanf("%d", &n); printPattren(n); return 0; } void printPattren(int n){ int i, j; for(i = 1; i = 1; i--){ j = 1; printf("%d", i); while(j < i){ printf("*"); printf("%d", i); j++; } printf("\n"); } } #include void printPattren(int n); int main(){ int n; scanf("%d", &n); printPattren(n); return 0; } void printPattren(int n){ int i, j; for(i = 1; i = 1; i--){ j = 1; printf("%d", i); while(j < i){ printf("*"); printf("%d", i); j++; } printf("\n"); } } this code is running successfully and giving the output #include int main(void) { // your code goes here int i,j,k=0,l; for(i=1;i=1;i--) { l=i; for(j=1;j<=i;j++) { printf("%d",i); if(k #include int main(void) { // your code goes here int i,j,k=0,l; for(i=1;i=1;i--) { l=i; for(j=1;j<=i;j++) { printf("%d",i); if(k there is a problem that only half of my code is getting displayed import java.util.*; public class qus1 { public static void main(String argc[]) { int i,j; int n; Scanner sc=new Scanner(System.in); System.out.print("Enter value of n : "); n=sc.nextInt(); for(i=1;i=1;i--) { for(j=i;j>=1;j--) { if(j==1) System.out.print(i); else System.out.print(i+"*"); } System.out.println(); } } } import java.io.BufferedReader; import java.io.InputStreamReader; public class Solution { public static void main(String [] args) throws Exception{ int i , j , k=1 , n; BufferedReader bufferedReader= new BufferedReader(new InputStreamReader(System.in)); n=Integer.parseInt(bufferedReader.readLine()); for (i=1;i<=n*2;i++){ if (i<=n) { for (j = 1; j <= i * 2 - 1; j++) { if (j % 2 == 0) { System.out.print("*"); } else { System.out.print("" + i); } } } else { for (j = 1; j <= 2*(i-k)-1; j++) { if (j % 2 == 0) { System.out.print("*"); } else { System.out.print("" + (i-k)); } } k+=2; } System.out.println(""); } } } Show more responses #include void print_pattern(int); int main() { int n; scanf("%d",&n); print_pattern(n); return 0; } void print_pattern(int n) { for(int i=1;i0;i--) { for(int j=1;j<=i;j++) { if(i==1) { printf("%d",i); } else { printf("%d",i); if(j!=i) { printf("*"); } } } printf("\n"); } } #include void print_pattern(int); int main() { int n; scanf("%d",&n); print_pattern(n); return 0; } void print_pattern(int n) { for(int i=1;i0;i--) { for(int j=1;j<=i;j++) { if(i==1) { printf("%d",i); } else { printf("%d",i); if(j!=i) { printf("*"); } } } printf("\n"); } } #include int main() { // your code goes here int i,j,k=0,l; for(i=1;i1&&j=1;i--) { for(j=1;j1&&j #include //THIS CODE WORKS void main() { int i,n; for (n=1;n=1;n--) { for(i=1;i<=n;i++) { printf("%d",n); if(i!=n) printf("*"); else printf("\n"); }} } for(int i = 1;i0;i--) { for(int j=0;j #include int main() { int i,j,k; k=0; for(i=1;i=1;i--) { for(j=(i+k);j>=1;j--) { if(j%2==0) printf("*"); else printf("%d",i); } k--; printf("\n"); } return 0; } #include int main() { int i,j,k; k=0; for(i=1;i=1;i--) { for(j=(i+k);j>=1;j--) { if(j%2==0) printf("*"); else printf("%d",i); } k--; printf("\n"); } return 0; } //THIS IS VERIFIED AND CORRECT CODE import java.util.Scanner; public class MyClass { public static void main(String[] args) { int i,j; int n; Scanner sc=new Scanner(System.in); System.out.print("Enter value of n : "); n=sc.nextInt(); for(i=1;i=1;i--) { for(j=i;j>=1;j--) { while(j>1){ System.out.print(i+"*"); j--; } System.out.print(i); } System.out.println(); } } //THE SAME CODE IN C #include void main(){ int n; printf ("Enter the value of n"); scan ("%d",&n); void printPattern(n); } void printPattern(int k){ int i,j; for(i=1;i=1;i--) { for(j=i;j>=1;j--) { while(j>1) { printf ("%d",i); printf ("*"); j--; } printf ("%d",i); } printf ("\n"); } //Pattern Solution import java.util.*; import java.lang.*; import java.io.*; class Pattern { public static void main (String[] args) throws java.lang.Exception { for(int j=1;j=1;k--) { for(int l=1;l<=k;l++) { if(l==1) System.out.print(k); else System.out.print("*"+k); } System.out.println(); } }} Show more responses All codes are giving wrong output *** this is the correct one***** #include int main(void) { int i,j; for(i=1;i=1;i--){ for(j=1;j<=(i*2)-1;j++){ if(j%2==0){ printf("*");} else{printf("%d",i);} } printf("\n"); } return 0; } #include int main(void) { int i,j; for(i=1;i=1;i--){ for(j=1;j<=(i*2)-1;j++){ if(j%2==0){ printf("*");} else{printf("%d",i);} } printf("\n"); } return 0; } int main() { int i, j, rows, k, x; printf("Enter number of rows: "); scanf("%d",&rows); for(i=1; i 0; i--) { k = i - 1; for(j = 1; j <= i; j++) { printf("%d", i); if(k != 0 && j != i) { printf("*"); } } printf("\n"); } return 0; } int main() { int i, j, rows, k, x; printf("Enter number of rows: "); scanf("%d",&rows); for(i=1; i 0; i--) { k = i - 1; for(j = 1; j <= i; j++) { printf("%d", i); if(k != 0 && j != i) { printf("*"); } } printf("\n"); } return 0; } there is problem in the interface of this website, complete answer is not getting pasted #n is the maximum number which would occur in the pattern. n = int(input()) for i in range(1,n+1): s = [] for j in range(i-1): s.append(str(i)) s.append('*') s.append(str(i)) print(''.join(s)) for i in range(n, 0, -1): s = [] for j in range(i-1): s.append(str(i)) s.append('*') s.append(str(i)) print(''.join(s)) #include #include void main() { int i,j,k; for(i=1;i=i;j--) { printf(" "); } for(k=1;k<=i;k++) { if(k==1) { printf(" %d",i); } else(printf("*%d",i)); } printf("\n"); } } #include #include void main() { int i,j,k; for(i=1;i=i;j--) { printf(" "); } for(k=1;k<=i;k++) { if(k==1) { // Notice the space before %d printf(" %d",i); } //Notice the* before %d else(printf("*%d",i)); } printf("\n"); } } Show more responses what is lt meaning One or more comments have been removed. |
Given a string "aaabbbcc", compress it, = "a3b3c2" . Given that output string's length is always smaller than input string, you have do it inplace. No extra space 30 Answerspublic static String cstr(String a){ if(a.length()<2){return a;} if(a.length()==2){if(a.charAt(0)==a.charAt(1)){return a.charAt(0)+"2";}else{return a;}} for(int i=0;i #include #include #include #define STR_SIZE 26 int main() { /* Current char sequence tracker */ char *c = NULL; char *b = NULL; char *str = (char*)malloc(STR_SIZE * sizeof(char)); if(NULL == str) return -1; memcpy(str, "aaaabbbcceeeeefffffff", 26); b = c = str; printf("Input: %s\n", b); while(*str) { if(*(str+1) != *str) // Repeat sequence ends { // Add 48 so the count gets printed as a char *(c+1) = ((str-c+1)+48); // Updated count, copy rest of the string starting after the count position memcpy(c+2, str+1, strlen(str)); // Update c to point to the new char repeat sequence c = c+2; } str++; } /* b was initialized to point to str up top, proving it was done in place */ printf("Output:%s\n", b); free(b); b = NULL; return 0; } String test="aavvvqwqaa"; int count=0,start=0,end=0; int length=test.length(); for(int i=0;i Show more responses Rohan: What if I give you the string "aaaaaaaaaa"? Your solution will print "a:", not "a10". in java, if you give me a String str="aaabbbcc"; you can't modify the str as all, then how can you do it in place? I assume I can go through the str, and store the new string such as "a3b3c2" anyone can explain to me? java inplace public void compress(char[] str) { if (str != null && str.length > 1) { for (int last = 0, curr = 1, count = 1, tail = 0; curr 1) { str[tail++] = str[last]; str[tail++] = (char) count; count = 1; } last = curr; curr++; } } } Need to delimit the array public void compress(char[] str) { if (str != null && str.length > 1) { int tail = 0; for (int last = 0, curr = 1, count = 1; curr 1) { str[tail++] = str[last]; str[tail++] = (char) count; count = 1; } last = curr; curr++; } str[tail] = '\0'; } } small correction - public void compress(char[] str) { if (str != null && str.length > 1) { int tail = 0; for (int last = 0, curr = 1, count = 1; curr 1) { str[tail++] = str[last]; str[tail++] = (char) (count + '0'); count = 1; } last = curr; curr++; } str[tail] = '\0'; } } Try this.. it generates the desired output in Java /** * * @author Sourabh Mishra * Class which handles compression of a string replacing the occurrences of characters * with the character followed by its count in the input string * */ public class StringCompressor { /** * Method takes input as a string and replacing the occurrences of characters * with the character followed by its count in the input string * @param data String * @return */ public String compressString(String data){ StringBuilder outBuilder = new StringBuilder(); char prevChar = data.charAt(0); int counter = 0; char currChar; int length = data.length(); for(int i=0; i< length; i++){ currChar = data.charAt(i); if(currChar == prevChar){ counter++; // For the last unique characters if(i == length-1){ outBuilder.append(currChar); outBuilder.append(counter); } continue; } else { outBuilder.append(prevChar); outBuilder.append(counter); prevChar = currChar; counter=1; } } return outBuilder.toString(); } /** * @param args */ public static void main(String[] args) { StringCompressor sc = new StringCompressor(); System.out.println(sc.compressString("aaabbbcc")); } } An additional check and write inside in the else class is required to print the final unique character for inputs like "aaabbbh" public class Stringcompress { /** * Method takes input as a string and replacing the occurrences of * characters with the character followed by its count in the input string */ public String compressString(String data) { StringBuilder outBuilder = new StringBuilder(); char prevChar = data.charAt(0); int counter = 0; char currChar; int length = data.length(); for (int i = 0; i < length; i++) { currChar = data.charAt(i); System.out.println("Curr character is :" + currChar); System.out.println("Prev character is :" + prevChar); if (currChar == prevChar) { counter++; // For the last unique characters if (i == length - 1) { outBuilder.append(currChar); outBuilder.append(counter); } continue; } else { System.out.println("Prev character in else is :" + prevChar); outBuilder.append(prevChar); outBuilder.append(counter); prevChar = currChar; counter = 1; if(i==length-1) { outBuilder.append(currChar); outBuilder.append(counter); } } } return outBuilder.toString(); } public static void main(String[] args) { Stringcompress sc = new Stringcompress(); System.out.println(sc.compressString("aaaaaaadfgdfu")); } } public class Example1 { static String S1="aaabbbccc"; static String comstring=""; public static void main(String[] args) { System.out.println(" Actual string is "+S1); S1=S1+"#"; String oldString=S1; int count=1; for(int i=0;i Show more responses import java.io.*; import java.util.*; import java.text.*; import java.math.*; class amzone { public static void main(String [] args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=br.readLine(); int n=line.length(); int count=1; for(int i=0;i Using Ruby methods, ans = "" s.split("").group_by{|x| x}.each{|k,v| ans += "#{k}#{v.count}"} puts ans But this code snippet will produce "a4b3c2" for the input string "aaabbbcca" import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class StringCharCount { public static void main(String args[]) { String inputString="aaabbbccdddddddddddd"; List charUniqueList=new ArrayList(); Map charCountMap=new HashMap(); for(int i=0;i What about the input "abc"? I assume that should compress to "a1b1c1" which is NOT shorter than the input, so you cannot compress in place. string CombineWithNoExtraSpace(string S) { int n=S.size(),count=1,i=0; if(i==n) return "\0"; while(i+1<=n && S[i]==S[i+1] ) { count++; i++; } S = S[i] + to_string(count) + combine(S.substr(i+1,n-count)); return S; } def compress(in_string): final_string = "" init_char = "" ch_val = 1 for (i,ch) in enumerate(in_string): if ch is not init_char: init_char = ch if ch_val > 1: final_string += str(ch_val) ch_val = 1 final_string += ch continue ch_val += 1 try: out = in_string[i+1] except IndexError: final_string += str(ch_val) return final_string print compress("aaaaab") public String compress(String in) { if (in.length() 1 ? right-left : ""); right++; left = right-1; } return out.toString(); } public String compress(String in) { if (in.length() 1 ? right-left : ""); right++; left = right-1; } return out.toString(); } Answer: public class StringCompression { public static void main(String[] args) { String inputString = "abcabcaaaaaaaaaaaaabc";//"aabcccccaaa"; System.out.println(getCompressedString(inputString)); } private static String getCompressedString(String originalString) { StringBuilder compressedStr = new StringBuilder(); if(originalString != null && originalString.length() = originalString.length()){ return originalString; } else{ return compressedStr.toString(); } } } public static String returnCount (String values) { HashMap getHash = new HashMap(); StringBuilder sb = new StringBuilder(); // char[] charsInString = values.toCharArray(); for(char characters : values.toCharArray()){ if(!(getHash.containsKey(characters))){ getHash.put(characters,1); } else getHash.put(characters,getHash.get(characters) + 1); } // for() for(char keys : getHash.keySet()){ sb.append(keys); sb.append(getHash.get(keys)); } System.out.println(getHash); return sb.toString(); } Show more responses #include #include int main(void) { char ch; char accept[100]; char output_string[100]; int count=0,i,j,pos=0; scanf("%s",&accept); printf("%s",accept); for(i=0;i dfdsf #include int main() { char c[30]; int i,count=0; printf("Enter a String : "); scanf("%s",c); for(i=0;s[i]!='\0';i++) { count=1; while(s[i]==s[i+1]) { i++; count++; } printf("%s,%d",s[i],count); } return 0; } x="aaabbbcc" for i in range(len(x)): if i==x.index(x[i])+x.count(x[i])-1: print(x[i],end="") print(x.count(x[i]),end="") public class CompressUtil { public static void main(String[] args) { char[] str = "aaabbbccs".toCharArray(); StringBuilder strcompress = compressString(str); System.out.println(strcompress.toString()); } private static StringBuilder compressString(char[] str) { StringBuilder strcompress = new StringBuilder(); int counter = 1; if (str.length == 1) strcompress.append(str[0]); for (int i = 0; i < str.length - 1; i++) { if (str[i] == str[i + 1]) { counter++; //check if it's the last position if (i + 1 == str.length - 1) { strcompress.append(str[i] + "" + counter); } } else { if (counter == 1) { strcompress.append(str[i]); } else { strcompress.append(str[i] + "" + counter); } counter = 1; //check if it's the last position if (i + 1 == str.length - 1) { strcompress.append(str[i + 1]); } } } return strcompress; } } public class Test { // Initialize the count to default static int count=1; static void strCompress(String str) { for(int i=0;i public class Test { // Initialize the count to default static int count=1; static void strCompress(String str) { for(int i=0;i One or more comments have been removed. |
implement the dynamic polymorphism 23 AnswersDid you qualify for round 3 ?what were the questions asked in round 2 and 3?Is it hackerrank test in round 2 ? What were the mcq s about ?how many mcqs were there ? Help me out mate ! Do we have to code in java alone ? Or any other languages? Nope , I wasn't . mcqs like what exception do we get when a file is write protected , what protocols are used to create an online chatting web application , almost all subjects in gate . there were 10 mcqs and we need to write the code only in java .... Could you please answer me .what are the 2 coding questions you were asked in the round 2 so that we have an idea of what kind of questions they were expecting ? Hope a reply from you.Thank You Show more responses 1) to implement the dynamic polymorphism using method overriding in child classes with an example of cars 2) implement the merge sort algorithm using either java or c . Try not to leave any test cases ...you will be shortlisted on if you can accomplish all the test cases . Thanks for your reply. I have cleared the 1st coding round and I have interview within few days. So I just want to know your experience in detail which will help me a lot. Reply if you have any suggestions to crack the interview. Thank you. Congratulations for clearing the first round , go on practising the algorithms of DAA , writing your own code for all sorting and searching techniques . solve some problems in hacker rank of medium level ...that's all you need . be clear with your basic concepts in what ever the language you have opted for programming . Is it the same type of questions asked as he mentioned? or different set of questions. Is it through epam test portal? Hey can u plz explain what questions they asked in 1 st round what type of mcq they asked and is only mcq in 1st round and any other asked plz reply anyone plz share experience I am not qualified in round 2 and I don't know about round 3 . its not hacker rank , its code ground ....the mcqs were very tough for a normal student unless he is brilliant and have depth in concepts . there were 10 mcqs for 20 marks I think ...and regarding the coding ..you need to do it only in java ...bcz epam is particular about coding in java ... What about linked list sorting algo can we write in c or c++ and can u plz share 1 st round coding question plz I don't have either link or the data of the first round coding , but they gave all the interfaces to be developed with some constraints ...and u can write the linked list both in c or c++ Ok Thanks bro for helping this all helps me a lot ..😊 But still u remember some program or unimplemented method that will help me lot .. Thanx in advance..😊 And once again thank you bro ..👍 When I can expect interview call after first round of code ground. Last date to submit code for round 1 was on Friday 12 Jan. I got approx 65-70/100 should I wait for round 2. Please reply I will really appreciate it. Thanks Show more responses If you written 2 programs correctly in the first round you will qualify for the further rounds. In the second round they are going to ask 2 programs mainly on sortings and interfaces. Later in the 3 round they will ask technical questions on oops concepts, serilization and collections so more what you have written in your resume. In the HR they will ask general questions to you. Thanks for the reply . Really appreciate it. i had answered 2 programs correctly but the third one i couldn't get all the test cases correct. Hoping i would be called for 2nd Round . and again thanks . Already they have sent the mail's for second round for some people. Tommorow they have second round with following others rounds I didn't got any mail don't know why? Did 2 programs correct with all test cases correct . And the third on 3/6 test cases were correct. Really was expecting their call. Thanks bro for replying . Hey can you tell me what kind of programming questions they ask in first round..Its easy or difficult? Please reply.. should we really have a web cam for first round.? can anyone tell me please from which website they have given programs to us for solving, anyone have clue. please reply fast its urgent We need to have webcam in order to open the test , without it ..it may not open it at all ...and regarding the questions ..they make it from other questions ...not exactly the same as it is ...so be a problem solver ...to solve those problems .... Please answer what type of questions asked in 1st round? Pretty much on c and java ...simple questions to expect output of a program. |
Software Engineer at Shell was asked...
The final round of interview was challenging in terms of how you pick scenarios from your career. 21 AnswersOut of the 4 scenarios - I realized its better to show both sides of the coin and treaded one positive experience followed by negative experience. It was fulfilling to mention that a mistake was made due to XYZ reasons and was corrected in future assignments. Hi could you please share your contact number Hi, I have recently attended an interview with Shell last week and awaiting for my results. I also got through the first round i.e. the functional competency round on the F2F interview and also completed my behavioral round as well. My interview went very well as I had prepared as per there site and I was very positive and confident. Within 15mins, I got to know that I have made it to the 2nd round I.e. the behavioral round.They collected my photograph and had already taken my salary slips before the F2F interview. SO, can you tell me how much chances are there that I would get through Shell ? Results are expected this week. Show more responses Hello, given that they had collected your photograph and salary slips, I would say you have a real good chance of receiving an offer with Shell. All the best! Hi ABC can u share what kind of techincal question they have asked, r they asked to write program or only oral with usecases? as i am having my interview on next week for java developer. Hi, I understand they are checking the background as part of enhanced screening via a 3rd party agency? How long does this process take? What to expect? And does the status of the application in the Shell portal change regularly? I see it as Completed Assessment. Thanks for a reply. For me, they obtained declaration to carry out BG check 10 days prior to joining and I was not contacted further in this regard. For some colleagues, third party requested for additional docs. Am not sure on the status of my application on shell portal. Hi I have been scheduled for F2F interview for QA position on June 6th. Can anyone help me in knowing what kind of questions might come on my way in both Professional Assessment and Structured Assessment If anyone from QA had experience with Shell interviews please do reply. Hi there XYZ, I suppose your interview is already done, could you please assist me in Professional and Structural interview. what scenarios were asked and what all technical questions were put across. Any tip that i should keep in mind. Thanks in advance. Being low paid, will it damage my case if i ask for a 50% hike in case selected? I am awaiting result of final round in a week's time. Usually, Shell has a lower and upper salary limit for a specific salary group. No matter how low your current salary is, you ll be mapped to atleast the lower limit. In my case, I did not have to negotiate, but you may do so based on your requierments. i completed my final assessment on 8 th August. Dint receive any updated till now. please guide. Hi, I also attended interview in Shell this Wednesday, everything went fine.. but after all the rounds Hr didn't collect photograph or any Documents.. She just told me that within 2 weeks you will be getting result? Can you tell me, is that any chance that they will select me? Show more responses Same here, 2 rounds f2f completed, hr said they will get back to me within 2week, but they didn't collected any doc or photo, will I have chance of getting offer? Hi, Did you get ur call letter after your process was done. Hii, did u get ur offer letter? After final round of interview how many weeks they will take to tell the result? Did you get the offer and how long it took? Hi XYZ, did you get your interview feedback. How long they are taking to tell the feedback after attending the final assessment. Hi there, How long they take to give the feedback after the final assessment. I finished the final assessment on Oct 8, it's been a month now, still no update on it. Does shell confirm the outcome of interview or do we just need to wait for some indefinite time for a call from HR otherwise assume rejection? If this is the policy then how long should we wait? |
R&D Engineer at Vital Labs was asked...
Collection,interface, difference set nd list??? 16 Answersfinal round coding is paper based or system ??? System question in first round???????? Show more responses Input array= 2,4,5,-3,3,4,6 Sum=7 Output:- u have to print all pair whose some is 7 Sum* package Virtusa; import java.util.*; class Test{ public static void main(String[] args) { // This is a book System.out.println("Enter String with first alphabet is capital:"); Scanner st=new Scanner(System.in); String s=st.nextLine(); char[] c= s.toCharArray(); int max=c.length,min=0; for(int i=c.length-1;i>=0;i--) { if(c[i]==' ' ){ min=i; printWord(c,min+1,max); max=min; } } printWord(c,0,max); } private static void printWord(char[] c, int min, int max) { if(c.length == max){ c[min] = Character.toUpperCase(c[min]); } if(min == 0){ c[min] = Character.toLowerCase(c[min]); } for(int i=min;i package Virtusa; import java.util.*; class Test{ public static void main(String[] args) { // This is a book System.out.println("Enter String with first alphabet is capital:"); Scanner st=new Scanner(System.in); String s=st.nextLine(); char[] c= s.toCharArray(); int max=c.length,min=0; for(int i=c.length-1;i>=0;i--) { if(c[i]==' ' ){ min=i; printWord(c,min+1,max); max=min; } } printWord(c,0,max); } private static void printWord(char[] c, int min, int max) { if(c.length == max){ c[min] = Character.toUpperCase(c[min]); } if(min == 0){ c[min] = Character.toLowerCase(c[min]); } for(int i=min;i U selected? Friends is anyone got selected for the RD engineer post?? import java.util.*; public class StringTest { public static void main(String[] args) { String str = "This is my book"; String a[]=str.split(" "); for(int i = 0; i list = Arrays.asList(a); Collections.reverse(list); System.out.print(String.join(" ", list)); } } import java.util.Arrays; import java.util.Collections; import java.util.List; public class StringTest { public static void main(String[] args) { String str = "This is my book"; String a[]=str.split(" "); for(int i = 0; i list = Arrays.asList(a); Collections.reverse(list); System.out.print(String.join(" ", list)); } } package StringTest; import java.util.Arrays; import java.util.Collections; import java.util.List; public class StringTest { public static void main(String[] args) { String str = "This is my book"; String a[]=str.split(" "); for(int i = 0; i list = Arrays.asList(a); Collections.reverse(list); System.out.print(String.join(" ", list)); } } U can't use inbuilt function. Show more responses static void book(){ String s="This is my book"; String[] res=s.split(" "); for(int i=res.length-1;i>=0;i--) { char[] rword=new char[res[i].length()]; for(int j=0;j que-This is my book out-Book my is this import java.util.ArrayList; import java.util.Collections; public class AfterReversingFirstLetterOfSentenceIsCapital{ public static void main(String[] args){ String str="This is my book"; String[] c= str.split(""); ArrayList al=new ArrayList(); for(int i=0;i |
Software Developer at Zoho was asked...
Aptitude questions were from the topics like Discounts, Profit or loss, Boats and streams, Work ,Pipes,Finding X and Y, Numbers, Ratio and Proportion. And all the programming questions were only from C language. 16 AnswersGeek for geeks will help you crack this round for sure. Hy bro Result came ah ? I also attended the interview that was quite easy....result came or not...i didn't get any mail....anyone received mail or call.. Show more responses Programming questions from c... These were the questions we faced on round 1. You are supposed to predict the output for the given program... 1. preprocessor some thing like #define sqt(x) x*x main(){ i=64/sqt(4)} 2. various form of array notation like s[ i ], *(s+i), *(i+s), i[s] 3. based on increment operation on pointer. eg. char *s="asdf"; s++; print s++; print s; 4. string.h based ques. eg. char s1[]="asdfasdf",s2; strncpy(s2,s1,3); 5. print char array from n th position to 0. ie. consider previous ques s1[] now just print char from s1[8] to s1[0] using for loop. 6. switch statement with no break except in default statement, enclosed within a for loop, some thing like the below one main(){ int i=1; for (i=1;i<20;i++) { switch(i) { case 1: i+=2; case 2: i+=3; case 3; i+=4; default: i+=5; break; } } printf ("%d",i); } 7. nested function with a static int variable. it has 2 return statement in it one executed on a condition. 8. print sizeof(++i + ++i) considering i as a int of size 2bytes, as sizeof() will perform no arithmetic operation in it, it just print 2. 9. struct base question which as some thing like struct{ int a1:1; int a2:2} and it goes on something like that... 10. bitwice operation performed on int.. i dont remember the question but the result ended up as 1,1,0 If results came please share... Hy what will be the qualifying mark ? Any guesses ? Did any one of you got any updates for the drive held on 20th Aug 2017 at Madurai Velammal Engg Coll ? If so, please share here.. Guys result is out. when is round 2..? Someone, named Sibi had said result was out. Is it true? Did anyone receive email communication reg further rounds based on performance ? Yeah its true 29th 2nd round Is the results out or not Show more responses yes, but i got mail 2day only and the 2nd round is on september 1st Ok guys :-) Thank you Sibi and all others who had intimated us about the selection. Do well in the next round. It is a very good company.Do your best and leave the rest. Can you navigate the test window during online test-round 1? |
PHP Developer at WebKul was asked...
Q1. Draw star pattern like. n=1. * n=2. ** * n=3. *** ** * n=4 **** *** ** * n=5. ***** **** *** ** * 16 Answers#include int main() { int n=10,i,j,s,sum=1,l,k; for(k=1;k=1;i--){ l=sum-i; for(s=1;s<=l;s++){ printf(" "); } for(j=1;j<=i;j++){ printf("*"); } l=l+1; sum=l; printf("\n"); } return 0; } #include int main() { int n,i,j,k,l=1; for(n=1;n=1;i--) { if(n==3) {for(k=i-1;k>=1;k--) printf(" "); } if(n==4) { if(i>2) {for (k=i-1;k>=l;k--) printf(" "); } l++; } if(n==5) { if(i>2) { for(k=i+2;k>=l-2;k--) { printf(" "); } l++; } } for(j=i; j>=1;j--) { printf("*"); } printf("\n"); } printf("\n"); } } import java.util.Scanner; class New { public static void main(String ... args) { Scanner sc =new Scanner(System.in); int n=sc.nextInt(); int p=n-2; for(int i=1;i<=n;i++) { for(int j=1;j<=(p*(p+1))/2;j++) System.out.print(" "); p--; for(int k=1;k<=n-i+1;k++) System.out.print("*"); System.out.println(""); } } } Show more responses space is 1+2+3+...(n-2) Code is as follow: public class Pattern { public static void main(String ...args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=n;i>=1;i--) { for(int j=1;j<=(i-1)*(i-2)/2;j++) System.out.print(" "); for(int j=1;j<=i;j++) System.out.print("*"); System.out.println(); } } } public class Pattern11 { public static void main(String[] args) { int number = 6, count = number; for (int i = 1; i <= number; i++) { for (int j = 1; j <= (number - i) + count; j++) { if (j <= number - i) { System.out.print(" "); } else { System.out.print("*"); } } count = count - 1; System.out.println(); } } } int main() { int i,j,s,n; scanf("%d",&n); for(i=1;i<=n;i++) { for(s=1;s<=n-i;s++) { printf(" "); } for(j=1;j<=(n+1)-i;j++) { printf("*"); } printf("\n"); } } x=int(input()) for i in range(x,0,-1): for k in range(i-1,0,-1): print(" ",end="") for j in range(i,0,-1): print("*",end="") print() #include int main() { // Input n from user and make h,s,n all equal // Input 5 is taken randomly it can be any thing int h = 5; int n = 5; int s ; s=n; for(int u = 0; u 0 ; s-- ) { printf(" "); } for(int s = h ; h>0 ; s-- ) { printf("*"); h--; } printf("\n"); h = n - 1; } import java.util.*; import java.io.*; class Starpattern5 { public static void pattern(int n) { int i,j; for (i=n;i>=1;i--) { for (j=1;j<=((2*i)-1);j++ ) { if (j import java.util.*; import java.io.*; class Starpattern5 { public static void pattern(int n) { int i,j; for (i=n;i>=1;i--) { for (j=1;j<=((2*i)-1);j++ ) { if (j 2){ for($j=3;$j= 2){ echo " "; } $count--; for($k=$val;$k>=$i;$k--){ echo "*"; } echo "<br>"; } } ?> Import java.util.Scanner; Class web { Static void web(int n) { for(int i=n;i>=1;i--) { for(int j=0;j<=n;j++) System.out.print("*"); } System.out.println("\t"); } } Public static void main(String args[]) { Scanner sc =new Scanner(System.in); Int n=sc.nextInt(); Web(n); } } #in python n= int(input('enter the max no.')) for i in range(n): print('*'*(n-i), end=' ') Show more responses n=int(input("")) for i in range(n+1): print(" "*(n-i-1 )+"*"*(n-i)) =($n+1-$i) && $j One or more comments have been removed. |
See Interview Questions for Similar Jobs
- Software Engineer
- Engineer
- Graduate Engineering Trainee
- Business Analyst
- Mechanical Engineer
- Software Developer
- Management Trainee
- Associate Software Engineer
- Analyst
- Intern
- Network Engineer
- Assistant Manager
- Graduate Trainee Engineer
- Design Engineer
- Senior Software Engineer
- Engineering
- Manager
- Consultant
- Graduate Trainee
- Fresher