profile pic Python
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
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
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
Test Data for Finding the Second Smallest Number in a Set Quality Assurance @ Amazon Difficulty medium

Provide test data for a program whose functionality is to find the second smallest number in a set. Include various cases such as typical, edge, and erroneous scenarios to ensure comprehensive testing of the function.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Software Testing and Development: Coding Questions Involving Basic Data Structures Quality Assurance @ Amazon Difficulty medium

Explain and provide examples of software testing and development coding questions that involve basic data structures. Consider questions that cover arrays, linked lists, stacks, and queues. Provide a detailed solution for each example.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Identifying and Resolving Sales Data Anomalies Quality Assurance @ Amazon Difficulty medium

You are analyzing sales data and notice that there are anomalies in the data for several key regions over the past quarter. Specifically, the sales figures for certain products are either too high or too low compared to historical data. Describe a step-by-step approach to identify and address these anomalies using SQL and Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Simple Python Problem on Slicing Quality Assurance @ Amazon Difficulty easy

Write a Python function that takes a string and returns a new string that contains only the characters at even indices. Demonstrate the function with an example.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Automate a Test Using Python Quality Assurance @ Amazon Difficulty medium

Write a function in any programming language you know to automate a test.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Removing Duplicate Characters from a String Quality Assurance @ Amazon Difficulty medium

Given a string, write a function in Python to remove all duplicate characters while preserving the original order of characters.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Traversing an Array from Back to Front and Vice Versa Quality Assurance @ Amazon Difficulty easy

Write a function in Python to traverse an array both from back to front and vice versa. Print the elements in both orders.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Suggestions for Improving Code Efficiency (Big O) Quality Assurance @ Amazon Difficulty medium

As a software engineer, you are tasked with optimizing a given piece of code to improve its efficiency in terms of Big O notation. Describe at least five general strategies you would employ to enhance the code's performance.

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
Test Cases for Addition Function Quality Assurance @ Amazon Difficulty easy

Write test cases for a function which implements the addition of two numbers.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Remove Consecutive Repeated Characters from String Quality Assurance @ Amazon Difficulty medium

Given a string, remove the consecutively repeated characters. For example - aabbbcabcbb to cabc.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Convert String to Run-Length Encoding Quality Assurance @ Amazon Difficulty easy

Write a code to convert a string such as aaabbccdaa to a3b2c2d1a2.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Compress a String Using Run-Length Encoding Quality Assurance @ Amazon Difficulty easy

Compress a string. For example, aaabbbcccccddddd should be converted to a3b3c4d4.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Optimizing Product Recommendation Algorithm Quality Assurance @ Amazon Difficulty medium

Imagine you are a Data Analyst at Amazon working on improving the product recommendation algorithm. You are given a dataset with user_id, product_id, rating, and timestamp. Your task is to identify the top 5 most popular products (most purchased) in the last 30 days. What steps would you take to solve this problem using Python and SQL?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding Occurrence of a Character in a String Quality Assurance @ Amazon Difficulty easy

Given a string and a character, write a function in Python to count the number of times the character occurs in the string.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding the Longest Palindrome in a Sentence Quality Assurance @ Amazon Difficulty hard

Given a sentence, write a function in Python to find the longest palindromic substring within it. A palindrome is a string that reads the same backward as forward.

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
Handling Data Anomalies in Sales Reports Quality Assurance @ Amazon Difficulty medium

You are analyzing sales data and notice that there are anomalies in the data for several key regions over the past quarter. Specifically, the sales figures for certain products are either too high or too low compared to historical data. Describe a step-by-step approach to identify and address these anomalies using SQL and Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Product of the Three Greatest Numbers in an Array Quality Assurance @ Amazon Difficulty medium

Given an array, locate the three greatest numbers and print their product.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Number of Occurrences of Each Character in a String Quality Assurance @ Amazon Difficulty easy

Find the number of occurrences of each character in a given string.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Common Prefix in an Array of Strings Quality Assurance @ Amazon Difficulty medium

Given an array of strings, find the common prefix among them.

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
Swapping Integers in a List Quality Assurance @ Amazon Difficulty medium

Write a program that takes a list of integers and a list of pairs of indices as input. The program should swap the elements at the given indices for each pair. Provide an example to illustrate the functionality.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Listing a Matrix in Spiral Order Quality Assurance @ Amazon Difficulty medium

Write a program that takes a 2D matrix as input and outputs the elements in spiral order. Provide an example to illustrate the functionality.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Parsing a Log File Quality Assurance @ Amazon Difficulty medium

Write a routine in Python to parse a log file. The routine should extract and display all log entries that match a specific log level (e.g., ERROR, WARNING, INFO). Provide an example of how the routine processes a sample log file and filters entries based on a given log level.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Extracting and Saving Telephone Numbers and Email Addresses Quality Assurance @ Amazon Difficulty medium

