What is the Java method used to print text to the console, commonly used in beginner programs?
System.out.println() or System.out.print()
What data type is used to store True or False values in Python
bool or boolean
What HTML tag is used to display the largest heading size?
<h1>
____ works by repeatedly swapping the adjacent elements if they are in the wrong order.
Bubble Sort
x = 5
y = x + 3
x = y - 2
print(x, y)
6 8
In Java, what keyword is used to declare a variable that cannot be changed once it is assigned?
final
What built-in Python function returns the number of items in an iterable, such as a list, tuple, or dictionary?
len()
What attribute in the tag specifies the path to the image file?
src
____ is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half.
Binary Search
[x**2 for x in range(1, 6)]
what does this list comprehension do?
create a list of squares from 1 to 5
Which access modifier in Java restricts access to a member to within the same package only, but is accessible to subclasses?
protected
List 3 examples of mutable data types.
Lists, Dictionaries, Sets, Byte-Arrays, User-defined classes
What is an advantage of using HTML over plain text for creating a webpage?
HTML allows for the structuring and styling of content, enabling text to include headings, links, images, and other multimedia elements, while plain text displays only basic, unformatted text.
___ is a sorting algorithm based on the Divide and Conquer that picks an element as a pivot and partitions the given array around the picked pivot by placing the pivot in its correct position in the sorted array.
Quick Sort
str_x = "Emma is good developer. Emma is a writer. Emmais not part of coding club."
cnt = str_x.count("Emma")
print(cnt)
What is the output?
3
In Java, what is the difference between == and .equals() when comparing two objects?
== checks if two references point to the same object in memory, while .equals() checks if the values of the objects are equal.
e.g.:
String person = "matt";
The reference would be "person", value would be "matt"
Python will not warn on a logic error, but it will warn (and possibly error) on this type of error. (umbrella term)
syntax error
What is an advantage of using HTML over XML for building web pages?
HTML is designed for web content display with built-in tags for structure and style, while XML is for data storage and lacks presentation features.
___ is a sorting algorithm that follows the divide-and-conquer approach. It works by recursively dividing the input array into smaller subarrays and sorting those subarrays then merging them back together to obtain the sorted array.
Merge Sort
for x in range(3):
for y in range(2):
print(x * y, end=" ")
print()
0 0
0 1
0 2
Explain the concept of 'autoboxing' and 'unboxing' in Java, and give an example of each.
Autoboxing refers to the conversion of a primitive value into an object of the corresponding wrapper class is called autoboxing: int to Integer
Unboxing on the other hand refers to converting an object of a wrapper type to its corresponding primitive value: Integer to int
Explain the difference between *args and **kwargs in Python function definitions
*args allows a function to accept any number of positional arguments as a tuple
**kwargs allows a function to accept any number of keyword arguments as a dictionary.
<section>, <article>, and <aside> tags are considered ____ elements. What is their purpose?
semantics elements.
they provide meaning and context to the content they enclose, helping to improve webpage structure and SEO by clearly defining different content areas for search engines and assistive technologies like screen readers
In graph theory, which algorithm is used to find the shortest path from a single source node to all other nodes in a graph with non-negative edge weights?
Dijkstra's Algorithm
for num in range(4):
for i in range(num):
print (num, end=" ")
print("\n")
1
2 2
3 3 3