Practice Questions:

Solutions >>>

IF Statement:

  1. Write a QBasic program to input a number and display “Positive Number” only if the number is positive.
  2. Write a program to input the age of a person and display “Eligible to Vote” if age is 18 or above.
  3. Write a program to input a number and display “Even Number” if the number is divisible by 2.
  4. Write a program to input marks of a student and display “Pass” if marks are 40 or more.
  5. Write a program to input a character and display “Uppercase Letter” if the character is uppercase.

IF_ELSE Statement:

  1. Write a QBasic program to input a number and check whether it is even or odd.
  2. Write a program to input two numbers and display the greater number.
  3. Write a program to input the salary of an employee and check whether the employee is taxable or not (tax if salary > 50,000).
  4. Write a program to input temperature and display “Hot Day” or “Cold Day”.
  5. Write a program to input a number and check whether it is positive or negative.

IF_ELSE_IF Statement:

  1. Write a program to input marks and display division according to the rules: ≥80 Distinction, ≥60 First Division, ≥45 Second Division, ≥32 Third Division, Else Fail
  2. Write a program to input a number and display whether it is positive, negative, or zero.
  3. Write a program to input age and display Child, Teenager, Adult, or Senior Citizen.
  4. Write a program to input a character and check whether it is a vowel, consonant, or invalid input.
  5. Write a program to input units of electricity consumed and calculate bill based on slabs using IF…ELSEIF.

For_Next Statement:

  1. Write a QBasic program to display numbers from 1 to 10 using FOR…NEXT.
  2. Write a program to display the multiplication table of a given number.
  3. Write a program to find the sum of first 100 natural numbers.
  4. Write a program to display all even numbers between 1 and 50.
  5. Write a program to calculate the factorial of a given number.

Do_While Statement:

  1. Write a program to display numbers from 1 to 10 using DO WHILE.
  2. Write a program to display all odd numbers up to 50.
  3. Write a program to calculate the sum of digits of a number using DO WHILE.
  4. Write a program to reverse a given number using DO WHILE.
  5. Write a program to display numbers until the user enters 0.

While_Wend Statement:

  1. Write a program to display numbers from 10 to 1 using WHILE…WEND.
  2. Write a program to find the sum of natural numbers up to N.
  3. Write a program to count how many digits are in a given number.
  4. Write a program to check whether a given number is palindrome.
  5. Write a program to calculate the sum of even numbers between 1 and 100.

Nested For_Next Statement:

  1. Write a program to display the following pattern:
    *
    * *
    * * *
    * * * *
  2. Write a program to display numbers in matrix form:
    1 2 3
    4 5 6
    7 8 9
  3. Write a program to display the multiplication tables from 1 to 2.
  4. Write a program to generate a number pyramid.
  5. Write a program to input marks of 5 students in 3 subjects and display the total marks of each student.