0% found this document useful (0 votes)
5 views7 pages

Final Practical

Uploaded by

Rutvik Bhuva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Final Practical

Uploaded by

Rutvik Bhuva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Real Technical Interview Questions - Continuation

Based on the pattern of your 14 actual interview questions, here are similar specific, practical
questions:

Python/NumPy Specific Implementation Questions


15. What does np.where(arr > 5, arr, 0) do?

Answer: Replaces elements ≤ 5 with 0, keeps elements > 5 unchanged

16. What's the difference between np.array([1,2,3]).reshape(-1,1) and


np.array([1,2,3]).reshape(1,-1) ?

Answer: First creates column vector (3x1), second creates row vector (1x3)

17. What does pd.DataFrame.groupby('column').agg({'col1': 'sum', 'col2': 'mean'}) do?

Answer: Groups by 'column', applies sum to col1 and mean to col2

18. What's the result of "hello".ljust(10, '*') ?

Answer: "hello*****" (left-justified with * padding)

SQL Specific Functions


19. What does COALESCE(NULL, NULL, 'default', 'second') return?

Answer: 'default' (returns first non-NULL value)

20. What's the difference between HAVING COUNT(*) > 5 and WHERE COUNT(*) > 5 ?

Answer: HAVING filters groups after GROUP BY, WHERE filters rows before grouping

21. What does SELECT DISTINCT ON (column1) column1, column2 FROM table ORDER BY
column1, column2 do in PostgreSQL?

Answer: Returns first row for each unique value of column1 based on ORDER BY

22. What's the result of SELECT '2023-01-15'::date + INTERVAL '2 months' in PostgreSQL?

Answer: 2023-03-15 (adds 2 months to the date)

JavaScript Array/Object Methods


23. What does [1,2,3].flatMap(x => [x, x*2]) return?

Answer: [1, 2, 2, 4, 3, 6] (maps then flattens)

24. What's the result of Object.entries({a: 1, b: 2}) ?

Answer: [['a', 1], ['b', 2]] (converts object to key-value pairs array)

25. What does [1,2,3].reduceRight((acc, val) => acc - val, 10) return?

Answer: 4 (10 - 3 - 2 - 1, processes from right to left)

26. What's the difference between Array.from({length: 3}, (_, i) => i) and new
Array(3).fill().map((_, i) => i) ?

Answer: Both create [0, 1, 2], but Array.from is more direct and doesn't create sparse
array

CSS/HTML Specifics
27. What's the difference between display: none and visibility: hidden ?

Answer: display: none removes element from layout, visibility: hidden keeps space but
hides element

28. What does position: sticky do?

Answer: Element is positioned relative until it crosses threshold, then becomes fixed

29. What's the specificity value of #nav ul.menu li a:hover ?

Answer: 0,1,2,2 (1 ID, 2 classes/pseudo-classes, 2 elements)

Git Commands
30. What's the difference between git reset --soft HEAD~1 and git reset --hard HEAD~1 ?

Answer: --soft keeps changes staged, --hard discards all changes

31. What does git cherry-pick <commit-hash> do?

Answer: Applies specific commit from another branch to current branch

32. What's the result of git rebase -i HEAD~3 ?

Answer: Opens interactive rebase for last 3 commits, allowing squash/edit/reorder


Data Structures Implementation Details
33. In a hash table with linear probing, what happens when collision occurs?

Answer: Checks next available slot sequentially until empty slot found

34. What's the difference between collections.deque.appendleft() and list.insert(0, item)


in Python?

Answer: deque.appendleft() is O(1), list.insert(0) is O(n)

35. In a min-heap, if parent is at index i , what are the children indices?

Answer: Left child: 2i + 1, Right child: 2i + 2 (0-based indexing)

Network/HTTP Specifics
36. What's the difference between HTTP/1.1 and HTTP/2 multiplexing?

Answer: HTTP/2 allows multiple requests simultaneously over single connection,


HTTP/1.1 processes sequentially

37. What does the Vary: Accept-Encoding header do?

Answer: Tells caches to serve different versions based on client's Accept-Encoding


header

38. What's the difference between 302 Found and 307 Temporary Redirect ?

Answer: 307 preserves HTTP method, 302 may change POST to GET

Database Indexing
39. What's the difference between clustered and non-clustered index?

Answer: Clustered index physically orders data, non-clustered is separate structure


pointing to data

40. What does EXPLAIN ANALYZE show vs just EXPLAIN ?

Answer: EXPLAIN ANALYZE actually executes query and shows real timing, EXPLAIN
shows estimated plan only

