Threads Interview Questions
- 0of 0 votes
AnswersDesign and implement following . Suppose have 10 resources and 5 threads how do you design so that threads asking for
- pgopan.hai November 10, 2018 in United States
Resources should be done in order. Eg t1 asks for 3 resources, t2 asks for 4 resources…| Report Duplicate | Flag | PURGE
Cadence Inc Principal Software Engineer Threads - 1of 1 vote
AnswersPrint series 010203040506. Using multi-threading 1st thread will print only 0 2nd thread will print only even numbers and 3rd thread print only odd numbers.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs SDE-2 Threads - 0of 0 votes
AnswerDesign and implement a multi-threaded application that finds the occurrence(s) of a string in a text file of 100GB. It should return the line-number(s) in which the match(es) is/are found.
- Venkata Pavan August 12, 2017 in India
Need not worry about the system constraints in spawning and running threads. There is a 32 core CPU with immense power. Huge amount of RAM.
The result should be returned in few sec.| Report Duplicate | Flag | PURGE
Scientific Games Dev Lead Threads - 0of 0 votes
AnswersHow to pass c++ objects from one process to other process ?
- karthikeyy April 18, 2017 in India
Eg: one process constructs C++ object with some data other process should receive this c++ object and display the data in it.| Report Duplicate | Flag | PURGE
Bosch Developer Program Engineer Threads - 0of 0 votes
AnswersImplement Thread safe timer with start, stop and reset functionality.
- twarzo March 22, 2017 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Threads - 1of 1 vote
AnswersGiven the two objects below, implement the methods defined in the Phonebook class. This is a simulated phonebook. You should expect LookupByName and LookupByPhoneNumber to be called much more often than AddPerson. Also, this is a multi-threaded simulation so your implementations of the functions other than the constructor should be threadsafe. Feel free to rewrite this in any language of your
choice.
- Surya November 10, 2015 in United States for Cloud servicespublic struct Person { string name; string phoneNumber; } public class Phonebook { public Phonebook (List<Person> people) { } public Person LookupByName(string name) { } public person LookupByphoneNumber(string phoneNumber) { } public void Addperson(person person) { } }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Threads - 0of 0 votes
AnswersImplement ReentrantLock using simple locks.
- Ray November 09, 2015| Report Duplicate | Flag | PURGE
Google SDE1 Threads - 0of 0 votes
AnswersThere is a service which is run by a thread. Within that service, there are say 100 tasks which need to be executed sequentially(highlighted the work sequentially). How would you design your service, specifically what classes from Java framework would you use for this scenario?
- User1 August 24, 2015 in United States| Report Duplicate | Flag | PURGE
JP Morgan Java Developer Threads - 0of 0 votes
AnswersImplemented a bounded queue:
- JSDUDE June 23, 2015 in United States for Customer experience
Read:
If queue is empty, wait till it can return a value with time out
If another thread is reading from the queue then wait till that thread is done
Remove the first element from the queue and return it
Do not block if a thread is writing into the queue
Write:
If queue is full, wait till one value is read with time out
If another thread is writing to the queue, wait till that thread is done
Write the element at the end of the queue
Do not block if a thread is reading from the queue| Report Duplicate | Flag | PURGE
Walmart Labs Software Developer Data Structures Threads - 0of 0 votes
AnswersMake use of an example to depict Singleton pattern. How would you make sure it works in Multithreaded environment.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm Threads - 0of 0 votes
AnswersWhat's the use of concurrency list in java? What are various locking mechanism in java?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Coding Threads - -1of 1 vote
AnswerWrite code for reader writer (multi threading)
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm Threads - -1of 1 vote
AnswerHow would you instantiate/start/stop thread in java.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm Threads - -1of 1 vote
AnswersExplain diff between thread vs process.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm Threads - -1of 1 vote
AnswersI think Bloomberg heavily expects candidates to have good knowledge of Multithreading concepts as they work in financial data.
- Tom Walker June 07, 2015 in United States
Explain multithreading.| Report Duplicate | Flag | PURGE
Bloomberg LP Algorithm Threads - 0of 0 votes
AnswersThere are three threads in a process.
- jim.shan.JS May 15, 2015 in United States
The first thread prints 1 1 1 …, the second one prints 2 2 2 …, and the third one prints 3 3 3 … endlessly.
How do you schedule these three threads in order to print 1 2 3 1 2 3 …?| Report Duplicate | Flag | PURGE
Salesforce Software Engineer Threads - 0of 0 votes
AnswersA server receives requests from different clients...each client send a Runnable job and time on which this job should be run. Write a java program that would accept these jobs and run each job at the required time. Hint: the solution should have a job priority queue to hold the jobs and it should be multithreaded. One thread should accept the tasks, the other one should run the jobs. Also conditions and signalling will be used
- koks2000 December 09, 2014 in United States| Report Duplicate | Flag | PURGE
Linkedin Software Engineer Intern Java Threads - 1of 3 votes
AnswersA Multi-threaded server application stops working and the last log message from the application is:
"Some Server Related Message..."
Code looks like:
CalledFunc () { Code ... Acquiring Thread lock Line printing "Some Server Related Message..." Func(); Releasing Thread Lock }
1. What should the programmer in charge do to debug this?
- joe.wynton October 07, 2014 in United States for Trading System
2. What has happened wrong in the Func()?
3. If an exception is thrown in the Func() what should be done to fix problem ?| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer C# C C++ Threads - 0of 0 votes
AnswersA Multi-threaded server application stops working and the last log message from the application is:
"Some Server Related Message..."
Code looks like:
CalledFunc () { Code ... Acquiring Thread lock Line printing "Some Server Related Message..." Func(); Releasing Thread Lock }
1. What should the programmer in charge do to debug this?
- joe.wynton October 07, 2014 in United States
2. What has happened wrong in the Func() ?
3. If an exception is thrown in the Func() what should be done to fix problem ?| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer C# C C++ Threads - 0of 0 votes
AnswerYou are writing a simulation for a print server. This print
- determinedgal89 October 01, 2014 in United States
server can accept jobs from 3 places - network, USB, or operator. It can dispatch only one job at a time. Each input job should contain an integer t which is the time in seconds it will take to process the job. Write a multi-threaded program to simulate the server and provide some simulated load with jobs. Think, of some interesting statistics your program should emit and code them in.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Threads - 0of 2 votes
AnswersDifference between a crash and exception.
- avinash September 20, 2014 in India for GTSC
Difference between macros and inline functions.
Mfc: message maps and virtual functions.
Different calling convention.
Late n early binding...
Garbage collector algorithm. When gc will fail to clean the memory.
How to know heap size, crash dump analysis, What is a stack n how to know stack memory size.
Commands in windbg.
Questions on Critical section, mutex, semaphores. Can we use mutex in single process and how?
Working of MSIL and JIT COMPILER.
Can a C# code, use c++ code and call kernel functions like createfile.
Areas: dot net, oops, operating systems, thread synchronization.
Difference in execution steps of c++ and c# code| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Assembly C++ Data Structures Debugging Object Oriented Design Operating System Threads - 1of 1 vote
AnswersYou have 5 data sources. There is a program which calls these data sources and returns a count value.
You need to speedup this program. How do you do that?
This is a sample code
- dmrrb1980 July 01, 2014 in United Statesint count = getCount(ds1); if(count < 100 ) count = count + getCount(ds2); if(count < 100) count = count + getCount(ds3); if(count < 100) count = count + getCount(ds4); if(count < 100) count = count + getCount(ds5);
| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Threads - 0of 0 votes
AnswersDifference between threads and process.
- JSDUDE June 25, 2014 in United States for LSB
When would you use one vs the other
Where on the stack are values stored for their local variables?
If there are two threads each with two local variables, where will these variables be stored| Report Duplicate | Flag | PURGE
Expedia SDE-2 Threads - 2of 2 votes
AnswersHow would you maintain concurrency on a shared page being edited by multiple users simultaneously.
- chaos April 03, 2014 in United States
What if the page is being shared using a client- server mechanism. Represent the classes and explain the thread safety mechnism to avoid editing conflicts.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Threads - 0of 0 votes
AnswersWrite a multi threaded C code with one thread printing all even numbers and the other all odd numbers. The output should always be in sequence
- gjp February 24, 2014 in United States
ie. 0,1,2,3,4....etc| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer Intern C Threads - 0of 0 votes
AnswersWrite multi threaded code in C so that one thread prints all even numbers and other all odd numbers with the output always in sequence ie. 0,1,2,3...etc
- gjp February 12, 2014 in United States for Driver Development| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer Intern Threads - 0of 0 votes
AnswersDesign database locks to allow r/w concurrency and data consistency.
- lianshiwu January 08, 2014 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Threads - 2of 2 votes
AnswerThreads synchronization methods, how do they use CPU time slice and compare their efficiency?
- lianshiwu January 08, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Threads - 0of 2 votes
AnswersDesign a Logging mechanism. Should be thread safe.
- R@M3$H.N January 07, 2014 in India
Initially i came up with Command Pattern, and write into a File. Was asked how i will synchronize multiple threads writing into Same File?
Later he gave hint about Aspect-oriented Programming(AOP). And also he gave a hint of Not always writing into the File, can also be a Mail,etc..| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Data Structures Problem Solving System Design Threads Unix