Tuesday, 24 December 2024

Grade-10 Winter Vacation Homework 2081 Computer

 5 questions in single sentences using QBasic, each incorporating functions for area and subprocedures for volume or perimeter:


  1. Write a program to calculate the area of a rectangle using a function RectangleArea (Area = Length * Breadth) and calculate the perimeter using a subprocedure RectanglePerimeter (Perimeter = 2 * (Length + Breadth)).

  2. Write a program to calculate the area of a circle using a function CircleArea (Area = 3.14 * Radius^2) and calculate the circumference using a subprocedure CircleCircumference (Circumference = 2 * 3.14 * Radius).

  3. Write a program to calculate the surface area of a cube using a function CubeSurfaceArea (Surface Area = 6 * Side^2) and calculate the volume using a subprocedure CubeVolume (Volume = Side^3).

  4. Write a program to calculate the area of a square using a function SquareArea (Area = Side^2) and calculate the perimeter using a subprocedure SquarePerimeter (Perimeter = 4 * Side).

  5. Write a program to calculate the area of a rectangle using a function RectangleArea (Area = Length * Breadth) and calculate the volume of a cuboid using a subprocedure CuboidVolume (Volume = Length * Breadth * Height).


These questions are designed to encourage the use of functions for area calculations and subprocedures for volume or perimeter calculations in QBasic.

QBasic file handling questions related to the file employee.txt:


1. Create a File employee.txt and Write Employee Data

  • Question: Write a QBasic program to create a file employee.txt and write the following employee data (Employee ID, Employee Name, Salary, Designation) to the file. Ensure you use output mode to write the data.
    • Example data:
      • EmpID: 101, EmpName: "John Doe", Salary: 75000, Designation: "Manager"
      • EmpID: 102, EmpName: "Jane Smith", Salary: 50000, Designation: "Assistant"
      • EmpID: 103, EmpName: "Alice Brown", Salary: 60000, Designation: "Clerk"

2. Read Employee Data with Salary Greater Than 60000

  • Question: Write a QBasic program to read the data from employee.txt and display the details of employees whose salary is greater than 60000. Use input mode to read the file and apply a condition to check the salary.

3. Append Content to employee.txt

  • Question: Write a QBasic program to append a new employee's data (EmpID, EmpName, Salary, Designation) to employee.txt. Ensure that the program allows the user to input the new employee details and append them to the file.
    • Example input from the user:
      • EmpID: 104, EmpName: "Charlie Green", Salary: 80000, Designation: "Senior Manager"

These questions focus on file creation, reading with conditions, and appending data to an existing file in QBasic using the OPEN command with various modes (OUTPUT, INPUT, APPEND).


C programming questions focusing on conditional statements and loops. These exercises cover checking conditions like even/odd numbers, positive/negative integers, and eligibility for voting, as well as using loops to print natural numbers and sums:


1. Check Even or Odd

  • Question: Write a C program that takes an integer input from the user and checks if the number is even or odd using an if condition.

2. Check Positive or Negative Integer

  • Question: Write a C program that takes an integer input from the user and checks if the integer is positive or negative using a conditional statement. If the integer is zero, it should print "Zero is neither positive nor negative."

3. Check Voting Eligibility

  • Question: Write a C program that takes the age of a person as input and checks whether the person is eligible to vote. The person is eligible if their age is 18 years or older. Print an appropriate message based on the age input.

4. Print First 10 Natural Numbers and Their Sum

  • Question: Write a C program using a loop that prints the first 10 natural numbers (1 to 10) and calculates and displays their sum.

5. Print First 10 Odd Numbers

  • Question: Write a C program using a loop that prints the first 10 odd numbers starting from 1.

6. Print First 10 Even Numbers

  • Question: Write a C program using a loop that prints the first 10 even numbers starting from 2.


No comments:

Post a Comment

Popular Posts