RegEx Patterns
41. What does the regex pattern ^\d{3}-\d{2}-\d{4}$ match?

Answer: Exactly XXX-XX-XXXX format (like SSN: 123-45-6789)

42. What's the difference between .* and .*? in regex?

Answer: .* is greedy (matches as much as possible), .*? is non-greedy (matches as little


as possible)

Memory Management
43. What's the difference between malloc() and calloc() in C?

Answer: malloc allocates uninitialized memory, calloc allocates zero-initialized memory

44. What happens when you delete a pointer in C++ but don't set it to nullptr?

Answer: Creates dangling pointer - pointer still holds address but memory is freed

API Design
45. What's the difference between PUT /users/123 and PATCH /users/123 ?

Answer: PUT replaces entire resource, PATCH updates specific fields only

46. What does Content-Type: multipart/form-data indicate?

Answer: Form data contains files or binary data, each part has its own content type

Algorithm Implementation
47. In quicksort, what's the worst-case scenario for pivot selection?

Answer: Always selecting smallest or largest element as pivot (already sorted array)

48. What's the space complexity of in-place heapsort?

Answer: O(1) - sorts array without additional space

More T-SQL Specific Functions (Following your YEAR pattern)


49. In T-SQL, how would you get the month from a datetime field?

Answer: MONTH(date_column)

50. What does DATEDIFF(day, '2023-01-01', '2023-01-15') return in T-SQL?


Answer: 14 (number of days between dates)

51. What is the T-SQL function to get current date without time?

Answer: CAST(GETDATE() AS DATE) or CONVERT(DATE, GETDATE())

More C++ STL Specifics (Following your vector::reserve pattern)


52. What is the effect of calling std::vector::shrink_to_fit() ?

Answer: Reduces capacity to match size, freeing unused memory

53. What does std::map::emplace() do differently from insert() ?

Answer: Constructs element in-place, avoiding copy/move operations

54. What is the difference between std::vector::at() and operator[] ?

Answer: at() performs bounds checking and throws exception, [] doesn't check
bounds

More Networking Protocol Details (Following your BGP/DNS


pattern)
55. What is the primary purpose of OSPF (Open Shortest Path First) routing protocol?

Answer: To find shortest path within a single autonomous system using link-state
algorithm

56. Which type of DNS record is used to specify mail server for a domain?

Answer: MX (Mail Exchange) record

57. What is the default port for SMTP (Simple Mail Transfer Protocol)?

Answer: Port 25

More Algorithm Implementation Steps (Following your heap sort


pattern)
58. The first step of Quick Sort is to:

Answer: Choose a pivot element from the array

59. In Merge Sort, what happens in the "merge" step?


Answer: Combine two sorted subarrays into one sorted array

60. What is the first operation in building a Binary Search Tree?

Answer: Insert the root node

More Math/Clock/Logic Puzzles (Following your Fibonacci/clock


pattern)
61. What is the next number in sequence: 2, 6, 12, 20, 30, ?

Answer: 42 (differences are 4, 6, 8, 10, 12 - adding consecutive even numbers)

62. A clock shows 6:00. What is the angle between hour and minute hands?

Answer: 180 degrees (straight line)

63. If it takes 5 machines 5 minutes to make 5 widgets, how long does it take 100
machines to make 100 widgets?

Answer: 5 minutes (each machine makes 1 widget in 5 minutes)

OS-Specific Commands (Following your os.listdir pattern)


64. What does the following Linux command do: find . -name "*.py" -type f ?

Answer: Find all Python files (.py) in current directory and subdirectories

65. What is the purpose of chmod +x filename in Linux?

Answer: Add execute permission to the file

66. What does ps aux | grep python do?

Answer: Show all running processes containing "python" in their command

More String/Array Operations (Following your slicing pattern)


67. What is the result of "hello world".split() in Python?

Answer: ['hello', 'world'] (splits on whitespace by default)

68. What does arr[::-1] do in Python?

Answer: Reverses the array/string (step of -1)


69. What is the output of "python"[1:4] in Python?

Answer: "yth" (characters at index 1, 2, 3)

More HTTP/Web Specifics (Following your AJAX/HTTP pattern)


70. What is the primary difference between GET and POST HTTP methods?

Answer: GET sends data in URL parameters, POST sends data in request body

71. What does HTTP status code 404 mean?

Answer: Not Found - requested resource doesn't exist on server

72. What is the purpose of CORS (Cross-Origin Resource Sharing)?

Answer: Allow web pages to make requests to different domains securely

You might also like