CodeQuotient
Verizon Interview Questions and Answers
Q1. What are the differences between linked lists and arrays based on various criteria?
Linked lists and arrays differ in terms of memory allocation, insertion/deletion efficiency, and random access.
Arrays have contiguous memory allocation, while linked lists have non-contiguous memory allocation.
Arrays have constant time access to elements, while linked lists have linear time access.
Linked lists are more efficient for insertion/deletion operations, as they do not require shifting elements like arrays.
Arrays are better for random access, as elements can be acces...read more
Q2. Evaluate the output of the following: #include int main(){ int a=8; if(a) printf("Hello"); else printf("World"); }
The output will be 'Hello' as the condition 'if(a)' will evaluate to true since 'a' is not equal to 0.
The condition 'if(a)' will evaluate to true if 'a' is not equal to 0.
In this case, 'a' is equal to 8 which is not equal to 0, so 'Hello' will be printed.
Q3. Predict the output of the following: #include int main() { int i; for(i=1;i<=5;printf("%d",i)) { i++; } }
The program will print numbers from 1 to 5 continuously without spaces.
The for loop increments i by 1 each iteration
The printf statement prints the value of i without a newline character
The loop continues until i is greater than 5
Q4. Banker's algorithm
Banker's algorithm is a resource allocation and deadlock avoidance algorithm used in operating systems.
Used to avoid deadlock in a system by ensuring that resources are allocated safely
Consists of multiple algorithms including safety algorithm and resource request algorithm
Requires information about available resources, maximum resources, allocated resources, and need of each process
Example: If a process requests additional resources, the banker's algorithm checks if the syst...read more
Q5. Seggregate odd and even in array
Segregate odd and even numbers in an array
Iterate through the array and move odd numbers to one side and even numbers to the other
Use two pointers, one starting from the beginning and the other from the end
Time complexity: O(n)
Q6. Find middle node of a Linkedlist.
Q7. reverse linked list.
Reverse a linked list by changing the direction of its pointers.
Create a new pointer to keep track of the previous node.
Iterate through the linked list, changing the direction of the pointers.
Return the new head of the reversed linked list.
More about working at CodeQuotient
Interview Process at Verizon
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month