Basic Python, Java, and HTML - Question & Answer Sheet
Python - Basic Practical Questions & Answers
1. Variable
-> Value ko store karne ka naam. Example: x = 10
2. input()
-> User se value lene ke liye. Example: name = input('Enter name: ')
3. Data Types
-> int (10), float (10.5), str ('Ajay'), bool (True/False)
4. if-else Syntax
-> if condition:
statement
else:
statement
5. Loop
-> for i in range(5): OR while i < 5:
6. Reverse String
-> s = 'hello' -> s[::-1]
7. List vs Tuple
-> List: [], changeable | Tuple: (), fixed
8. Function
-> def greet():
print('Hello')
9. range()
-> range(1, 6) -> 1 to 5
10. Comments
-> # This is a comment
Java - Basic Practical Questions & Answers
1. Structure
-> public class MyClass {
public static void main(String[] args) {
// code
}
2. main() Method
-> Starting point of Java program.
3. Declare Variable
-> int age = 20;
4. Scanner Input
-> Scanner sc = new Scanner(System.in); int x = sc.nextInt();
5. if-else vs switch
-> if-else: conditions | switch: multiple cases
6. Loops
-> for, while, do-while loops
7. Function
-> static int add(int a, int b) { return a + b; }
8. String Concatenate
-> String full = 'Ajay' + ' Kumar';
9. Typecasting
-> int x = (int) 10.5;
10. Class/Object
-> Class: blueprint | Object: real instance
HTML - Basic Practical Questions & Answers
1. Full Form
-> HyperText Markup Language
2. Structure
-> <html><head></head><body></body></html>
3. head vs body
-> <head>: meta info | <body>: visible content
4. Headings
-> <h1> to <h6>
5. Paragraph/Break
-> <p>, <br>
6. Insert Image
-> <img src='image.jpg' alt='My Image'>
7. Link
-> <a href='https://google.com'>Google</a>
8. Ordered/Unordered
-> <ol>: numbers | <ul>: bullets
9. Table Tags
-> <table><tr><td></td></tr></table>
10. Form Tags
-> <form><input type='text'><input type='submit'></form>