Write a Python program to read through a text file, extract telephone numbers and email addresses, and save them into another file. Provide an example of how the program works, including sample input and the expected output.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Functions in Popular Machine Learning Libraries Quality Assurance @ Amazon Difficulty medium

State and explain some key functions of popular machine learning libraries such as Scikit-Learn, TensorFlow, and PyTorch. Provide examples of how these functions are used.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Group Anagrams - LeetCode Problem Quality Assurance @ Amazon Difficulty medium

Write a program to group anagrams from a given list of strings. This is a common problem on LeetCode.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding the Sum of Digits in a Number Quality Assurance @ Amazon Difficulty easy

Write a function in Python to find the sum of all digits in a given number.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Coding Interview - Nearest Palindrome and Last Two Digits of Product Quality Assurance @ Amazon Difficulty hard
  1. Given a number, find the nearest palindrome.
  2. Given an array of length n containing numbers between 1 to 99, print the last two digits of the result after multiplying all n numbers in the array.
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Checking if a Binary Representation of a Number is a Palindrome Quality Assurance @ Amazon Difficulty medium

Write a function in Python to check if the binary representation of a given number is a palindrome. A palindrome is a sequence that reads the same backward as forward.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Automating an API to Retrieve Bank and Card Holder Information Based on Credit Card Number Quality Assurance @ Amazon Difficulty medium

How would you automate an API that retrieves bank and card holder information when given a credit card number as input?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Test Case Enumeration, Removing Consecutive Duplicates, and Finding Sum Series Quality Assurance @ Amazon Difficulty medium
  1. Write test cases for a video calling app on a mobile device.
  2. Write a program to find consecutive duplicate letters in each word of the sentence and print the sentence without duplicate letters.
  3. Find a series of numbers in an array which gives the sum value as 3.
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Find the Union of Two Strings Quality Assurance @ Amazon Difficulty easy

Write a function in Python and Java to find the union of two strings. The union of two strings includes all unique characters present in either of the strings.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Grouping Positive, Zero, and Negative Numbers Quality Assurance @ Amazon Difficulty medium

Given a list of integers, write a function to group all positive numbers, zeros, and negative numbers together without using any additional data structures like sets or collections. Maintain the original relative order of elements within the same group. For example, if the input list is [4, -1, 0, 3, -2, 0, 1], the output should be [4, 3, 1, 0, 0, -1, -2].

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding the Second Largest Value in an Unsorted List Quality Assurance @ Amazon Difficulty medium

Given an unsorted list of integers, write a function to find the second largest value in the list. You are not allowed to sort the list or use any built-in functions that directly identify the largest or second largest values. For example, if the input list is [3, 1, 4, 1, 5, 9, 2, 6], the output should be 6.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Checking for Duplicates in a List with HashSet Quality Assurance @ IBM Difficulty medium

You are given a list of customer IDs in a Python list, which might contain duplicates. Write a Python function that uses a HashSet to determine if there are any duplicates in the list.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Write a Code to Print All Links from a Web Page Quality Assurance @ IBM Difficulty easy

Write a Python script using Selenium WebDriver to print all the links (<a> tags) from a web page. The script should open the specified web page, find all the links, and then print out the text and the URL for each link.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding a Pair in an Array with the Maximum Product Quality Assurance @ Amazon Difficulty medium

Write a function in Python to find a pair of numbers in an array such that their product is the maximum possible.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Check if One String is an Anagram of Another Quality Assurance @ Amazon Difficulty easy

Write a function in Python to check if the first string is an anagram of the second string. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Function to Print Based on Divisibility Quality Assurance @ Amazon Difficulty easy

Write a function in any language that will print "AN" if a number is divisible by 8, "ANIM" if divisible by 16, and "ANIMAL" if divisible by 32.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Class Representation of a Deck of Cards with Shuffle and Deal Methods Quality Assurance @ Amazon Difficulty medium

Write a class representation of a deck of cards (52 cards) in Python and Java that includes shuffle and deal methods.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Reverse a Linked List in Groups of K Quality Assurance @ Amazon Difficulty medium

Write a function to reverse a linked list in groups of K (any number) in Python and Java.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Reversing Words in a Sentence Quality Assurance @ Amazon Difficulty medium

Given a string sentence, write a function to reverse the order of words without using any library functions for reversing strings or splitting words. For example, if the input string is 'The quick brown fox', the output should be 'fox brown quick The'.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Understanding JSONPath Quality Assurance @ Oracle Difficulty medium

As a software engineer at Oracle, explain the concept of JSONPath and its usage. Provide an example demonstrating how to query JSON data using JSONPath expressions in Python. Include examples that show how to select specific elements, access array elements, and filter nodes.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Reversing a Linked List Quality Assurance @ IBM Difficulty medium

You are given a singly linked list and you need to write a function in Python to reverse the linked list. Assume the linked list node is defined as follows:

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

