Full Stack Engineer Interview Questions | Glassdoor

Full Stack Engineer Interview Questions

491

Full stack engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Debug why the below mentioned code goes into an infinite loop int a[10]; int i; for(i=0;i<=10;i++) { a[i]=0; }

3 Answers

int a[10]; int i; for(i=0;i&lt;=10;i++) { a[i]=0; } /* the index i should not go beyond 9 ; at i==10 arrayindexoutofbounds exception should be raised */ /* but why should it be an infinite loop , assuming its a c/c++ or java code ? */

Consider how the data is stored in the stack. Lets say, addresses 2010 to 2001 is occupied by array 'a' and 'i' occupies position 2000. When the for loop executes and reached the condition where i=10, a[10] is set to 0. But according to how our data is stored in the stack, a[10] is where variable 'i' is stored. So 'i' gets overwritten to 0. And hence, the loop continues forever.

Actually, I think this is a bad question. The real behavior depends on your compiler. There is no guarantee that compiler will put i after the array a. Using the index out of bounds is an undefined behavior.

What projects are you currently working on at your job.

1 Answer

Generic class design which others talk about. pallet trailer blah blah

1 Answer

Advantage of Vectors over Arraylists in multithreading.

2 Answers

What are common HTTP verbs and give explanations for each

1 Answer

Q: Critique a given piece of code like you would in a code review with a colleague.

1 Answer

How would I troubleshoot a slow HTTP endpoint without ever talking to a user?

1 Answer

Please make the unit tests for this pass

110 of 491 Interview Questions