Add office photos
Employer?
Claim Account for FREE

Adobe

4.0
based on 1k Reviews
Filter interviews by

300+ Alcon Interview Questions and Answers

Updated 10 Jan 2025
Popular Designations
Q1. Morty and his array

Rick gave Morty an array 'Arr' of length ‘N’ and an integer ‘K’ and asked him to find the minimum possible cost to split the array into non-empty sub-arrays such that the following conditions...read more

View 3 more answers
Q2. Delete middle node

You have been given a singly Linked List of integers. Your task is to delete the middle node of this List.

Note:

1. If there is no middle node in the list to delete, return an empty list (i.e....read more
Ans.

The task is to delete the middle node of a singly linked list of integers.

  • If the linked list is empty or has only one node, there is no middle node to delete.

  • To delete the middle node, we need to find the middle node and update the pointers of the previous and next nodes.

  • To find the middle node in one traversal, we can use two pointers - a slow pointer and a fast pointer.

  • The slow pointer moves one node at a time, while the fast pointer moves two nodes at a time.

  • When the fast ...read more

View 3 more answers
Q3. Sub Sort

You are given an integer array ‘ARR’. You have to find the length of the shortest contiguous subarray such that, if you sort this subarray in ascending order, then the whole array will be sorted in asce...read more

Ans.

The task is to find the length of the shortest contiguous subarray that needs to be sorted in order to sort the entire array.

  • Iterate through the array from left to right and find the first element that is out of order.

  • Iterate through the array from right to left and find the first element that is out of order.

  • Find the minimum and maximum elements within the subarray defined by the above two elements.

  • Expand the subarray to include any additional elements that are out of order ...read more

View 5 more answers
Q4. Sort an array according to count of set bits

You are given an array consisting of N positive integers, and your task is to sort the array in decreasing order of count of set bits in the binary representation of ...read more

View 3 more answers
Discover Alcon interview dos and don'ts from real experiences
Q5. Search In Rotated Sorted Array

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4,...read more

Ans.

This is a problem where a sorted array is rotated and we need to search for given numbers in the array.

  • The array is rotated clockwise by an unknown amount.

  • We need to perform binary search to find the index of the given numbers.

  • If the number is found, return its index. Otherwise, return -1.

  • The time complexity of the solution should be O(logN).

View 3 more answers
Q6. Quick Sort

You are given an array of integers. You need to sort the array in ascending order using quick sort.

Quick sort is a divide and conquer algorithm in which we choose a pivot point and partition the arra...read more

Ans.

The question asks to implement quick sort algorithm to sort an array of integers in ascending order.

  • Quick sort is a divide and conquer algorithm

  • Choose a pivot point and partition the array into two parts

  • Recursively sort the left and right parts of the array

  • Implement the quick sort algorithm to sort the given array

View 4 more answers
Are these interview questions helpful?
Q7. Swap Adjacent Bit Pairs

You are given an integer 'N'. Your task is to find the number formed after swapping each even bit of 'N' in its binary representation with its adjacent bit on the right, assuming that the...read more

Ans.

The task is to swap each even bit of an integer with its adjacent bit on the right in its binary representation.

  • Convert the given integer to its binary representation

  • Iterate through the binary representation and swap each even bit with its adjacent bit on the right

  • Convert the modified binary representation back to an integer

  • Print the resulting integer

View 2 more answers
Q8. Minimum Cost To Make String Valid

Ninja has been given a string ‘STR’ containing either ‘{’ or ‘}’. 'STR’ is called valid if all the brackets are balanced. Formally for each opening bracket, there must be a clos...read more

View 3 more answers
Share interview questions and help millions of jobseekers 🌟
Q9. String Classifier

You have to classify a string as “GOOD”, “BAD” or “MIXED”. A string is composed of lowercase alphabets and ‘?’. A ‘?’ is to be replaced by any of the lowercase alphabets. Now you have to classi...read more

Add your answer
Q10. Reverse Linked List

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
View 6 more answers
Q11. Find power of a number

Write a program to find x to the power n (i.e., x^n). Take x and n from the user. You need to print the answer.

Note: For this question, you can assume that 0 raised to the power of 0 is 1...read more

Add your answer
Q12. LCA In A BST

You are given a binary search tree of integers with N nodes. You are also given references to two nodes P and Q from this BST.

Your task is to find the lowest common ancestor(LCA) of these two given...read more

Ans.

The task is to find the lowest common ancestor (LCA) of two given nodes in a binary search tree (BST).

  • The LCA is the lowest node that has both given nodes as descendants.

  • In a BST, the left subtree of a node contains only nodes with data less than the node's data, and the right subtree contains only nodes with data greater than the node's data.

  • Start from the root node and compare it with the given nodes. If both nodes are smaller than the current node, move to the left subtree...read more

View 4 more answers
Q13. Merge Two Sorted Linked Lists

You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.

Note:

The given linked ...read more
Ans.

The task is to merge two sorted linked lists into a single sorted linked list.

  • Create a new linked list to store the merged list

  • Compare the values of the nodes from both lists and add the smaller value to the new list

  • Move the pointer of the list with the smaller value to the next node

  • Repeat the comparison and addition until one of the lists is empty

  • Add the remaining nodes from the non-empty list to the new list

  • Return the head of the new list

View 3 more answers
Q14. Puzzles

1. There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in following way: In first walk, ...read more

Add your answer
Q15. Spiral Matrix

You are given a N x M matrix of integers, return the spiral path of the matrix

Example Of Spiral Path

Spiral Path

Input Format:
The first line contains an integer 'T' which denotes the number of test cases or...read more
Ans.

The task is to return the spiral path of a given matrix.

  • Iterate through the matrix in a spiral pattern, starting from the outermost layer and moving towards the center.

  • Keep track of the current row, column, and the boundaries of the remaining unvisited matrix.

  • Print the elements in the spiral path as you traverse the matrix.

View 3 more answers
Q16. Design a stack that supports getMin() in O(1) time and O(1) extra space

Implement a SpecialStack Data Structure that supports getMin() in O(1) time and O(1) extra space along with push(), pop(), top(), isEmpty()...read more

View 4 more answers
Q17. Prime with 3 factors

You are given an array ‘ARR’ consisting of ‘N’ positive integers. Your task is to find if the number has exactly 3 factors for each number in the array ‘ARR’.

You have to return an array con...read more

View 3 more answers
Q18. Validate BST

Given a binary tree with N number of nodes, check if that input tree is BST (Binary Search Tree) or not. If yes, return true, return false otherwise.

A binary search tree (BST) is a binary tree data...read more

View 3 more answers
Q19. Maximum sum of non-adjacent elements

You are given an array/list of ‘N’ integers. You are supposed to return the maximum sum of the subsequence with the constraint that no two elements are adjacent in the given ...read more

View 3 more answers
Q20. Colourful Knapsack Problem

You are given 'N' stones labeled from 1 to 'N'. The 'i-th' stone has the weight W[i]. There are 'M' colors labeled by integers from 1 to 'M'. The 'i-th' stone has the color C[i] which ...read more

View 3 more answers
Q21. Longest subset zero sum

Ninja loves playing with numbers. So his friend gives him an array on his birthday. The array consists of positive and negative integers. Now Ninja is interested in finding the length of ...read more

View 2 more answers
Q22. Count distinct substrings

Given a string 'S', you are supposed to return the number of distinct substrings(including empty substring) of the given string. You should implement the program using a trie.

Note :
A ...read more
View 4 more answers
Q23. Palindromic Partitioning

Given a string ‘str’. Find the minimum number of partitions to make in the string such that every partition of the string is a palindrome.

Given a string, make cuts in that string to mak...read more

View 3 more answers
Q24. Maximum Sum Path Of A Binary Tree

You are given a binary tree having 'N' nodes. Each node of the tree has an integer value. Your task is to find the maximum possible sum of a simple path between any two nodes (p...read more

View 2 more answers
Q25. Equilibrium Index

You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.

An index is considered as an equilibrium index if the sum of elements of the array to t...read more

View 3 more answers
Q26. Minimum Fountains

There is a one-dimensional garden of length 'N'. On each of the positions from 0 to 'N', there is a fountain, and this fountain’s water can reach up to a certain range as explained further. In ...read more

View 2 more answers
Q27. Maximum meetings

You are given the schedule of N meetings with their start time Start[i] and end time End[i]. But you have only 1 meeting room. So, you need to tell the meeting numbers you can organize in the gi...read more

Add your answer
Q28. Split Array in ‘K’ consecutive subarrays with a given condition.

You have given an integer array ‘arr’ size ‘N’. You have to split the array into ‘K’ consecutive non-overlapping subarrays of length ‘M’ such that...read more

Add your answer
Q29. Water

You are given an array 'ARR' of positive integers, each of which represents the number of liters of water in that particular bucket, we have to make the liters of water in every bucket equal.

We are allow...read more

Add your answer
Q30. Rat In A Maze

You are given a starting position for a rat which is stuck in a maze at an initial point (0, 0) (the maze can be thought of as a 2-dimensional plane). The maze would be given in the form of a squar...read more

Add your answer
Q31. Minimize Cash Flow

You are given a list of ‘transactions’ between ‘n’ number of friends. who have to give each other money. The list consists of data of receiver, sender, and transaction.

Your task is to minimiz...read more

Add your answer
Q32. Maximum Sum

You are given an array “ARR” of N integers. You are required to perform an operation on the array each time until it becomes empty. The operation is to select an element from the array(let’s say at i...read more

View 4 more answers
Q33. Wildcard Pattern Matching

Given a text and a wildcard pattern of size N and M respectively, implement a wildcard pattern matching algorithm that finds if the wildcard pattern is matched with the text. The matchi...read more

View 4 more answers
Q34. Minimum number of lamps needed to be installed

You are given a string 'S' containing dots(.) and asterisks(*) only, where the dot represents free spaces, and the asterisk denotes lamps. A lamp can lighten up its...read more

Add your answer
Q35. Missing Numbers

You are given an array 'ARR' of distinct positive integers. You need to find all numbers that are in the range of the elements of the array, but not in the array. The missing elements should be p...read more

View 4 more answers
Q36. Intersection Of Two Arrays

You are given two arrays 'A' and 'B' of size 'N' and 'M' respectively. Both these arrays are sorted in non-decreasing order. You have to find the intersection of these two arrays.

Inte...read more

View 3 more answers
Q37. Next Greater Element

You have been given an array/list ‘ARR’ consisting of ‘N’ positive integers. Your task is to return the Next Greater Element(NGE) for every element.

The Next Greater Element for an element ‘...read more

View 3 more answers
Q38. Count Ways To Reach The N-th Stairs

You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are...read more

View 5 more answers
Q39. There are two singly linked lists in a system. By some programming error, the end node of one of the linked list got linked to the second list, forming an inverted Y shaped list. Write a program to get the poin...read more
View 4 more answers
Q40. Search In A Row Wise And Column Wise Sorted Matrix

You are given an N * N matrix of integers where each row and each column is sorted in increasing order. You are given a target integer 'X'. Find the position of...read more

View 3 more answers
Q41. Max Product Subset

You are given an array/list ‘arr’ of size ‘n’. Your task is to find the maximum product possible by taking any subset of the array/list ‘arr’.

Since the product can be large, return it modulo ...read more

View 2 more answers
Q42. Split Array Into Maximum Subarrays

You have given an integer array/list ‘arr’ of size ‘N’. You have to split the array into the maximum number of subarrays such that the first and last occurrence of every distin...read more

View 2 more answers
Q43. Detect and Remove Loop

Given a singly linked list, you have to detect the loop and remove the loop from the linked list, if present. You have to make changes in the given linked list itself and return the update...read more

View 4 more answers

Q44. You have a lot of small integers in an array. You have to multiply all of them. You need not worry about overflow and range, you have enough support for that. What can you do to speed up the multiplication on y...

read more
Ans.

To speed up multiplication of small integers in an array, we can use bitwise operations and parallel processing.

  • Use bitwise operations like shifting and ANDing to perform multiplication faster.

  • Divide the array into smaller chunks and perform multiplication in parallel using multi-threading or SIMD instructions.

  • Use lookup tables for frequently used values to avoid repeated calculations.

  • Use compiler optimizations like loop unrolling and vectorization.

  • Consider using specialized ...read more

Add your answer
Q45. Split Array

You have given an integer array/list ‘arr’ of size ‘N’. You have to split the array into the maximum number of subarrays such that the first and last occurrence of every distinct element lies in a si...read more

Add your answer
Q46. Min jumps

You live in a Ninja town which is in the form of a N * M grid. In this town, people travel from one place to another by jumping over the buildings which are present in each cell of the grid. It is Chri...read more

View 3 more answers
Q47. Stack using Queue

Implement a Stack Data Structure specifically to store integer data using two Queues.

There should be two data members, both being Queues to store the data internally. You may use the inbuilt Q...read more

View 3 more answers
Q48. Kevin And His Cards

Kevin has two packs of cards. The first pack has N cards and the second one has M cards. Every card has an integer written on it. Now, you have to tell two things. First, how many different t...read more

View 2 more answers
Q49. Populating Next Right Pointers in Each Node

You have been given a complete binary tree of ‘N’ nodes. The nodes are numbered 1 to ‘N’.

You need to find the ‘next’ node that is immediately right in the level order...read more

View 3 more answers
Q50. Good Arrays

You are given an array ‘A’ of length ‘N’, you have to choose an element from any index in this array and delete it. After deleting the element you will get a new array of length ‘N’-1. Your task is t...read more

View 3 more answers
Q51. Tiling Problem

You have been given a board where there are '2' rows and 'N' columns. You have an infinite supply of 2x1 tiles, and you can place a tile in the following ways:

1. Horizontally as 1x2 tile 2. Verti...read more
View 3 more answers
Q52. Leaders in an array

Given a sequence of numbers. Find all leaders in sequence. An element is a leader if it is strictly greater than all the elements on its right side.

Note:
1. Rightmost element is always a le...read more
View 2 more answers
Q53. Number In AP

You’re given three integers X, C, and Y, where X denotes the first term of an arithmetic sequence whose common difference is C. Your task is to determine whether Y belongs to this arithmetic sequenc...read more

View 2 more answers
Q54. Rat In a Maze All Paths

You are given a 'N' * 'N' maze with a rat placed at 'MAZE[0][0]'. Find and print all paths that rat can follow to reach its destination i.e. 'MAZE['N' - 1]['N' - 1]'. Rat can move in any ...read more

View 2 more answers
Q55. Find K’th Character of Decrypted String

You have been given an Encrypted String where repetitions of substrings are represented as substring followed by the count of substrings.

Example: String "aabbbcdcdcd" wil...read more
View 2 more answers
Q56. Chocolate Problem

Given an array/list of integer numbers 'CHOCOLATES' of size 'N', where each value of the array/list represents the number of chocolates in the packet. There are ‘M’ number of students and the t...read more

View 2 more answers
Q57. Second largest element in the array

You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

Note:
a) Duplicate elements may be present. b) If no...read more
View 3 more answers
Q58. Cycle in a Linked List

You have given a Singly Linked List of integers, determine if it forms a cycle or not.

A cycle occurs when a node's next points back to a previous node in the list. The linked list is no l...read more

View 3 more answers
Q59. Anagram Pairs

Pre-requisites: Anagrams are defined as words or names that can be formed by rearranging letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "r...read more

View 3 more answers
Q60. Ways to reach nth stair

You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are supposed to...read more

View 4 more answers
Q61. Top view of binary tree

Given a binary tree. Print the Top View of Binary Tree. Print the nodes from left to right order.

Example:
Input: 

Alt text

Output: 2 35 2 10 2 
Input format :
The first line contains an Integer ...read more
View 2 more answers
Q62. Maximum Frequency Number

Ninja is given an array of integers that contain numbers in random order. He needs to write a program to find and return the number which occurs the maximum times in the given input. He ...read more

View 2 more answers
Q63. Predecessor and Successor In BST

You have been given a binary search tree of integers with ‘N’ nodes. You are also given 'KEY' which represents data of a node of this tree. Your task is to find the predecessor a...read more

View 3 more answers
Q64. Digit Count In Range

You are given an integer ‘K’, and two numbers ‘A’ and ‘B’. You need to count the occurrences of the given digit ‘K’, in the range [A, B].

Note:
 You need to count occurrences at every place ...read more
View 3 more answers
Q65. Queue using stack

Implement a queue data structure which follows FIFO(First In First Out) property, using only the instances of the stack data structure.

Note:
1. To implement means you need to complete some pr...read more
View 3 more answers
Q66. Left view of binary tree

Given a binary tree. Print the Left View of the Tree.

Example :
If the input tree is as depicted in the picture: 

alt text

The Left View of the tree will be: 2 35 2 
Input format :
Elements in t...read more
View 2 more answers
Q67. Search In Rotated Sorted Array

You have been given a sorted array/list ARR consisting of ‘N’ elements. You are also given an integer ‘K’.

Now the array is rotated at some pivot point unknown to you. For example,...read more

View 2 more answers
Q68. Unbounded Knapsack

You are given ‘N’ items with certain ‘PROFIT’ and ‘WEIGHT’ and a knapsack with weight capacity ‘W’. You need to fill the knapsack with the items in such a way that you get the maximum profit. ...read more

View 4 more answers

Q69. There are N cities spread in the form of circle. There is road connectivity b/w city 1 and 2, then city 2 and 3 and so on till city n and 1. Each ith city has a petrol pump where you can pick pith petrol and di...

read more
Add your answer
Q70. Zigzag Binary Tree Traversal

Given a binary tree, return the zigzag level order traversal of the nodes' values of the given tree. Zigzag traversal means starting from left to right, then right to left for the ne...read more

View 2 more answers
Q71. Spiral Matrix

You are given a 2-D array 'MATRIX' of dimensions N x M, of integers. You need to return the spiral path of the matrix.

Example Of Spiral Path:

Spiral path of a matrix

Input Format:
The first line contains an integer 'T' ...read more
View 2 more answers
Q72. Level Order traversal of binary tree

You have been given a Binary Tree of integers. You are supposed to return the level order traversal of the given tree.

For example:
For the given binary tree 

Example

The level orde...read more
Add your answer
Q73. Print Binary Tree

Given a binary tree of integers, you need to print the binary tree in a 2-D array of string such that -

1. There should be ‘H’ number of rows in the matrix where ‘H’ is the binary tree’s height...read more

View 3 more answers
Q74. Puzzle

100 prisoners in jail are standing in a queue facing in one direction. Each prisoner is wearing a hat of color either black or red. A prisoner can see hats of all prisoners in front of him in the queue, b...read more

Add your answer
Q75. Puzzle

There are 4 persons (A, B, C and D) who want to cross a bridge in night.

A takes 1 minute to cross the bridge.
B takes 2 minutes to cross the bridge.
C takes 5 minutes to cross the bridge.
D takes 8 minutes t...read more

Add your answer
Q76. Convert a Binary Tree into its Mirror Tree

Given a binary tree, convert this binary tree into its mirror tree.

A binary tree is a tree in which each parent node has at most two children.

Mirror of a Tree: Mirror...read more

View 2 more answers

Q77. Given a program: int i; int main() { int j; int *k = (int *) malloc (sizeof(int)); … } Where are each of these variables stored?

Ans.

i is stored in global data segment, j is stored in stack, k is stored in heap.

  • i is a global variable and is stored in the global data segment

  • j is a local variable and is stored in the stack

  • k is a pointer variable and is stored in the stack, while the memory it points to is allocated on the heap using malloc()

Add your answer
Q78. Mutex Puzzles

She then Asked me Various Mutex related puzzles like “IF you have adobe acrobat and you want to allow only 1 instance of it to run at a time, how will you achieve this wrt to OS involved.”
I answere...read more

Add your answer
Q79. Longest Common Prime Subsequence

Ninja got a very long summer vacation. Being very bored and tired about it, he indulges himself in solving some puzzles.

He encountered a problem in which he was given two arrays...read more

View 2 more answers
Q80. Rearrange the array

You are given an array/list 'NUM' of integers. You are supposed to rearrange the elements of the given 'NUM' so that after rearranging the given array/list there are no two adjacent elements ...read more

Add your answer
Q81. Puzzle

You have two ropes coated in oil to help them burn. Each rope will take exactly 1 hour to burn all the way through. However, the ropes do not burn at constant rates—there are spots where they burn a littl...read more

Add your answer
Q82. Tree Symmetricity

You are given a binary tree, where the data present in each node is an integer. You have to find whether the given tree is symmetric or not.

Symmetric tree is a binary tree, whose mirror image ...read more

Add your answer

Q83. Write a client server simple code. How will you handle multiple requests? Will increasing number of threads solve the problem. What should be the optimal number of threads depending upon your computer architect...

read more
Ans.

Client-server code with optimal thread handling for multiple requests

  • Use a thread pool to handle multiple requests efficiently

  • Optimal number of threads depends on CPU cores and available memory

  • Increasing threads beyond optimal number can lead to resource contention and performance degradation

Add your answer

Q84. Suppose there is an unsorted array. What will be the maximum window size, such that when u sort that window size, the whole array becomes sorted. Eg, 1 2 6 5 4 3 7 . Ans: 4 (6 5 4 3)

Ans.

Find the maximum window size to sort an unsorted array.

  • Identify the longest decreasing subarray from the beginning and longest increasing subarray from the end

  • Find the minimum and maximum element in the identified subarrays

  • Expand the identified subarrays until all elements in the array are covered

  • The length of the expanded subarray is the maximum window size

View 1 answer

Q85. Puzzle : There is a pond in which there is x kg ice on 1st November, it becomes 2x on 2nd November then 4x,8x,16x,32x and so on.Like this whole pond is filled with ice on last day i.e. 30th November. On which d...

read more
Ans.

Puzzle: On which day in November was the pond filled with half the ice?

  • The amount of ice in the pond doubles each day in November

  • The pond is filled with ice on the last day of November

  • To find the day when the pond was half-filled, work backwards from the last day

Add your answer
Q86. OOPS Question

What is Diamond Problem in C++ and how do we fix it?

Ans.

The Diamond Problem is a conflict that occurs when a class inherits from two classes that have a common base class.

  • The Diamond Problem arises in multiple inheritance.

  • It occurs when a class inherits from two classes that have a common base class.

  • This leads to ambiguity in accessing the common base class members.

  • To fix the Diamond Problem, virtual inheritance is used.

  • Virtual inheritance ensures that only one instance of the common base class is inherited.

View 1 answer

Q87. 33) You are given two hour glasses(those glasses are filled with sand). One hour glass gets emptied by 4 minutes another by 7 minutes. Find how will you calculate 9 minutes. Same puzzle was asked to me in GoldM...

