Posts

Questions collection Q BASIC Program

1)      Wap to check whether a number is armstrong or not. 2)      Wap to display reverse form of a input word. 3)      Wap to check whether a number is palindrome of not. 4)      Wap to print only the vowels for a given word. 5)      Wap to ask 2 numbers and find H.C.F. and L.C.M. of given number. 6)      Wap to check whether the first character of the word is capital, small or numerical. 7)      Wap to ask n numbers and display them in ascending order. 8)      Wap to enter full name and display the initials only. 9)      Wap to convert time in seconds into exact hours, minutes and seconds. 10)  Wap to convert binary into decimal. 11)  Wap to convert decimal no. into binary. 12)  Wap to  find factorial number. 13) ...

Most Probable SLC asked questions

1. Write a program to display all armstrong number from 1 to 2000 using FUNCTION...END FUNCTION. DECLARE FUNCTION display () CLS v = display END FUNCTION display FOR i = 1 TO 2000 N = i S = 0 WHILE N <> 0 R = N MOD 10 S = S + R ^ 3 N = N \ 10 WEND IF S = i THEN PRINT i, END IF NEXT i END FUNCTION 2. Write a program to check given input number is armstrong or not using FUNCTION...END FUNCTION. DECLARE FUNCTION armstrong$ (N) CLS INPUT "Enter a number"; N PRINT armstrong$(N) END FUNCTION armstrong$ (N) O = N WHILE N <> 0 R = N MOD 10 S = S + R ^ 3 N = N \ 10 WEND IF S = O THEN armstrong$ = STR$(O) + " is armstrong number" ELSE armstrong$ = STR$(O) + " is not armstrong number" END IF END FUNCTION

Write output

1.       Write the output of the following program CLS N=115 P=0 WHILE N<>0 R=N MOD 2 S=S+R*10^P P=P+1 N=N\2 WEND PRINT S END a.         CLS N=123 P=0 WHILE N<>0 R=N MOD 8 S=S+R*10^P P=P+1 N=N\8 WEND PRINT S END b.         CLS X=7 FOR  C=1 TO 10 PRINT X; IF X MOD 2=0 THEN X=X/2 ELSE X=3*X+1 END IF NEXT C END c.          d.         CLS N=115 P=0 DO WHILE N<>0 R=N MOD 2 S=S+R*10^P P=P+1 N=N\2 LOOP PRINT S END e.         CLS N=115 P=0 DO UNTIL N=0 R=N MOD 8 S=S+R*10^P P=P+1 N=N\8 LOOP PRINT S END f.    ...

Question collections of SUB Procedure

Image
1.       Write a program to input base and height of the triangle from user. The program should calculate and display the area of the triangle using SUB END SUB statement. 2.       Write a Sub program to print area of cylinder, if radius and height of cylinder are given by the user in main module and pass them as parameter list when Sub program is called. 3.       Write a sub procedure to find the solution of quadratic equation ax 2 +bx+c=0. The program should ask the value a, b and c from user in main module and pass them as parameter list when a Sub Program is called. 4.        Write a Sub Program to display the acceleration of car. The program should ask initial velocity, final velocity and time taken by the car from user in main module and pass them as parameter list when a Sub Program is called. 5.       Write a Sub Program to check whether an ...

Question collections of FUNCTION Procedure

1.       Write a function procedure to print the distance travelled by a car. The program should ask initial velocity, final velocity and time taken by the car and the program should pass them as parameter list when a function procedure is called. 2.       Write a function program to check whether an input number is “positive” or “negative” or zero. The program should ask a number from user in main module and pass it as parameter list when a function program is called. 3.       Write a function program to decide whether an input number is even or odd. The program should ask a number from user in main module and pass it as parameter list. 4.       Write a function procedure to print square of first 10 natural numbers. 5.       Write a function procedure to display the sum of digits in an input number. The program should ask a number from user in main modu...

Solution of FUNCTION Procedure2

1. Using FUNCTION...END FUNCTION , write a program to calculate distance travelled by a body.[Hint: S=ut+1/2at^2] DECLARE FUNCTION distance (u, t, a) CLS INPUT "Enter an initial velocity"; u INPUT "Enter time taken"; t INPUT "Enter acceleration"; a PRINT "The distance travelled is "; distance(u, t, a) END FUNCTION distance (u, t, a) distance = u * t + 1 / 2 * a * t ^ 2 END FUNCTION 2. Write a program using Function module to calculate and print the volume of a box. DECLARE FUNCTION volume (l, b, h) CLS INPUT "Enter length"; l INPUT "Enter breadth"; b INPUT "Enter height"; h PRINT "The volume of box is "; volume(l, b, h) END FUNCTION volume (l, b, h) volume = l * b * h END FUNCTION 3. Write a program using FUNCTION...END FUNCTION to find the average of any two numbers given by the users. DECLARE FUNCTION average (a, b) CLS INPUT "Enter first number"; a INPUT ...

Solution of FUNCTION Procedure1

1. Write a program to declare a user defined function to return sum of any digits of number by using FUNCTION...END FUNCTION. DECLARE FUNCTION sum(N) CLS INPUT "Enter a number";N PRINT "Sum of digits of a number is ";sum(N) END FUNCTION sum(N) WHILE N<>0 R=N MOD 10 S=S+R N=N\10 WEND sum=S END FUNCTION 2. Write a program to count total number of alphabet "A" occurred in a string, where string is passed as a parameter by using FUNCTION...END FUNCTION. DECLARE FUNCTION countA(S$) CLS INPUT "Enter a string";S$ PRINT "Total number of A occurred in a string is ";countA(S$) END FUNCTION countA(S$) FOR I=1 TO LEN(S$) IF UCASE$(MID$(S$,I,1))="A" THEN c=c+1 END IF NEXT I countA=c END FUNCTION 3. Write a program to print Armstrong number between 1 to 2000 by using FUNCTION....END FUNCTION. DECLARE FUNCTION display( ) CLS v=display END FUNCTION display FOR I=1 TO 2000 S=0 N=I WHILE N<...