Cadence Design Systems
100+ Vibhor Steel Tubes Interview Questions and Answers
Q1. Find All Pairs with Given Sum
Given an integer array arr
and an integer Sum
, count and return the total number of pairs in the array whose elements add up to the given Sum
.
Input:
The first line contains two sp...read more
Count and return the total number of pairs in the array whose elements add up to a given sum.
Use a hashmap to store the frequency of each element in the array.
Iterate through the array and for each element, check if (Sum - current element) exists in the hashmap.
Increment the count of pairs if the complement exists in the hashmap.
Q2. Longest Common Prime Subsequence Problem Statement
Imagine Ninja is tackling a puzzle during his long summer vacation. He has two arrays of integers, each with lengths 'N' and 'M'. Ninja's task is to determine ...read more
Find the length of the longest subsequence common to two arrays consisting only of prime numbers.
Iterate through both arrays to find prime numbers
Use dynamic programming to find the longest common subsequence
Consider edge cases like empty arrays or no common prime numbers
Q3. Minimum Number of Jumps Problem
Given an array ARR
of N
integers, determine the minimum number of jumps required to reach the last index of the array (i.e., N - 1
). From any index i
, you can jump to an index i ...read more
The problem involves finding the minimum number of jumps required to reach the last index of an array, where each element indicates the maximum distance that can be jumped from that position.
Use a greedy approach to keep track of the farthest reachable index and the current end of the jump.
Iterate through the array, updating the farthest reachable index and incrementing the jump count when necessary.
Return the jump count as the minimum number of jumps needed to reach the last...read more
Q4. Validate Partial Binary Search Tree (BST) Problem Statement
You are provided with a binary tree containing 'N' nodes. Your task is to determine if this tree is a Partial Binary Search Tree (BST). Return true if...read more
Validate if a binary tree is a Partial Binary Search Tree (BST) by checking if each node's left subtree contains nodes with data less than or equal to the node's data, and each node's right subtree contains nodes with data greater than or equal to the node's data.
Check if each node's left subtree follows BST property (data <= node's data) and right subtree follows BST property (data >= node's data)
Recursively check if both left and right subtrees are partial BSTs
Handle cases ...read more
Q5. Maximum Sum Problem Statement
You are given an array ARR
of N integers. Your task is to perform operations on this array until it becomes empty, and maximize the sum of selected elements. In each operation, sel...read more
Given an array, select elements to maximize sum by removing adjacent elements. Return the maximum sum.
Iterate through the array and keep track of the frequency of each element.
Select the element with the highest frequency first, then remove adjacent elements.
Repeat the process until the array becomes empty and calculate the sum of selected elements.
Q6. Check If Preorder Traversal Is Valid
Determine whether a given array ARR
of positive integers is a valid Preorder Traversal of a Binary Search Tree (BST).
A binary search tree (BST) is a tree structure where ea...read more
Check if a given array of positive integers is a valid Preorder Traversal of a Binary Search Tree (BST).
Create a stack to keep track of nodes.
Iterate through the array and compare each element with the top of the stack.
If the current element is less than the top of the stack, push it onto the stack.
If the current element is greater than the top of the stack, pop elements from the stack until a greater element is found or the stack is empty.
The last popped element becomes the ...read more
Q7. Count Palindromic Substrings Problem Statement
Given a string STR
, determine the total number of palindromic substrings within STR
.
Input:
The first line contains an integer 't' representing the number of test ...read more
Count the total number of palindromic substrings in a given string.
Iterate through each character in the string and expand around it to find palindromic substrings.
Use dynamic programming to store previously calculated palindromic substrings.
Consider both odd and even length palindromes while counting.
Example: For input 'abbc', palindromic substrings are ['a', 'b', 'b', 'c', 'bb']. Total count is 5.
Q8. Next Greater Element Problem Statement
You are given an array arr
of length N
. For each element in the array, find the next greater element (NGE) that appears to the right. If there is no such greater element, ...read more
The task is to find the next greater element for each element in an array to its right, if no greater element exists, return -1.
Use a stack to keep track of elements for which the next greater element is not found yet.
Iterate through the array from right to left and pop elements from the stack until a greater element is found.
Store the next greater element for each element in a separate array.
If the stack is empty after iterating through the array, it means there is no greate...read more
Q9. Counting Sort Problem Statement
Ninja is learning about sorting algorithms, specifically those that do not rely on comparisons. Can you help Ninja implement the counting sort algorithm?
Example:
Input:
ARR = {-...read more
Implement counting sort algorithm to sort an array of integers without comparisons.
Count the frequency of each element in the input array.
Create a prefix sum array to determine the position of each element in the sorted array.
Iterate through the input array and place each element in its correct position based on the prefix sum array.
Time complexity of counting sort is O(n+k), where n is the number of elements and k is the range of input values.
Q10. Two Teams (Check Whether Graph is Bipartite or Not)
Determine if a given undirected graph can be divided into exactly two disjoint cliques. Print 1 if possible, otherwise print 0.
Input:
The first line contains...read more
Check if a given undirected graph can be divided into exactly two disjoint cliques.
Create an adjacency list to represent the graph
Use BFS or DFS to check if the graph is bipartite
If the graph is bipartite, it can be divided into two disjoint cliques
Q11. Top View of a Binary Tree
You are given a binary tree. Your task is to print the Top View of the Binary Tree, displaying the nodes from left to right order.
Input:
The first line contains an integer 't' represe...read more
The task is to print the Top View of a Binary Tree from left to right order.
Use a map to store the horizontal distance of each node from the root.
Perform a level order traversal of the tree and keep track of the horizontal distance of each node.
Print the nodes in the map in ascending order of their horizontal distance.
Handle the case where multiple nodes have the same horizontal distance by printing the one that appears first in level order traversal.
Q12. There are fifteen horses and a racing track that can run five horses at a time. You have to figure out the top 3 horses out of those and you don't have any timer machine to measure. How will you find the top 3...
read moreDivide the horses into groups of 5 and race them. Take the top 2 from each race and race them again. Finally, race the top 2 horses to determine the top 3.
Divide the horses into 3 groups of 5 and race them.
Take the top 2 horses from each race and race them again.
Finally, race the top 2 horses to determine the top 3.
Q13. K - Sum Path In A Binary Tree
Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in each p...read more
Find all paths in a binary tree where the sum of node values equals a given value 'K'.
Traverse the binary tree using DFS and keep track of the current path and its sum.
At each node, check if the current sum equals 'K' and add the path to the result.
Continue traversal to the left and right child nodes recursively.
Return the list of paths that sum up to 'K'.
Q14. Longest Increasing Subsequence Problem Statement
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more
Find the length of the longest strictly increasing subsequence in an array of integers.
Use dynamic programming to solve this problem efficiently.
Initialize an array to store the length of the longest increasing subsequence ending at each index.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum value in the array as the result.
Q15. Power Set Generation
Given a sorted array of 'N' integers, your task is to generate the power set for this array. Each subset of this power set should be individually sorted.
A power set of a set 'ARR' is the s...read more
Generate power set of a sorted array of integers with individually sorted subsets.
Use recursion to generate all possible subsets by including or excluding each element in the array.
Sort each subset before adding it to the power set.
Handle base case when all elements have been considered to add the subset to the power set.
Q16. Cycle Detection in a Linked List
Your task is to determine if a given Singly Linked List of integers forms a cycle.
Explanation: A cycle in a linked list occurs when there is a node in the list that connects ba...read more
Detect if a given singly linked list of integers forms a cycle.
Use Floyd's Tortoise and Hare algorithm to detect cycle in linked list
Maintain two pointers, one moving at double the speed of the other
If they meet at some point, there is a cycle in the linked list
Q17. Maximum Length Pair Chain Problem
You are provided with 'N' pairs of integers, where the first number in each pair is less than the second number, i.e., in pair (a, b) -> a < b. A pair chain is defined as a seq...read more
Find the length of the longest pair chain that can be formed using the provided pairs.
Sort the pairs based on the second number in each pair.
Iterate through the sorted pairs and keep track of the maximum chain length.
Update the maximum chain length based on the conditions given in the problem statement.
Q18. Smallest Window Problem Statement
Given two strings, S
and X
, your task is to find the smallest substring in S
that contains all the characters present in X
.
Example:
Input:
S = "abdd"
X = "bd"
Output:
bd
Explan...read more
Find the smallest substring in S that contains all characters in X.
Use a sliding window approach to find the smallest substring in S that contains all characters in X.
Keep track of the characters in X using a hashmap.
Move the window by adjusting the start and end pointers until all characters in X are found.
Return the smallest substring encountered.
Q19. Puzzle: Jumbled N pens and N caps, all caps separated from their pens, all pens have some thickness properties. How would you cap all the pens?
Match the thickness of each pen with its cap and cap them accordingly.
Sort the pens and caps by thickness.
Match the first pen with the first cap, second pen with the second cap and so on.
Cap the pens with their respective caps.
If there are any leftover caps or pens, they do not have a match.
Q20. Puzzle: 100 floor building and 2 eggs given, find the minimum/maximum number of trys required to find the floor where the egg will break. The answer I gave was 19. He asked me to normalize the solution; we then...
read moreFind the minimum/maximum number of tries required to find the floor where the egg will break in a 100 floor building with 2 eggs.
Use binary search approach to minimize the number of tries
Start with dropping the egg from the 14th floor, then 27th, 39th, and so on
If the first egg breaks, use the second egg to find the exact floor by checking each floor one by one
If the first egg doesn't break, move up to the next floor and repeat the process
The maximum number of tries is 14 if ...read more
Diamond Problem is a common issue in multiple inheritance in C++ where a class inherits from two classes that have a common base class.
Diamond Problem occurs when a class inherits from two classes that have a common base class, leading to ambiguity in accessing members.
It can be resolved in C++ using virtual inheritance, where the common base class is inherited virtually to avoid duplicate copies of base class members.
Example: class A is inherited by classes B and C, and then...read more
To search for a node in a linked list, iterate through the list and compare each node's value with the target value.
Start at the head of the linked list
Iterate through each node by following the 'next' pointer
Compare the value of each node with the target value
Return the node if found, otherwise return null
Q23. You are given an array of elements. Some/all of them are duplicates. Find them in 0(n) time and 0(1) space. Property of inputs – Number are in the range of 1..n where n is the limit of the array
Find duplicates in an array of elements in 0(n) time and 0(1) space.
Use the property of inputs to your advantage
Iterate through the array and mark elements as negative
If an element is already negative, it is a duplicate
Return all the negative elements as duplicates
Q24. A point and a rectangle is present with the given coordinates. How will you determine whether the point is inside or outside the rectangle?
To determine if a point is inside or outside a rectangle, we check if the point's coordinates fall within the rectangle's boundaries.
Check if the point's x-coordinate is greater than the left edge of the rectangle
Check if the point's x-coordinate is less than the right edge of the rectangle
Check if the point's y-coordinate is greater than the top edge of the rectangle
Check if the point's y-coordinate is less than the bottom edge of the rectangle
If all four conditions are true...read more
Q25. There is a point inside the rectangle. How will you determine the line that passes through the point and divides the rectangle into 2 equal halves?
To find line that divides rectangle into 2 equal halves through a point inside it.
Find the center of the rectangle
Draw a line from the center to the given point
Extend the line to the opposite side of the rectangle
The extended line will divide the rectangle into 2 equal halves
Q26. There is a scheme which contains 8-bit and 16-bit signed numbers. How many such combinations are possible?
There are multiple combinations of 8-bit and 16-bit signed numbers. How many such combinations are possible?
There are 2^8 (256) possible combinations of 8-bit signed numbers.
There are 2^16 (65,536) possible combinations of 16-bit signed numbers.
To find the total number of combinations, we can add the number of combinations of 8-bit and 16-bit signed numbers.
Therefore, the total number of possible combinations is 256 + 65,536 = 65,792.
Data abstraction is the process of hiding implementation details and showing only the necessary features of an object.
Data abstraction can be achieved through classes and objects in object-oriented programming.
It involves creating a class with private data members and public methods to access and modify those data members.
By using data abstraction, users can interact with objects without needing to know the internal workings of the object.
For example, a car object may have me...read more
Multitasking involves running multiple tasks concurrently, while multithreading allows multiple threads within a single process to run concurrently.
Multitasking allows multiple processes to run concurrently on a single processor, switching between them quickly.
Multithreading allows multiple threads within a single process to run concurrently, sharing resources like memory and CPU time.
Multitasking is at the process level, while multithreading is at the thread level.
Example: A...read more
Q29. What is a static function in a C++ class? Why is it used? How to call a static function of class from any part of the code
Static function in C++ class is used to access class-level data without creating an object.
Static functions can be called using the class name and scope resolution operator (::)
They cannot access non-static data members of the class
They can be used to implement utility functions that do not require access to object-specific data
Static functions are shared among all objects of the class
Q30. Concept of virtual function in C++. How is a vtable maintained? What are its enteries? Example code where virtual function is used
Virtual functions in C++ use vtables to enable dynamic binding. Example code included.
Virtual functions allow polymorphism in C++
Vtables are used to maintain a list of virtual functions
Each class with virtual functions has its own vtable
Vtable entries are function pointers to the virtual functions
Example code: class Shape { virtual void draw() = 0; };
Example code: class Circle : public Shape { void draw() override { ... } };
Q31. What is the difference between C++ and Objective C and where will you use it?
C++ is a general-purpose programming language while Objective C is a superset of C used for iOS and macOS development.
C++ is widely used for developing applications, games, and system software.
Objective C is primarily used for iOS and macOS development.
C++ supports both procedural and object-oriented programming paradigms.
Objective C is an object-oriented language with dynamic runtime features.
C++ has a larger standard library compared to Objective C.
Objective C uses a Smallt...read more
Q32. There is a stack where push and pop operation are happening. At any point of time user will query secondMin(). This API should return second minimum present in the stack
Implement an API to return the second minimum element in a stack.
Create a stack and a variable to store the second minimum element.
Whenever a new element is pushed, compare it with the current second minimum and update if necessary.
Whenever an element is popped, check if it is the current second minimum and update if necessary.
Return the second minimum element when the secondMin() API is called.
DELETE removes specific rows from a table, while TRUNCATE removes all rows and resets auto-increment values.
DELETE is a DML command, while TRUNCATE is a DDL command.
DELETE can be rolled back, while TRUNCATE cannot be rolled back.
DELETE triggers delete triggers, while TRUNCATE does not trigger any triggers.
DELETE is slower as it maintains logs, while TRUNCATE is faster as it does not maintain logs.
Example: DELETE FROM table_name WHERE condition; TRUNCATE table_name;
Q34. Given a dictionary, how can you represent it in memory? What will be the worst case complexity of a search done on the DS designed?
A dictionary can be represented in memory as an array of strings. Worst case complexity of search is O(n).
A dictionary can be represented as an array of strings where each string contains a key-value pair separated by a delimiter.
For example, ['apple: a fruit', 'banana: a fruit', 'carrot: a vegetable']
The worst case complexity of a search in this DS is O(n) as we may need to traverse the entire array to find the desired key-value pair.
Design a system like Pastebin for sharing text snippets
Use a web application framework like Django or Flask for the backend
Store text snippets in a database like MySQL or MongoDB
Generate unique URLs for each snippet to share with others
Implement features like syntax highlighting, expiration time, and password protection
Consider implementing user accounts for managing and organizing snippets
Q36. What is the difference between class container and class composition?
Class container is a class that holds objects of other classes, while class composition is a way to combine multiple classes to create a new class.
Class container holds objects of other classes, acting as a collection or container.
Class composition combines multiple classes to create a new class with its own behavior and attributes.
In class container, the objects are typically stored in a data structure like an array or a list.
In class composition, the classes are combined by...read more
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity, while denormalization is the process of intentionally introducing redundancy to improve performance.
Normalization involves breaking down a table into smaller tables and defining relationships between them to reduce redundancy and dependency.
Denormalization involves combining tables and duplicating data to improve query performance by reducing the number of joins need...read more
Q38. What is a malloc function and where is it used and how is it different from new?
malloc is a function in C that dynamically allocates memory on the heap. It is used to allocate memory for variables or data structures.
malloc is used in C programming language.
It is used to allocate memory on the heap.
malloc is different from 'new' in C++ as it does not call constructors for objects.
Q39. A point and a rectangle are present with the given coordinates. How will you determine whether the point is inside or outside the rectangle?
To determine if a point is inside or outside a rectangle, compare the point's coordinates with the rectangle's boundaries.
Compare the x-coordinate of the point with the x-coordinates of the left and right boundaries of the rectangle.
Compare the y-coordinate of the point with the y-coordinates of the top and bottom boundaries of the rectangle.
If the point's x-coordinate is between the left and right boundaries AND the point's y-coordinate is between the top and bottom boundari...read more
Q40. scenario: 2 blocks 100 um apart. current of 8 mA flows with 10 ohms resistance. What should be the metal width for routing.(Need to show the complete calculation)
To determine the metal width for routing, calculate the resistance and use it to find the required width.
Calculate resistance using R = ρ * (L/A), where ρ is the resistivity of the metal, L is the distance between blocks, and A is the cross-sectional area of the metal.
Use Ohm's Law (V = I * R) to find the voltage drop across the metal.
Finally, use the voltage drop and current to determine the required metal width.
Q41. Explain block functionality of your previous project in detail and how your started your layout till tape out.
Block functionality of previous project involved data processing and storage. Layout started with floorplanning and power grid design.
Implemented data processing block using Verilog HDL
Designed storage block using flip-flops and registers
Started layout with floorplanning to allocate space for different blocks
Designed power grid to ensure proper distribution of power to all blocks
Performed physical design tasks such as placement and routing
Verified functionality through simula...read more
Q42. Different segments of memory. Where all can a variable be allocated?
A variable can be allocated in different segments of memory.
Global memory segment
Stack memory segment
Heap memory segment
Code memory segment
Processes are instances of a program in execution, while threads are lightweight processes within a process.
A process is a program in execution, with its own memory space and resources.
Threads are lightweight processes within a process, sharing the same memory space and resources.
Processes are independent of each other, while threads within the same process can communicate and share data.
Example: A web browser running multiple tabs is a process, and each tab running JavaScrip...read more
TCP/IP is a set of rules governing the exchange of data over the internet.
TCP/IP stands for Transmission Control Protocol/Internet Protocol.
It is a suite of communication protocols used to connect devices on the internet.
TCP ensures that data is delivered reliably and in order, while IP handles the addressing and routing of data packets.
Examples of TCP/IP applications include web browsing (HTTP), email (SMTP), and file transfer (FTP).
To detect a loop in a linked list, we can use Floyd's Cycle Detection Algorithm.
Initialize two pointers, slow and fast, at the head of the linked list.
Move slow pointer by one step and fast pointer by two steps.
If there is a loop, the two pointers will eventually meet.
Alternatively, we can use a hash set to store visited nodes and check for duplicates.
Q46. How will you calculate the width of the tree?
The width of a tree can be calculated by finding the maximum number of nodes at any level.
Traverse the tree level by level using breadth-first search
Keep track of the maximum number of nodes at any level
Return the maximum number of nodes as the width of the tree
Q47. What is the width of a tree? How will you calculate the width of the tree?
The width of a tree is the maximum number of nodes at any level in the tree.
To calculate the width of a tree, we can perform a level order traversal and keep track of the maximum number of nodes at any level.
We can use a queue data structure to perform the level order traversal.
At each level, we count the number of nodes in the queue and update the maximum width if necessary.
Deleting a node from a linked list involves updating pointers to maintain the list's integrity.
Identify the node to be deleted by traversing the list
Update the previous node's next pointer to skip the node to be deleted
Free the memory allocated to the node to be deleted
Different types of semaphores include binary semaphores, counting semaphores, and mutex semaphores.
Binary semaphores: Can only have two states - 0 or 1. Used for mutual exclusion.
Counting semaphores: Can have multiple states. Used for managing resources with limited capacity.
Mutex semaphores: Similar to binary semaphores but with additional features like priority inheritance.
Named semaphores: Can be shared between processes by using a unique name.
Recursive semaphores: Allow a...read more
Q50. What does the term “object oriented programming mean?”
Object oriented programming is a programming paradigm that uses objects to represent and manipulate data.
OOP focuses on creating reusable code through the use of classes and objects
It emphasizes encapsulation, inheritance, and polymorphism
Examples of OOP languages include Java, C++, and Python
Q51. What is the difference between overloading and overriding?
Overloading is having multiple methods with the same name but different parameters. Overriding is having a method in a subclass with the same name and parameters as in the superclass.
Overloading is compile-time polymorphism while overriding is runtime polymorphism.
Overloading is used to provide different ways of calling the same method while overriding is used to provide a specific implementation of a method in a subclass.
Overloading is achieved within the same class while ov...read more
Q52. What is auto, volatile variables? Scopes of variables
Auto and volatile are storage classes in C language. Scopes of variables determine where they can be accessed.
Auto variables are declared within a block and have a local scope.
Volatile variables are used to indicate that the value of the variable may change at any time.
Global variables have a file scope and can be accessed from any function within the file.
Static variables have a local scope but retain their value between function calls.
Extern variables have a global scope an...read more
Q53. Locate the sum of 2 numbers in a linear array (Unsorted and sorted) and their complexities
Locate sum of 2 numbers in a linear array (unsorted and sorted) and their complexities
For unsorted array, use nested loops to compare each element with every other element until the sum is found
For sorted array, use two pointers approach starting from the beginning and end of the array and move them towards each other until the sum is found
Complexity for unsorted array is O(n^2) and for sorted array is O(n)
Q54. Explain matching and it type in detail with example. Why do we do matching.
Matching is the process of comparing two or more items to determine if they are the same or similar.
Matching involves comparing characteristics or features of items to find similarities or differences.
Types of matching include pattern matching, string matching, and image matching.
Matching is used in various fields such as computer science, psychology, and genetics.
Example: Matching fingerprints to identify a suspect in a criminal investigation.
Example: Matching job candidates...read more
Q55. Why do we go for higher metal jump not for lower metal jump for resolving Antenna.
Higher metal jumps are preferred over lower metal jumps for resolving antenna issues due to better signal propagation and reduced interference.
Higher metal jumps provide better signal propagation and reduced interference compared to lower metal jumps.
Higher metal jumps help in achieving better antenna performance and coverage.
Lower metal jumps may result in signal degradation and increased interference.
Higher metal jumps offer improved signal strength and quality for antennas...read more
Q56. Given a number, tell number of bits set in the number in its binary representation. Ex. N = 5, Ans – 2 (101 has 2 1’s in it)
Count the number of set bits in a given number's binary representation.
Convert the number to binary representation
Iterate through each bit and count the number of set bits
Use bitwise AND operator to check if a bit is set or not
Keep incrementing the count for each set bit
Friend functions in C++ are functions that are not members of a class but have access to its private and protected members.
Friend functions are declared inside a class with the keyword 'friend'.
They can access private and protected members of the class they are friends with.
Friend functions are not member functions of the class.
They can be standalone functions or functions of another class.
Example: friend void displayDetails(Student);
Vtable and VPTR are used in C++ for implementing polymorphism through virtual functions.
Vtable (Virtual Table) is a table of function pointers used to implement dynamic dispatch for virtual functions.
VPTR (Virtual Pointer) is a pointer that points to the Vtable of an object.
Vtable is created by the compiler for each class that has virtual functions.
VPTR is added as a hidden member in each object of a class with virtual functions.
Example: class Base { virtual void func() {} };...read more
DHCP Protocol is used to automatically assign IP addresses to devices on a network.
DHCP stands for Dynamic Host Configuration Protocol
It allows devices to obtain IP addresses and other network configuration information dynamically
DHCP servers assign IP addresses to devices for a specific lease period
DHCP uses a client-server model where the client requests an IP address and the server assigns one
DHCP uses UDP port 67 for the server and UDP port 68 for the client
Q60. Why does a program crash? Valgrind issues etc
Programs can crash due to various reasons such as memory errors, bugs, hardware issues, etc.
Memory errors such as accessing uninitialized memory, buffer overflows, etc.
Bugs in the code such as infinite loops, null pointer dereferences, etc.
Hardware issues such as power failures, overheating, etc.
External factors such as network failures, input/output errors, etc.
Tools like Valgrind can help detect memory errors and other issues.
The top view of a binary tree shows the nodes visible from the top when looking down from the root node.
The top view of a binary tree is the set of nodes visible from the top when looking down from the root node.
Nodes at the same horizontal distance from the root are considered at the same level in the top view.
If multiple nodes are at the same horizontal distance, only the topmost node at that level is included in the top view.
The top view can be obtained by performing a lev...read more
Q62. write a command to find the lines containing the word "ERROR" from a log file and copy it to new file.
Command to find lines with 'ERROR' in log file and copy to new file
Use grep command to search for 'ERROR' in log file: grep 'ERROR' logfile.txt
Use redirection to copy the output to a new file: grep 'ERROR' logfile.txt > newfile.txt
Q63. Pointers with increment/decreament, address of and value at operators (++,--,*,&)
Explanation of pointers with increment/decrement, address of and value at operators.
Pointers are variables that store memory addresses.
Increment/decrement operators change the address stored in a pointer.
Address of operator (&) returns the memory address of a variable.
Value at operator (*) returns the value stored at a memory address.
Pointers can be used to manipulate data directly in memory.
Q64. Is a C program faster than a C++ compiled program
It depends on the specific use case and implementation.
C and C++ have different strengths and weaknesses.
C is often used for low-level programming and system-level tasks.
C++ is often used for object-oriented programming and high-level tasks.
The performance difference between C and C++ can be negligible or significant depending on the implementation.
Optimizations and compiler settings can also affect performance.
Benchmarking and profiling can help determine which language is f...read more
Q65. Given an array of numbers (+ve and –ve), tell the subarray with the highest sum
Find subarray with highest sum in an array of numbers.
Use Kadane's algorithm to find maximum subarray sum
Initialize max_so_far and max_ending_here to 0
Iterate through the array and update max_ending_here and max_so_far
Return the subarray with highest sum
Example: [-2, 1, -3, 4, -1, 2, 1, -5, 4] => [4, -1, 2, 1]
Q66. What all type of sorting algorithms do you know?
I know various sorting algorithms including bubble sort, insertion sort, selection sort, merge sort, quick sort, heap sort.
Bubble sort - repeatedly swapping adjacent elements if they are in wrong order
Insertion sort - inserting each element in its proper place in a sorted subarray
Selection sort - selecting the smallest element and swapping it with the first element
Merge sort - dividing the array into two halves, sorting them and then merging them
Quick sort - selecting a pivot...read more
Q67. Pointers with increment/decrement, address of and value at operators (++,–,*,&)
Pointers are used to manipulate memory addresses and values in C++. Increment/decrement, address of and value at operators are commonly used.
Incrementing a pointer moves it to the next memory location of the same data type
Decrementing a pointer moves it to the previous memory location of the same data type
The address of operator (&) returns the memory address of a variable
The value at operator (*) returns the value stored at a memory address
Implement a stack using a singly linked list
Create a Node class with data and next pointer
Create a Stack class with top pointer pointing to the top of the stack
Implement push, pop, and peek operations by manipulating the linked list
Example: Node class - Node { int data; Node next; }
Q69. What is the width of a tree?
The width of a tree refers to the maximum number of nodes at any level in the tree.
The width of a tree can be determined by traversing the tree level by level and counting the maximum number of nodes at any level.
The width of a tree can also be calculated using breadth-first search (BFS) algorithm.
The width of a tree is not related to the height or depth of the tree.
Q70. What is latchup and how it can be resolved
Latchup is a condition in integrated circuits where parasitic thyristors are inadvertently triggered, causing a high current flow.
Latchup can be resolved by adding guard rings around sensitive components to prevent parasitic thyristors from triggering.
Using layout techniques such as spacing sensitive components further apart can also help prevent latchup.
Properly designing the power distribution network and ensuring proper grounding can also mitigate latchup issues.
Q71. What is Antenna effect and how it can be resolved.
Antenna effect is the phenomenon where the gate of a transistor behaves like an antenna, causing unwanted signal interference.
Antenna effect occurs in integrated circuits due to the gate acting as an antenna and picking up external signals.
It can lead to performance degradation and reliability issues in the circuit.
To resolve antenna effect, techniques like adding shielding layers, changing layout design, and using guard rings can be employed.
Simulation tools can also be used...read more
Q72. Explain WPE and how it can be taken care.
WPE stands for Water Pressure Equalization. It is a system used to maintain equal pressure in a water distribution network.
WPE helps prevent water hammer, which can damage pipes and fittings.
It ensures consistent water pressure throughout the network, even when demand fluctuates.
Regular maintenance of valves, pumps, and pressure regulators is essential to ensure the WPE system functions properly.
Q73. Em&IR in detail and how these can be will resolved
Em&IR stands for Emissions and Immunity in the context of design engineering. Resolving these issues involves identifying sources of electromagnetic interference and implementing mitigation techniques.
Em&IR refers to the study of electromagnetic emissions from electronic devices and their susceptibility to external interference.
Common sources of electromagnetic interference include power supplies, motors, and wireless communication devices.
To resolve Em&IR issues, design engi...read more
Q74. 1.What is defect life cycle? 2.difference between smoke and sanity 3.method overloading 4.selenium webdriver
Defect life cycle is the process of identifying, reporting, fixing, retesting, and closing defects in software development.
Defect is identified by testing team
Defect is reported in a defect tracking tool
Development team fixes the defect
Testing team retests the fixed defect
Defect is closed if it passes retesting
Q75. What is the difference between C and C++
C++ is an extension of C with object-oriented programming features.
C++ supports classes and objects while C does not.
C++ has better support for polymorphism and inheritance.
C++ has a larger standard library than C.
C++ allows function overloading while C does not.
C++ supports exception handling while C does not.
Q76. What is the difference between a latch and flip flop
Q77. Difference between static and dynamic bindings
Static binding is resolved at compile-time while dynamic binding is resolved at runtime.
Static binding is also known as early binding while dynamic binding is also known as late binding.
Static binding is faster than dynamic binding as it is resolved at compile-time.
Dynamic binding is more flexible than static binding as it allows for polymorphism.
An example of static binding is method overloading while an example of dynamic binding is method overriding.
Q78. What are blocking and non blocking assignments?
Blocking assignments wait for the assigned value to be calculated before moving on to the next statement, while non-blocking assignments allow multiple assignments to occur simultaneously.
Blocking assignments use the = operator, while non-blocking assignments use the <= operator
Blocking assignments are executed sequentially in the order they appear in the code, while non-blocking assignments are executed concurrently
Blocking assignments are used for combinational logic, while...read more
Q79. Check if rectangles overlap or not and some pointers dicsussion
Check if rectangles overlap by comparing their coordinates
Compare the x and y coordinates of the two rectangles to see if they overlap
If one rectangle is to the left of the other, or above the other, they do not overlap
If the rectangles overlap, the x and y ranges will intersect
Q80. Allocate a 2-D array using C/C++
Allocate a 2-D array using C/C++
Use the 'new' operator to allocate memory for the array
Specify the number of rows and columns in the array
Access elements using array indexing
Q81. Height of a tree, diameter of a tree
The height and diameter of a tree are important measurements for forestry and landscaping purposes.
Height can be measured using a clinometer or by using trigonometry and a measuring tape.
Diameter can be measured at breast height (4.5 feet above ground) using a diameter tape or by measuring circumference and dividing by pi.
These measurements are important for determining the health and growth of a tree, as well as for planning and managing forests and landscapes.
For example, a...read more
Q82. Capacitor and voltage in series and parallel
Capacitors in series add reciprocally, in parallel add directly. Voltage in series is the sum, in parallel is the same.
Capacitors in series: 1/Ctotal = 1/C1 + 1/C2
Capacitors in parallel: Ctotal = C1 + C2
Voltage in series: Vtotal = V1 + V2
Voltage in parallel: Vtotal = V1 = V2
Q83. Which are the EDA tools you know
Some EDA tools include Cadence Virtuoso, Synopsys Design Compiler, and Mentor Graphics ModelSim.
Cadence Virtuoso
Synopsys Design Compiler
Mentor Graphics ModelSim
Q84. Explain the MOSFET operation and Body Bias effect
MOSFET is a type of transistor used in electronic devices. Body Bias effect refers to the change in threshold voltage due to biasing of the body terminal.
MOSFET stands for Metal-Oxide-Semiconductor Field-Effect Transistor.
It has three terminals: Gate, Source, and Drain.
The operation of a MOSFET involves controlling the flow of current between the Source and Drain terminals by applying a voltage to the Gate terminal.
Body Bias effect refers to the change in threshold voltage of...read more
Q85. What is UNION in C?
UNION in C is a data type that allows storing different data types in the same memory location.
UNION is declared using the 'union' keyword.
It can be used to save memory by sharing the same memory location for different data types.
Accessing the members of a union can be done using the dot operator or the arrow operator.
Example: union myUnion { int i; float f; };
Example: myUnion.u.i = 10; myUnion.u.f = 3.14;
Q86. Cell padding concept in struct/class
Cell padding is the space between the content of a cell and its border in a table.
Cell padding can be set using CSS or HTML attributes.
It affects the appearance of the table and can improve readability.
Padding can be set for individual cells or for the entire table.
Example:
Example: td { padding: 10px; }
Q87. Analyse the output of the circuitry
The output of the circuitry needs to be analyzed for functionality and accuracy.
Examine the input and output signals to ensure they are within expected ranges
Check for any noise or interference in the output
Verify that the circuit is functioning as designed based on the specifications
Look for any potential issues or errors in the output
Q88. Write a verilog code for sequence detectro
Verilog code for sequence detector
Use state machines to detect the desired sequence
Define states for each part of the sequence
Use combinational logic to transition between states
Implement the Verilog code using if-else statements and always blocks
Q89. write a c program on fibbonacci series
A C program to generate Fibonacci series
Declare variables to store current and previous Fibonacci numbers
Use a loop to calculate and print Fibonacci numbers
Handle edge cases like 0 and 1 separately
Q90. Difference between regression n retesting
Regression testing is testing the entire application after changes, while retesting is testing specific areas after fixes.
Regression testing is done to ensure that new code changes do not affect existing functionality.
Retesting is done to verify that a specific bug or issue has been fixed.
Regression testing involves running the entire test suite, while retesting focuses on specific test cases.
Example: After fixing a bug in the login functionality, retesting would involve test...read more
Q91. Find repetitive words in string program
Program to find repetitive words in a string
Split the string into words using a delimiter like space
Create a hashmap to store word frequencies
Iterate through the words and update the hashmap
Identify words with frequency greater than 1 as repetitive
Q92. What is EMIR analysis
EMIR analysis is a process used to assess the impact of new regulations on financial institutions.
EMIR stands for European Market Infrastructure Regulation
It involves analyzing the requirements set forth by EMIR and determining how they will affect the operations of financial institutions
This analysis helps organizations ensure compliance with EMIR regulations and make any necessary adjustments to their processes
Q93. Graphs data structure and algorithms?
Graphs are data structures used to represent relationships between nodes. Algorithms like Dijkstra's and BFS are commonly used with graphs.
Graphs are composed of nodes (vertices) and edges that connect them.
Common graph algorithms include Dijkstra's shortest path algorithm and Breadth-First Search (BFS).
Graphs can be directed or undirected, weighted or unweighted.
Examples of graph applications include social networks, routing algorithms, and recommendation systems.
Q94. check substring palindrome or not
Check if a substring in an array of strings is a palindrome or not.
Iterate through each string in the array
For each string, check if any of its substrings are palindromes
Return true if a palindrome substring is found, false otherwise
Q95. Reverse linked list recursively
Reverse a linked list recursively
Create a recursive function to reverse the linked list
Pass the current node and its next node as parameters
Update the next pointer of the current node to point to the previous node
Q96. Array addition of two numbers
Add two numbers represented as arrays
Iterate through the arrays from right to left, adding digits and carrying over if necessary
Handle cases where one array is longer than the other
Return the result as a new array
Q97. Access modifiers in java
Access modifiers in Java control the visibility of classes, methods, and variables.
There are four types of access modifiers in Java: public, protected, default (no modifier), and private.
Public: accessible from any other class.
Protected: accessible within the same package or subclasses.
Default: accessible only within the same package.
Private: accessible only within the same class.
Example: public class MyClass {}
Q98. Complete code of all projects
It is not common practice to provide complete code of all projects in an interview setting.
It is not recommended to share complete code of all projects due to confidentiality and intellectual property concerns.
Instead, focus on discussing the technologies used, challenges faced, and solutions implemented in your projects.
Provide code snippets or high-level overviews of your projects to showcase your skills and experience.
Q99. Explain the working of CMOS inverter
CMOS inverter is a type of logic gate that converts input signals into their complementary outputs.
CMOS inverter consists of a PMOS transistor and an NMOS transistor connected in series.
When input is high, PMOS conducts and NMOS is off, resulting in output low.
When input is low, NMOS conducts and PMOS is off, resulting in output high.
CMOS technology is widely used in digital integrated circuits due to its low power consumption and high noise immunity.
Q100. Low power methods tried in ur work
Implemented clock gating, power gating, and dynamic voltage and frequency scaling techniques to reduce power consumption in digital designs.
Utilized clock gating to disable clocks to unused logic blocks
Implemented power gating to completely shut off power to unused modules
Utilized dynamic voltage and frequency scaling to adjust voltage and frequency based on workload
Optimized power consumption through efficient design and coding practices
Top HR Questions asked in Vibhor Steel Tubes
Interview Process at Vibhor Steel Tubes
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month