1. 1. What is the output of the following code?
```python
def func(x, y=[]):
y.append(x)
return y
print(func(1))
print(func(2))
```
a) [1] [2]
b) [1, 2] [1, 2]
c) [1] [1, 2]
d) [1, 2] [2]
Answer: c) [1] [1, 2]
2. 2. Which data structure does `set()` represent and what is its main property?
a) List; ordered
b) Dictionary; key-value pairs
c) Set; unordered with no duplicates
d) Tuple; immutable
Answer: c) Set; unordered with no duplicates
3. 3. What will `print(3 == 3.0)` output in Python?
a) True
b) False
c) Error
d) None
Answer: a) True
4. What will be the output of the following code?
```cpp
int a = 5;
int b = 10;
cout << a++ + ++b;
Answer: c) 17
5. Which of these is the correct way to define a pointer to an integer in C++?
a) int* p;
b) pointer<int> p;
c) int p*;
d) int pointer p;
Answer: a) int* p;
6. What is the main difference between a compiler and an interpreter?
a) Compiler translates code line-by-line, interpreter does it all at once
b) Interpreter translates code line-by-line, compiler does it all at once
c) Both are the same
d) Compiler is for Python, interpreter is for C++
Answer: b) Interpreter translates code line-by-line, compiler does it all at once
7. Which of the following is a valid identifier in Python?
a) 1value
b) value_1
c) value-1
d) def
Answer: b) value_1
8. What is the purpose of the #include directive in C++?
a) It runs a loop
b) It includes libraries or header files
c) It comments out code
d) It defines a variable
Answer: b) It includes libraries or header files
9. In Python, which data type is immutable?
a) List
b) Dictionary
c) Tuple
d) Set
Answer: c) Tuple
10. Which keyword is used in C++ to create a constant value?
a) const
b) final
c) static
d) immutable
Answer: a) const