read more
Ans.

Using two hour glasses, one emptied in 4 minutes and another in 7 minutes, calculate 9 minutes.

  • Start both hour glasses simultaneously

  • When the 4-minute hour glass is empty, flip it again

  • When the 7-minute hour glass is empty, 4 minutes have passed

  • Flip the 7-minute hour glass again and wait for it to empty

  • When it's empty, 9 minutes have passed

Add your answer
Q88. k-sum path in a binary tree

You are given a binary tree in which each node contains an integer value and a number ‘K’. Your task is to print every path of the binary tree with the sum of nodes in the path as ‘K’...read more

View 2 more answers
Q89. Count Subarrays

You are given an array/list consisting of 0 and 1 only. Your task is to find the sum of the number of subarrays that contains only 1 and the number of subarrays that contains only 0.

An array 'C'...read more

Add your answer
Q90. Puzzle

There are 3 jars, namely, A, B, C. All of them are mislabeled. Following are the labels of each of the jars:

  • A: Candies
  • B: Sweets
  • C: Candies and Sweets (mixed in a random proportion)

You can put your hand in ...read more

Add your answer

Q91. How do you implement naming of threads from the point of view of a multi-threaded OS.Implement rand5 using rand7.Implement functions to render circles and other figures. (This was mainly about my development at...

read more
Ans.

Implementing naming of threads in a multi-threaded OS and implementing rand5 using rand7

  • Use thread ID or thread name to name threads in a multi-threaded OS

  • Implement a function that generates a random number between 1 and 7

  • Use rejection sampling to implement rand5 using rand7

  • Ensure thread names are unique to avoid confusion

  • Test the implementation thoroughly to ensure correctness

Add your answer
Q92. OOPS Question

What are Virtual Destructors in C++?

Ans.

Virtual destructors in C++ are used to ensure that the correct destructor is called when deleting an object through a pointer to its base class.

  • Virtual destructors are declared in the base class and are used when deleting an object through a pointer to the base class.

  • They allow proper destruction of derived class objects.

  • Without virtual destructors, only the base class destructor would be called, leading to memory leaks and undefined behavior.

  • Virtual destructors are necessary...read more

View 1 answer
Q93. System Design Question

There is an online catalog of songs (Like Saavn or Gaana). How you will show favorite songs every day to users. An efficient algorithm required. (K max solution/ Min heap solution)

Add your answer

Q94. Given a set of words one after another, give me a data structure so that you’ll know whether a word has appeared already or not

Ans.

Use a hash table to store the words and check for existence in constant time.

  • Create a hash table with the words as keys and a boolean value as the value.

  • For each new word, check if it exists in the hash table. If it does, it has appeared before. If not, add it to the hash table.

  • Alternatively, use a set data structure to store only the unique words and check for existence in the set.

Add your answer
Q95. Puzzle

You are standing before two doors. One of the path leads to heaven and the other one leads
to hell. There are two guardians, one by each door. You know one of them always tells the truth
and the other alway...read more

Add your answer

Q96. 26) There are m machines. each machine generates coins of 10 g.only one machine is defective which generates coins of 9 g.how to find that defective machine in one weighing only. Now there are two defective mac...

