Skip to content

Commit f57636b

Browse files
authored
Update Exam.md
1 parent 3256fca commit f57636b

File tree

1 file changed

+64
-134
lines changed

1 file changed

+64
-134
lines changed

Exam.md

Lines changed: 64 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,68 @@
11

2-
# Java MCQ Exam System
32

4-
## Instructions:
5-
- Choose the correct answer for each question.
6-
- Each correct answer will give you 1 point.
7-
- There is no negative marking for incorrect answers.
8-
- You must answer all questions.
9-
10-
---
11-
12-
### Question 1:
13-
**Which of the following is a valid declaration of a char?**
14-
15-
- [ ] A. char c1 = 'abc';
16-
- [ ] B. char c1 = '\u1234';
17-
- [ ] C. char c2 = 12.34;
18-
- [ ] D. char c3 = 'a';
19-
20-
---
21-
22-
### Question 2:
23-
**Which of these is not a valid data type in Java?**
24-
25-
- [ ] A. int
26-
- [ ] B. float
27-
- [ ] C. double
28-
- [ ] D. string
29-
30-
---
31-
32-
### Question 3:
33-
**Which method is used to start a thread execution?**
34-
35-
- [ ] A. run()
36-
- [ ] B. start()
37-
- [ ] C. execute()
38-
- [ ] D. call()
39-
40-
---
41-
42-
### Question 4:
43-
**What is the output of the following code?**
44-
45-
```java
46-
public class Test {
47-
public static void main(String[] args) {
48-
int x = 5;
49-
System.out.println(x++);
50-
}
51-
}
3+
# Python Basics Quiz
4+
5+
### 01. What is the correct file extension for Python files?
6+
- [ ] .pyth
7+
- [ ] .pt
8+
- [x] .py
9+
- [ ] .pyt
10+
11+
### 02. How do you insert comments in Python code?
12+
- [ ] //
13+
- [ ] <!-- -->
14+
- [x] #
15+
- [ ] \*
16+
17+
### 03. Which one is NOT a legal variable name?
18+
- [x] 2myvar
19+
- [ ] my_var
20+
- [ ] _myvar
21+
- [ ] myVar
22+
23+
### 04. What is the correct syntax to output "Hello World" in Python?
24+
- [ ] echo("Hello World")
25+
- [ ] p("Hello World")
26+
- [ ] msg("Hello World")
27+
- [x] print("Hello World")
28+
29+
### 05. How do you create a variable with the numeric value 5?
30+
- [x] x = 5
31+
- [ ] x = int(5)
32+
- [ ] x = num(5)
33+
- [ ] x = 5.0
34+
35+
### 06. Which of these collections defines a set?
36+
- [ ] {"name": "John", "age": 36}
37+
- [ ] ["apple", "banana", "cherry"]
38+
- [ ] ("apple", "banana", "cherry")
39+
- [x] {"apple", "banana", "cherry"}
40+
41+
### 07. What is the correct way to create a function in Python?
42+
- [ ] function myFunction():
43+
- [x] def myFunction():
44+
- [ ] create myFunction():
45+
- [ ] define myFunction():
46+
47+
### 08. What is the output of the following code?
48+
```python
49+
x = "Python"
50+
print(len(x))
5251
```
53-
54-
- [ ] A. 5
55-
- [ ] B. 6
56-
- [ ] C. 4
57-
- [ ] D. Compilation Error
58-
59-
---
60-
61-
### Question 5:
62-
**Which of these keywords is used to define a subclass?**
63-
64-
- [ ] A. super
65-
- [ ] B. this
66-
- [ ] C. extends
67-
- [ ] D. implements
68-
69-
---
70-
71-
### Question 6:
72-
**Which of these classes are not a part of Java's collection framework?**
73-
74-
- [ ] A. HashMap
75-
- [ ] B. ArrayList
76-
- [ ] C. LinkedList
77-
- [ ] D. Stack
78-
79-
---
80-
81-
### Question 7:
82-
**Which of the following is a marker interface?**
83-
84-
- [ ] A. Serializable
85-
- [ ] B. Cloneable
86-
- [ ] C. Runnable
87-
- [ ] D. Remote
88-
89-
---
90-
91-
### Question 8:
92-
**Which of these statements is incorrect about packages?**
93-
94-
- [ ] A. Package defines a namespace in which classes are stored.
95-
- [ ] B. A package can contain multiple classes.
96-
- [ ] C. Packages are used to avoid name conflicts.
97-
- [ ] D. A package cannot be imported into another package.
98-
99-
---
100-
101-
### Question 9:
102-
**Which of the following is not a type of constructor?**
103-
104-
- [ ] A. Default constructor
105-
- [ ] B. Copy constructor
106-
- [ ] C. Static constructor
107-
- [ ] D. Parameterized constructor
108-
109-
---
110-
111-
### Question 10:
112-
**Which of these methods is used to find out the current state of a thread?**
113-
114-
- [ ] A. isAlive()
115-
- [ ] B. getState()
116-
- [ ] C. isRunning()
117-
- [ ] D. checkState()
118-
119-
---
120-
121-
## Answer Key:
122-
123-
1. **D.** char c3 = 'a';
124-
2. **D.** string
125-
3. **B.** start()
126-
4. **A.** 5
127-
5. **C.** extends
128-
6. **D.** Stack
129-
7. **A.** Serializable
130-
8. **D.** A package cannot be imported into another package.
131-
9. **C.** Static constructor
132-
10. **B.** getState()
133-
134-
---
135-
136-
**End of Exam**
137-
52+
- [ ] 7
53+
- [ ] 5
54+
- [ ] 4
55+
- [x] 6
56+
57+
### 09. Which keyword is used to create a class in Python?
58+
- [ ] function
59+
- [ ] define
60+
- [ ] method
61+
- [x] class
62+
63+
### 10. What is the correct syntax to import a module in Python?
64+
- [x] import module_name
65+
- [ ] include module_name
66+
- [ ] using module_name
67+
- [ ] require module_name
13868

0 commit comments

Comments
 (0)