profile pic # Quality Assurance @ Google
Upvote 0 Downvote
Understanding User Acceptance Testing (UAT) Quality Assurance @ Google Difficulty Medium

Can you explain what User Acceptance Testing (UAT) is, and describe its purpose and key stages in the software development process?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Conditional Probability Quality Assurance @ Google Difficulty Medium

An IT company has a helpdesk that supports two types of issues: software and hardware. Based on past records, 60% of the issues are software-related, and 40% are hardware-related. The probability that a software issue is resolved within an hour is 70%, and the probability that a hardware issue is resolved within an hour is 50%. If an issue is resolved within an hour, what is the probability that it was a software issue?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Array Operations: Finding Maximum and Minimum Quality Assurance @ Google Difficulty Medium

Given an array of integers, you need to solve two problems:

  1. Find the maximum difference between two elements such that the larger element appears after the smaller element.
  2. Find the minimum number of steps required to sort the array in non-decreasing order where a step is defined as incrementing any element by 1.

Implement these two functionalities in Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Test Strategy Creation for a Web Application Quality Assurance @ Google Difficulty Medium

You are given a new web application for which you need to create a test strategy. The application has the following features:

  • User Authentication (Login/Signup)
  • Dashboard displaying user-specific data
  • CRUD operations on user profiles
  • Real-time notifications
  • RESTful API for mobile clients

Describe your test strategy, detailing the types of tests you would include, tools you would use, and how you would ensure comprehensive test coverage.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding Equilibrium Point in an Array Quality Assurance @ Google Difficulty Medium

Given an array of integers, an equilibrium point is an index such that the sum of elements at lower indices is equal to the sum of elements at higher indices. Write a function in Python to find the first equilibrium point in the array. If no such point exists, return -1.

Example:

Input:

[1, 3, 5, 2, 2]

Output:

2 (since 1 + 3 = 2 + 2)
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Creating Test Cases for a User Login Feature Quality Assurance @ Google Difficulty Medium

Imagine you are tasked with testing a new User Login feature for a web application. Outline the steps you would take to create a comprehensive test plan and design test cases for both positive and negative scenarios. Highlight any tools or frameworks you would use in your process.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Test Cases for Google Search Auto Complete Feature Quality Assurance @ Google Difficulty Medium

Imagine you are tasked with testing the auto-complete functionality of Google Search. Outline the key test cases you would create for this feature, covering both positive and negative scenarios. Highlight any tools or frameworks you would use in your process.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Print Prime Numbers up to a Given Limit Quality Assurance @ Google Difficulty Easy

Write a Python function to print all prime numbers up to a given limit. Explain your approach briefly.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Encode and Decode an Array of Strings Quality Assurance @ Google Difficulty Medium

Given an array of strings, write a function to encode the entire array into a single string, and another function to decode this single string back into the original array of strings.

Requirements:

  • The encoded string should be as compact as possible.
  • Ensure no ambiguity in delimiting the individual strings.

Example:

array = ["apple", "banana", "cherry"]
encoded_str = encode(array)
decoded_array = decode(encoded_str)
assert decoded_array == array
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Generate All Permutations of an Array Quality Assurance @ Google Difficulty Medium

Given an array, write a function to generate all possible permutations of the array elements.

Requirements:

  • The function should return a list of all possible permutations.
  • Each permutation should be in the form of a list.

Example:

