Add office photos
Employer?
Claim Account for FREE

Western Digital

3.5
based on 268 Reviews
Filter interviews by

Interview Questions and Answers

Updated 5 Feb 2024

Q1. map vs unordered_map, vector vs list

Ans.

map and unordered_map are associative containers while vector and list are sequence containers.

  • map and unordered_map are used to store key-value pairs while vector and list are used to store sequences of elements.

  • map and unordered_map provide faster search and insertion of elements while vector and list provide faster insertion and deletion of elements.

  • map and unordered_map use red-black trees and hash tables respectively while vector and list use arrays and linked lists resp...read more

Add your answer

Q2. Synchronisation of given thread blocks

Ans.

Synchronizing thread blocks is important for efficient and correct execution of parallel programs.

  • Thread blocks must be synchronized to avoid race conditions and ensure correct program output.

  • Synchronization can be achieved using locks, semaphores, or barriers.

  • Examples of synchronization include ensuring that shared resources are accessed by only one thread at a time, or that threads wait for each other before proceeding.

  • Synchronization can also be used to optimize program pe...read more

Add your answer

Q3. Explain dynamic polymorphism

Ans.

Dynamic polymorphism is the ability of an object to take on multiple forms during runtime.

  • It allows objects of different classes to be treated as if they are of the same class.

  • It is achieved through virtual functions and inheritance.

  • Examples include function overriding and templates in C++.

Add your answer

Q4. Types of casts in C++

Ans.

C++ has four types of casts: static_cast, dynamic_cast, const_cast, and reinterpret_cast.

  • static_cast is used for implicit conversions between related types

  • dynamic_cast is used for runtime type checking and casting of polymorphic types

  • const_cast is used to remove const or volatile qualifiers from a variable

  • reinterpret_cast is used for low-level casting between unrelated types

  • Examples: static_cast(3.14), dynamic_cast(basePtr), const_cast(str), reinterpret_cast(&ptr)

Add your answer
Discover null interview dos and don'ts from real experiences

Q5. Functors in C++, uses

Ans.

Functors are objects that can be treated as functions in C++. They are used for generic programming and can be passed as arguments.

  • Functors are often used in algorithms that require a function object as a parameter.

  • They can be used to implement callbacks and event handlers.

  • Functors can be used to create custom comparators for sorting algorithms.

  • They can also be used to implement function objects for mathematical operations.

  • Examples of functors in C++ include std::function, st...read more

Add your answer

Q6. IPC mechanisms in Linux

Ans.

IPC mechanisms in Linux are used for inter-process communication between processes running on the same system.

  • IPC mechanisms include pipes, message queues, shared memory, and semaphores.

  • Pipes are used for one-way communication between two processes.

  • Message queues allow for asynchronous communication between processes.

  • Shared memory allows multiple processes to access the same memory space.

  • Semaphores are used for synchronization between processes.

  • IPC mechanisms can be accessed ...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter