What will be the output of the following Python code? ```python x = [1, 2, 3] y = x y.append(4) print(x) ```
In Python, lists are mutable, and assigning one list to another variable creates a reference. Hence, appending to 'y' also modifies 'x'.
Which sorting algorithm has the worst-case time complexity of O(n^2)?
Sorting algorithms like Bubble Sort and Insertion Sort have a worst-case time complexity of O(n^2).
What does the following Java code print? ```java int x = 5; System.out.println(x++ + ++x); ```
In Java, 'x++' returns the current value (5) before incrementing, while '++x' increments first and then returns the new value (7). The output is 5 + 7 = 12.
What is the purpose of the 'break' statement in a loop?
The 'break' statement is used to exit a loop prematurely when a specific condition is met, regardless of the loop's iteration condition.
What does the following C++ code snippet do? ```cpp #include using namespace std; int main() { int x = 10; int *ptr = &x; cout << *ptr; return 0; } ```
This code declares a pointer 'ptr' pointing to the variable 'x' and dereferences it to print the value of 'x', which is 10.
What will be the result of the following SQL query? ```sql SELECT COUNT(*) FROM employees WHERE salary > 50000; ```
The query counts all rows in the 'employees' table where the 'salary' column is greater than 50,000.