array = [1, 2, 3]
permutations = generate_permutations(array)
assert permutations == [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Remove Duplicates from a Sorted Array Quality Assurance @ Google Difficulty Medium

Given a sorted array of integers, write a function to remove any duplicates. Describe your algorithm, provide the code implementation, and list how you would test your program.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Different Types of Testing and Implementation in Real-Time Scenarios Quality Assurance @ Google Difficulty Medium

Describe different types of testing and explain how to implement them in real-time scenarios. Provide examples and tools that can be used.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Pattern Matching in Strings Quality Assurance @ Google Difficulty Medium

You are tasked with writing a function that compares patterns in two strings. Specifically, the function should determine if two strings follow the same pattern of characters and return True or False. Consider the following example:

Pattern: 'abba' 
String1: 'hello world world hello' 
String2: 'hi there there hi'

In this case, your function should return True because both strings follow the pattern 'abba'. Implement this function in Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Count Occurrences of Each Word in a File Quality Assurance @ Google Difficulty Medium

Write a method in Python that reads a text file and returns a dictionary where the keys are words and the values are the count of occurrences of each word in the file.

Requirements:

  • Ignore case (e.g., 'Word' and 'word' should be counted as the same word).
  • Ignore punctuation.
  • Ensure the function handles large files efficiently.

Example:

# Assuming the file 'sample.txt' contains the text: 'Hello world! Hello everyone.'
result = word_count('sample.txt')
assert result == {'hello': 2, 'world': 1, 'everyone': 1}
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find Common and Different Numbers in Two Arrays Quality Assurance @ Google Difficulty Medium

Given two integer arrays, write a function to find the common numbers as well as the different numbers in both arrays. Return two lists: one with the common numbers and one with the different numbers.

Requirements:

  • The common numbers should appear only once in the result, even if they appear multiple times in the input arrays.
  • The different numbers should include all numbers that are present in one array but not the other.

Example:

array1 = [1, 2, 3, 4, 4]
array2 = [3, 4, 5, 6]
common, different = find_common_and_different(array1, array2)
assert common == [3, 4]
assert different == [1, 2, 5, 6]
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Linked Lists and Multi-Dimensional Arrays Quality Assurance @ Google Difficulty Hard

Write a function in Python that performs two tasks:

  1. Given a linked list, convert it into a 2D array where each row contains two consecutive linked list values.
  2. Given a 2D array, convert it back into a linked list where each element points to the next.

Requirements:

  • Assume the linked list has an even number of elements.
  • The 2D array should have a shape [n/2, 2], where n is the length of the linked list.

Example:

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

# Linked list: 1 -> 2 -> 3 -> 4
head = ListNode(1, ListNode(2, ListNode(3, ListNode(4))))

# Task 1
array = linked_list_to_2d_array(head)
assert array == [[1, 2], [3, 4]]

# Task 2
new_head = array_to_linked_list(array)
# Validate new_head to be a linked list: 1 -> 2 -> 3 -> 4
assert new_head.val == 1
assert new_head.next.val == 2
assert new_head.next.next.val == 3
assert new_head.next.next.next.val == 4
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Median from a Large Dataset Quality Assurance @ Google Difficulty Hard

Given millions of rows of numerical data, write a method to efficiently find the median value. The data cannot be loaded into memory all at once due to its size.

Requirements:

  • The method should handle data that does not fit into memory.
  • The solution should be efficient in terms of time and space complexity.

Example:

# Let's assume we have a method `read_streaming_data` that yields data row by row

def find_median_large_dataset(streaming_data):
    # Implementation here...

# Example usage
streaming_data = read_streaming_data('large_dataset.csv')
median = find_median_large_dataset(streaming_data)
print(median)
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Maximum and Second Maximum in an Array Quality Assurance @ Google Difficulty Medium

Given an array of integers, write a function to find the maximum and the second largest maximum values in the array.

Requirements:

  • The function should have a runtime complexity of O(n).
  • Describe how you would test this function.

Example:

array = [3, 2, 1, 5, 4]
max_val, second_max_val = find_max_and_second_max(array)
assert max_val == 5
assert second_max_val == 4
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Counter Examples to the Time Complexity of Binary Search Tree (BST) Quality Assurance @ Google Difficulty Medium

Provide counter examples to the time complexity analysis of a Binary Search Tree (BST).

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Product of All Elements Except for Index Quality Assurance @ Google Difficulty Medium

Given an array of integers, implement a function in Python that returns a new array where each element at index i is the product of all the elements in the original array except the one at i. You are not allowed to use division. Optimize for O(n) time complexity. Provide test cases to validate your solution.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find Non-Duplicate Element in an Array Quality Assurance @ Google Difficulty Medium

Given an array of integers where every element appears twice except for one, write a function to find that single element. Explain the approach and also provide a code solution in Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Compare Elements of Two Unsorted Arrays Quality Assurance @ Google Difficulty Medium

Given two unsorted arrays of integers, write a function to determine if the arrays contain the same elements, regardless of their order. Explain your approach and provide a Python code solution.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Sort Three Numbers Quality Assurance @ Google Difficulty Easy

Write a Python function to sort three numbers. Explain your approach briefly.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Test Cases for Google Search Widgets Quality Assurance @ Google Difficulty Medium

Write test cases for widgets that pop out when you perform a Google Search. For example, the calculator widget when searching 'tan x', or the unit converter widget when searching 'convert 60kgs to pounds'. The test cases should cover general scenarios testing this functionality of invoking widgets via the search toolbar.

Requirements:

  • Each test case should verify that the correct widget is rendered based on the search query.
  • You do not need to go into details of individual widget functionalities, but rather ensure that the correct widget appears.

Example:

Test Case 1:

  • Input: 'tan x'
  • Expected Result: Calculator widget should appear.

Test Case 2:

  • Input: 'convert 60kgs to pounds'
  • Expected Result: Unit converter widget should appear.

Provide a few more example test cases to illustrate the point.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Test Cases for Google Maps Quality Assurance @ Google Difficulty Medium

Write detailed test cases to verify the search functionality on Google Maps.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
2D Array Transformation Quality Assurance @ Google Difficulty Medium

Given a 2D array (matrix) of integers, write a function that applies the following transformation:

Flip the matrix horizontally (i.e., reverse the order of elements in each row).

Implement this transformation in Python and apply it to the given matrix.

Example:

Input:

[
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]

Output:

[
    [3, 2, 1],
    [6, 5, 4],
    [9, 8, 7]
]
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Binary Tree Structure Modification Quality Assurance @ Google Difficulty Hard

Given a binary tree, write a function to invert the binary tree (i.e., swap the left and right children of every node).

Implement this transformation in Python.

Example:

Input:

    4
   / \
  2   7
 / \ / \
1  3 6  9

Output:

    4
   / \
  7   2
 / \ / \
9  6 3  1
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find Kth Element from the End in a Linked List Quality Assurance @ Google Difficulty Medium

Given a linked list and an integer value k, write a function to return the kth element from the end of the linked list.

Requirements:

  • You can assume k is a valid integer that will not exceed the length of the linked list.
  • The function should handle linked lists efficiently.

Example:

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

# Linked list: 1 -> 2 -> 3 -> 4 -> 5
head = ListNode(1, ListNode(2, ListNode(3, ListNode(4, ListNode(5)))))
k = 2
result = find_kth_from_end(head, k)
assert result == 4  # The 2nd element from the end is 4
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Testing the Google Search Bar Quality Assurance @ Google Difficulty Medium

Describe how you would test the functionality of the Google Search Bar. Consider different scenarios and edge cases that need to be verified.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find Depth of Binary Search Tree Without Recursion Quality Assurance @ Google Difficulty Medium

Write a program in Python to find the depth of a binary search tree without using recursion.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Time Complexity of Binary Search Tree (BST) Quality Assurance @ Google Difficulty Easy

Explain the time complexity of operations in a Binary Search Tree (BST). Provide both average-case and worst-case complexities.

Solution:

Please sign-in to view the solution