read more
Add your answer

Q97. How much memory is made available to a user program by the kernel, is there any limit to it? What is the range of addresses a user program can have at max, what determines it?What happens if excess memory is al...

read more
Add your answer
Q98. Puzzle

You have a birthday cake and have to cut it into 8 equal pieces by making 3 cuts only. How
do you do it?

Add your answer

Q99. 1>linked list node contain a string field and next.find if by concatenating all string fields the string formed is palindrome or not? 2-> merge to sorted array in which one arra is large enough to accomodate el...

read more
Ans.

The first question is about checking if a string formed by concatenating all string fields in a linked list is a palindrome or not.

  • Traverse the linked list and concatenate all string fields

  • Check if the concatenated string is a palindrome by comparing characters from both ends

  • Consider edge cases like empty linked list or single node with an empty string field

Add your answer
Q100. OS Question

What are the different types of semaphores ?

Ans.

Semaphores are synchronization primitives used in operating systems to control access to shared resources.

  • Binary semaphore: Can take only two values, 0 and 1. Used for mutual exclusion.

  • Counting semaphore: Can take any non-negative integer value. Used for resource allocation.

  • Mutex semaphore: A binary semaphore used for mutual exclusion.

  • Named semaphore: A semaphore that can be accessed by multiple processes.

  • Unnamed semaphore: A semaphore that can only be accessed by threads wit...read more

View 1 answer
1
2
3
4
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Alcon

based on 99 interviews in the last 1 year
Interview experience
4.2
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

3.4
 • 495 Interview Questions
4.0
 • 466 Interview Questions
3.9
 • 253 Interview Questions
4.0
 • 203 Interview Questions
4.1
 • 156 Interview Questions
4.1
 • 132 Interview Questions
View all
Top Adobe Interview Questions And Answers
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