Interview questions

Team Lead/ Tech Lead interview questions – page 10

3,203 questions. Tap “Show answer” to check yourself.

  1. Program to find width of a binary tree.

  2. Given a single linked list of integers, write a function to find the 2nd largest element from the list in linear time without extra space. Test for all the test cases.

  3. Write a code of Merge sort on Linked list.

  4. Write code for image of binary tree

  5. Write a preorder traversal of a binary search tree w/o recursion / stack / extra memory storage. Hint - you can augment the node data structure. However, you can't add a visited field to the node.

  6. Input is a matrix of size n x m of 0s and 1s.

  7. You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create another array ar_low[] such that ar_low[i] = number of elements lower than or equal to ar[i] in ar[i+1:n-1]. So the output of above should be {0,2,1,2,2,1,0}

  8. How do you rotate a string of length n word by word with constant extra space in linear time (wrt n) ?

  9. Write a function for N-ary tree traversal - min time constraint

  10. Write code to Insert a node into a sorted circular singly linked list such that the list remains sorted.

  11. Given a complete binary tree in which each and every node has a next pointer which is pointing to NULL . Write a function to make the next pointer of each and every node point to next node on the same level

  12. Data structure TO use to design a phonebook. What is time complexity for retrieving, adding etc

  13. Find all the patterns which are present in the character array given. A pattern is a sub-array containing 2 or more chars and is having a frequency of more than one.

  14. Given a string, find out the MINIMUM number of palindromes needed to construct the string. Note that maximum number is length of the string iteself as every string with one character is a palindrome

  15. Find out if 2 given binary trees are identical (data is same in both trees)

  16. Given a binary tree and a node, print all the ancestors of that node.

  17. ,give me programs containing variables and pointer variables?

  18. What is wrong with C code?

  19. Q.8 When a C function call is made, the order in which parameters passed to the function are pushed into the stack is(a) left to right(b) right to left(c) bigger variables are moved first than the smaller variables.(d) smaller variables are move

  20. Which is true? a) sizeof(a)!= sizeof(b); b) sizeof(a)== sizeof(b); c) d)

  21. Difference between :- 1) NULL pointer and NULL macro ?

  22. Write one statement equivalent to the following two statements x = sqr(a); return(x);

  23. What is the difference between following two?

  24. Char a[5][15]; int b[5][15]; address of a 0x1000 and b is 0x2000, find address of a[3][4] and b[3][4]. Assume char is 8 bits and int is 32 bits

  25. How would you return array from a function?

  26. Identify the incorrect expression

  27. Find out what this function does.

  28. What are static functions in C?

  29. A string was given and its hash was computed

  30. What is the difference between typedef and # define? Which is better? Explain #define INT1 int*; typedef int* INT2; INT1 id1, id2; INT2 it1, it2;

Companies that ask Team Lead/ Tech Lead questions