🔹 Question 1: Greet User Write a function called greet_user that takes a name as input and prints a greeting message like "Hello, Areeff!". 🔹 Question 2: Add Two Numbers Write a function called add_numbers that takes two numbers and returns their ...
🔹 Exercise 1: Working with Lists Write a program that: Creates a list of 5 numbers Adds a new number to the list Removes the second number Prints the list 🔹 Exercise 2: Conditions with Loops Create a list of numbers from 1 to 10. Use a for l...
🔹 Exercise 1: Create a Dictionary Create a dictionary named student with the following key-value pairs: name: "John" age: 20 course: "Computer Science" Then print the dictionary. 🔹 Exercise 2: Access and Update Values Using the student dictio...
Lab Practical 1: Introduction to Java Programming Objective: Write a simple Java program to print "Hello, World!" and compile/run it using the command line.Task: Write a Java program that prints "Hello, World!". Compile and run it using javac and j...
Task 1: Understanding Access Modifiers Create a Java class called AccessDemo With the following: One default access variable One public variable One protected variable One private variable Methods to demonstrate access to each variable (some ac...
Exercise 1: Identifying and Handling Syntax Errors Task: Write a Java program with intentional syntax errors (e.g., missing semicolons, incorrect variable names). Compile the program and observe the compiler errors. Correct the errors and recompil...
Lab Practical 1: Basic Method Creation Objective: Create and call a simple method that prints a message. public class MethodPractice { // Task 1: Create a method called printMessage that prints "I want to draw a circle." // Your code here ...
1D Array Exercises Question 1: Basic Array Operations Create a Java program that: Declares an array of 10 integers Initializes the array with the following values: {12, 5, 23, 8, 17, 9, 31, 4, 11, 19} Prints all elements of the array Calculates a...
Part 1: Sequential Flow (Sequence Logic) Write a Java program that takes two numbers as input and prints their sum, difference, product, and quotient in sequence. Part 2: Conditional Statements (Selection Logic) If-Else Statement: Write a program...
Task 1: Assignment and Arithmetic Operators Exercise 1: Arithmetic Operations Objective: Write and execute a Java program to compute arithmetic expressions. Steps: Create a Java class named ArithmeticOperations. Declare variables a = 10, b = 5. Co...