Write a function reverse_linked_list that takes the head of the linked list as an argument and returns the new head of the reversed list.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Replacement of String using Regex in Python Quality Assurance @ IBM Difficulty medium

Explain how to replace parts of a string using regular expressions (regex) in Python. Provide example code demonstrating the use of the re.sub function for this purpose.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding the Shortest Path Between Two Points on a 2D Matrix Quality Assurance @ Amazon Difficulty hard

Write a function to find the shortest path between two points on a 2D matrix. The matrix contains cells that can either be empty (0) or blocked (1). You can move up, down, left, or right but cannot move through blocked cells.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
What is Binary Search? Quality Assurance @ Amazon Difficulty easy

What is binary search?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
What is Binary Search Tree? What is Doubly Circular Linked List? Quality Assurance @ Amazon Difficulty medium

What is a Binary Search Tree? What is a Doubly Circular Linked List?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Check if Parentheses are Closed in a String Quality Assurance @ Amazon Difficulty medium

Write a function in Python and Java to check if parentheses are closed correctly in a given string. The function should support different types of parentheses: (), {}, and [].

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Finding Prime Numbers in a List Quality Assurance @ Amazon Difficulty medium

Given a list of integers ranging from 1 to 100, write a function to identify and return the prime numbers from the list. For example, if the input list is [10, 15, 23, 50, 7], the output should be [23, 7].

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Reverse Alphabetical Order of Vowels in a String of Numbers Quality Assurance @ Oracle Difficulty medium

Given a string containing both numbers and letters, write a Python function to extract and return the vowels, sorted in reverse alphabetical order. For example, given the string 'h3ll04a2bci27u8o1e', the expected output is 'uoiea'.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Handling and Analyzing Trace Logs Quality Assurance @ Oracle Difficulty medium

As a Business Analyst at Oracle, you need to analyze a large volume of trace logs to identify and extract error patterns for system diagnostics. Describe the process, tools, and technologies you would utilize. Additionally, provide an example Python script to extract error patterns from a log file.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Understanding Docker Concepts Quality Assurance @ Oracle Difficulty medium

As a software engineer at Oracle, explain the key concepts of Docker and its advantages. Provide a simple example demonstrating how to create a Dockerfile for a Python application, build a Docker image, and run a Docker container. Additionally, explain how to share your Docker image via Docker Hub.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Calling Superclass Methods in Python Quality Assurance @ IBM Difficulty medium

You are developing a class hierarchy in Python for a financial application. You have a superclass called Transaction with a method process(). You have a subclass called InternationalTransaction that extends Transaction. Override the process() method in InternationalTransaction to perform additional processing but ensure that it still calls the process() method from Transaction.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Automating Web Form Submission Using Selenium Quality Assurance @ IBM Difficulty medium

You are required to automate the submission of a web form using Selenium WebDriver in Python. The form has the following fields:

  • Text input field with id="username"
  • Password input field with id="password"
  • Submit button with id="submit"

Write a Python script using Selenium to fill out the form and submit it, handling potential delays in the page load using WebDriverWait.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Handling Pop-ups in Selenium Quality Assurance @ IBM Difficulty medium

Write a code snippet in Python to handle pop-up windows using Selenium WebDriver. The code should demonstrate how to switch to the pop-up, perform an action such as accepting or dismissing it, and then switch back to the main window.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
How Can We Check if There is a Loop in a Linked List? Quality Assurance @ IBM Difficulty medium

Describe the method to check if there is a loop in a linked list. Provide the algorithm and example code in Python.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Various Examples: Closest Palindrome, Array Duplicates, and Rhombus Shape Quality Assurance @ Amazon Difficulty medium
  1. Write a function to find the closest palindrome number to a given number.
  2. Write a function to determine if an array contains duplicate numbers.
  3. Write a function to print numbers in a rhombus shape:
    1
    121
    12321
    121
    1
    
Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Subtracting One Number from Each Index in an Array Quality Assurance @ Amazon Difficulty easy

Given an array with numbers from 1 to 5, write a function in Python to subtract one number from each index.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Application of OOP in Automation Quality Assurance @ Oracle Difficulty medium

As a Quality Assurance Engineer at Oracle, you are tasked with designing a test automation framework using Object-Oriented Programming (OOP) principles. Explain how you would apply OOP concepts such as inheritance, polymorphism, encapsulation, and abstraction in building the framework. Provide a simple example in Python demonstrating these OOP principles in the context of test automation.

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Identifying Unused Python Modules in a Project Quality Assurance @ IBM Difficulty medium

You are working on a Python project with several modules and packages. Over time, some modules may become obsolete and unused. How would you identify all the unused modules in the project?

Solution:

Please sign-in to view the solution

Upvote 0 Downvote
Write a Program to Reverse a String Quality Assurance @ IBM Difficulty easy

Write a program in Python to reverse a given string. The program should take a string as input and return the reversed string as output.

Solution:

Please sign-in to view the solution