A set of written instructions that a computer can follow to perform a specific task.
What is a program?
The default value of an integer array element if not explicitly initialized in Java
What is 0?
Given an unsorted array of integers (nums), find the largest element in the array.
def palindrome(nums):
largest = 0
for n in nums:
if n > largest:
largest = n
return largest
The name of Google’s parent company
What is Alphabet Inc.
Identify the issue in this code: if (x = 10) { System.out.println("x is 10"); }
What is replacing = with == for comparison?
A process where developers review each other’s code before merging it to the main project to catch mistakes and improve quality.
What is a code review?
The time complexity of finding the maximum element in an unsorted array
What is O(n)?
Given an array of integers, this function finds and returns the number that appears exactly twice. If no number appears more than once, the function returns -1. The array is guaranteed to have at most one number that appears twice, and no number will appear more than twice.
def containsDup(nums):
s = set()
for n in nums:
if n in s:
return n
return -1
The famous programmer that created the Linux kernel
Who is Linus Torvalds?
What is wrong with this code:
int[] numbers = new int[5];
System.out.println(numbers[5]);
What is an ArrayIndexOutOfBoundsException because the index is out of range?
Checking code to make sure it works correctly before using it in a real project.
What is testing?
The difference between == and .equals() when comparing objects in Java
What is "==" checks for reference equality, .equals() checks for value equality?
Write a function to check if a string is a palindrome. For example, "Race a car" should return False while "A man a plan a canal Panama" should return True. Ignore capitalization.
def palindrome(s):
left = 0
right = 0
while left < right:
if s[left] != s[right]:
return False
left += 1
right += 1
return True
The famous programming language named after a comedy group
What is Python? (Named after Monty Python)
What is the issue in this code:
int num = "10";
System.out.println(num * 2);
What is a type mismatch error because "10" is a string and cannot be assigned to an int?
A tool that software developers use to track changes in code over time.
What is version control?
The output of the two-pointer technique if used to find a pair that sums to 10 in the sorted array [1, 3, 4, 6, 8, 10]?
What is [4,6]?
This a function that returns true if string s and t are anagrams of each other, meaning they contain the same characters in the same frequency but in any order, or false otherwise.
def validAnagram(s, t):
return sorted(s) == sorted(t)
The university that developed the first general-purpose computer, ENIAC
What is the University of Pennsylvania?
What is the issue with this code?
int result = 10 / 0;
System.out.println(result);
What is dividing by 0 error.
A flexible way of developing software where small updates are made frequently, and feedback is used to improve the product.
What is Agile software development?
The largest absolute value that can be stored in an integer in Java
What is 2,147,483,647?
Write a function that returns the length of the longest substring without repeating characters. The string only contains lowercase letters. Ex 1: "abc" = 1. Ex 2: "aab" = 2.
def longestSubstring(s):
seen = set()
left = max_length = 0
for right in range(len(s)):
while s[right] in seen:
seen.remove(s[left])
left += 1
seen.add(s[right])
max_length = max(max_length, right - left + 1) return max_length
The name of the unsolvable computer science problem that determines whether a program will finish running or loop forever
What is the Halting Problem?
This code will print
System.out.println(5 + 3 + " is the result");
"53 is the result"