Showing posts with label ICT Classes. Show all posts
Showing posts with label ICT Classes. Show all posts

Saturday, October 16, 2021

GCE(O/L) and (A/L) Past Paper Flowchart questions

GCE(O/L) Past Paper Questions

  1. The given flowchart models the generation of some numbers in a certain range. Write the first three and the last three numbers that it generates.

  2. Write a Pseudo-code that corresponds to the logic indicated by the flowchart.

  3. State how to modify the given flowchart to display the number sequence
    1,4,9,16,25,36,49.


Answer
 i)

First three numbers  1,3,6
Last three numbers 28,36,45

(The variable T gets the values within the repetition are 
1,3,6,10,15,21,28,36,45 
and next number would be 55 but it is greater than 50, 
So  repetition will stop and program will end)


ii)
start
X=1
T=1
//repetition start
repeat
    display T  //output statement
    X=X+1
    T=T+X
until T>50 //repetition end
end



iii) 
 
Change X=X+1 into X=X+2

Note
Convert the above Flowchart or Pseudocode into any programming language and run it for extra knowledge.
  
Pascal program  is given below

program numseries;
var
  X:integer;
  T:integer;
begin
  X:=1;
  T:=1;
  repeat
    writeln(T);
    X:=X+1;
    T:=T+X
  until T>50;
  readln;
end.   


Output of the above Pascal Program

PascalOutputofFlowchartAlgorithm


Question 2

Flow chart pas paper Question G.C.E

a)Write the appropriate Pseudo code for the above flowchart
b) Write Pascal /Python Coding

Answers


 a)
Pseudocode

start
x=1
total=0
while x<=10
 get marks to the variable maths
 x=x+1
 total=total+maths
endwhile
avg=total/(x-1)
if avg>50
 display "Good"
else
 display "Bad"
endif
end


b) 
Python Program for the above Flowchart
x=1
total=0
while x<=2:
 maths=eval(input('Enter Mathematics marks?'));
 x=x+1
 total=total+maths
avg=total/(x-1)
if avg>50:
 print('Good')
else:
 print('Bad')


Pascal Program for the above flowchart
prgram print_average;
var
  x, maths:integer;
  total,avg:real;
begin
  x:=1;
total:=0;
while (x<=10) do
begin
 write('Enter Mathematics Marks?');
 readln(maths);
 x:=x+1;
 total:=total+maths;
end;
avg:=total/(x-1);
if (avg>50) then
 writeln('Good')
else
 writeln('Bad');
        readln;
end. 

Click here to get more Flowchart questions





Friday, December 18, 2020

Pascal Program Exercises with Answers (Binary, Decimal Conversions)

Write a Pascal Program to convert a given Decimal number to equivalent Binary number?

 program DecimalToBinary;

var
  remainder, quotient, num,i:integer;
  binary,addbin:String;

begin
  write('Enter a Decimal Number?');
  read(num);
  addbin:='';
  binary:='';
  while (num >=2)  do
  begin
    remainder:= num mod 2;
    quotient:= num div 2;
    Str(remainder,binary);
    addbin:=addbin+binary;
    num:= quotient ;
  end;
  Str(num,binary);
  addbin:=addbin+binary;
  for i:=length(addbin) downto 1 do
  begin
      write(addbin[i]);
  end;
  readln;
end.  


Write a Pascal Program to convert a given Binary number to equivalent Decimal number?

 program BinarytoDecimal;
uses math,sysutils;

var
   binary:string;
   i,j,num:integer;
   decnum:float;

begin
  decnum:=0;
  write('Enter a Binary number ?');
  read(binary);
  write(chr(13));
  write('Binary number :');
  writeln(binary);
  write(chr(13));
  i:=length(binary);
  j:=0;
  while (i >=1) do
  begin
    num:=StrToInt(binary[i]) ;
    decnum:=decnum+(num * power(2,j));
    i:=i-1;
    j:=j+1;
  end;
  write('Equivalent decimal number is :');
  writeln(decnum:8:0);
  readln;
  readln;
end.
            
Pascal Program to Convert Binary to Decimal


Friday, December 4, 2020

Pascal Questions and Answers

An electricity supply company calculates the customer monthly bill amounts. Draw a Flow chart and a Pascal Program to input the bill amounts of 10 electricity bills and output total amount of all the electricity bills.

Flow chart and Pascal Program to add 10 bill and Print Total
program SumBillAmount;

var
  C,Tot,BillAmt:integer;

begin
  C:=1;
  Tot:=0;
  while (c <=10) do
  begin
    write('Enter a Bill Amount?');
    readln(BillAmt);
    Tot:=Tot+BillAmt;
    C:=C+1;
  end;
  write('Total Bill Amount of all the bill is =');
  writeln(Tot);
  readln;
end.    

A Company calculates the bonus for each employee. Write a Pascal Program to input an Employee number, Sex and Basic Salary and output the Total Salary with Bonus amount of the Employee. (Male gets Bonus 5000 and Female gets Bonus 3000)

program SumBillAmount;

var
  EmpNo:String;
  Sex:char;
  Bonus:integer;
  Basic, Total:real;

begin
  write('Enter a Empoyee No?');
  readln(Empno);
  write('Enter Sex ?');
  readln(Sex);
  write('Enter Basic Salary');
  readln(Basic);
  if (Sex='M') then
     Bonus:=5000
  else
    Bonus:=3000;
  Total:=Basic+Bonus;
  write('Total Salary=');
  writeln(Total:8:2);
  readln;
end.  

Write a Pascal program to Input marks of 50 students into to an array and output the number of students whose mark is greater than the class average mark.

program PrintmorethanAVG;
const
  NoStudents=50;
type
   marks = array [ 1..NoStudents] of integer;

var
  x,StCount:integer;
  StAvg,StTot:real;
  Stmarks:marks;

begin
  x:=1;
  StTot:=0;
  StAvg:=0;
  StCount:=0;
  while (x<=NoStudents) do
  begin
       writeln('Enter a marks?');
       read(Stmarks[x]);
       StTot:=StTot+Stmarks[x];
       x:=x+1;
  end;
  StAvg:=Sttot/NoStudents;
  x:=1;
  while (x<=NoStudents) do
  begin
       if Stmarks[x]>StAvg then
       begin
         StCount:=StCount+1;
       end;
       x:=x+1;
  end;
  write('Number of Students Got More than Average :');
  writeln(StCount);
  readln;
  readln;
end. 

Write a Pascal program to Bubble Sort an array

 PROGRAM BubleSort(input, output);
    CONST
        MaxElts = 5;
    TYPE
        IntArrType = ARRAY [1..MaxElts] OF Integer;

    VAR
        arr: IntArrType;

PROCEDURE ReadArr(VAR a: IntArrType);
    VAR
        x:integer;
        BEGIN
            x := 1;
            WHILE x<=MaxElts DO
            BEGIN
                readln(a[x]);
                x := x + 1
            END;
        END;
{procedure to swap data}
PROCEDURE swap(VAR a: Integer; VAR b: integer);
      VAR
          temp:integer;
        BEGIN
            temp:=a;
            a:=b;
            b:=temp;
        END;
{Procedure to bubble sort not an efficient algorithm}
PROCEDURE Bsort(VAR arr: IntArrType);
        VAR
              i, j : integer;
        BEGIN
            FOR i := 1 TO  MaxElts DO
            FOR j := 1 TO MaxElts-1 DO
                IF arr[j] > arr[j + 1] THEN
                BEGIN
                    swap(arr[j],arr[j + 1]);
                END;

        END;
        
{procedure to bubble sort an efficient algorithm}
PROCEDURE BsortEfficient(VAR arr: IntArrType);
	var
              lastswap,i,endloop:integer;
              swapdone:boolean;
        BEGIN
            endloop:=MaxElts;
            swapdone:=False;
            while not swapdone do
            begin
                i:=1;
                swapdone:=True;
                while i<endloop do
                begin
                    IF arr[i] > arr[i + 1] THEN
                    BEGIN
                         swap(arr[i],arr[i + 1]);
                         lastswap:= i;
                         swapdone:=False;
                    END;
                    i:=i+1;
                end;
                endloop:=lastswap
            end;
          end;       
{Procedure to print elements of an array}
PROCEDURE ArrPrint(VAR arr: IntArrType);
VAR
     I:integer;
 BEGIN
     FOR i := 1 TO MaxElts DO
            writeln(arr[i]) ;

 END;
 
 {main Program}
    BEGIN
        ReadArr(arr);
        Bsort(arr);
        ArrPrint(arr);
        readln;
    END.  



A student file which is stored in the storage consist of Student Number, Name and Marks. Write a Pascal to below given tasks.

a) Write a procedure to input 20 Records of Students.
b) Write a Procedure to input a record No and Display the Record.
c) Write a procedure to Display all the records.

Const
    StNum=20;
Type
	Str25    = String[25];
	StRec =
			Record
				Stno, Stname : Str25;
				StMarks : integer;
			End;
        mf = File of StRec;
Var
	MarksArray : Array[1..StNum] of StRec;

	MarksFile  : mf;
	i            : 1..StNum;

{procedure to input a record}
Procedure EnterNewMark(var newStMark : StRec) ;
Begin
	Writeln('Please enter the Student Marks Details: ');
	Write('Student No: ');
	Readln(newStMark.Stno);
	Write('Student Name: ');
	Readln(newStMark.Stname);
	Write('Student Marks  : ');
	Readln(newStMark.StMarks);
End;
{procedure to display a record}
Procedure ListNewMark(var m :mf;i :integer);
var
        tempStRec  : StRec;
Begin

     ReSet(m);
     Seek(m, i-1);
     Read(m, tempStRec);
     Close(m);
     Writeln('The Student record details  #',i,':');
     Writeln;
     Writeln('Student No:  ', tempStRec.Stno);
     Writeln('Student Name: ', tempStRec.Stname);
     Writeln('Student Marks:   ', tempStRec.Stmarks);
 end;
{procedure to display all the record}
Procedure ListAllMark(var m :mf);
var
        tempStRec  : StRec;
Begin

     ReSet(m);
     Seek(m, 0);
     while not eof(m) do
     begin
          Read(m, tempStRec);
          Writeln('Student No:  ', tempStRec.Stno);
          Write(chr(9));    {tab}
          Write('Student Name: ', tempStRec.Stname);
          Write(chr(9));
          Write('Student Marks:   ', tempStRec.Stmarks);
     end;
 end;
{Main Program}
Begin
	Assign(MarksFile, 'bookrec.dat');
	ReWrite(MarksFile);

	For i := 1 to StNum do
	Begin
		EnterNewMark(MarksArray[i]);
		{ bookRecArray[i] now contains the book details }
		Write(MarksFile, MarksArray[i]);
	End;

	Close(MarksFile);
	Writeln('Record Successfully saved in a file!');
	Write('Enter a record Number to display  ');
	Readln(i);
        ListNewMark(MarksFile,i);
        Writeln('List All Records.......');
        ListAllMark(MarksFile);
	Readln;
End. 





Monday, August 26, 2019

ICT Classes OL, AL, Grade 6-9 | GIT AL | Computer Classes Python, C#, Pascal, DBMS, WEB, MS Office, AI @Wellawatte

NEW

New Batches Start A/L 2028 in June

ICT Fast Track Revision Classes for
A/L 26/27 & O/L

Unit by Unit Coverage day & night Classes

Online & Physical

Register Now
ICT Claases and Computer Classes at Colombo Wellawatte
ICT Classes & Computer Classes

ICT & Computer Classes

G.C.E O/L • G.C.E A/L • Programming • Web Development • Database • MS Office

New Registration for
ICT 2028 Batch & Revision and Past Paper for 2026

📍 Colombo 06 - Wellawatte
🌐 Physical / Online
🗣 English / Tamil
📞 076 7541411
🚀 Build Your Future in IT!
Join practical and exam-oriented ICT & Computer courses with individual attention, past papers, exercises and real-world programming skills.

📚 Available Courses

💻 ICT Classes

  • ICT Grade 6 - 9
  • ICT O/L
  • ICT A/L
  • GIT Classes
  • Regular / Revision / Past Papers

🐍 Programming

  • Python
  • Java
  • Pascal
  • C++
  • C#

🌐 Web Development

  • HTML5
  • CSS3
  • JavaScript
  • PHP
  • Bootstrap & jQuery

🗄 Database Management

  • DBMS Concepts
  • MySQL
  • SQL Queries
  • Normalization
  • ER Diagrams

📊 MS Office

  • MS Word
  • MS Excel
  • PowerPoint
  • MS Access
  • Basics to Advanced

🎯 Special Features

  • Individual Attention
  • Small Group Classes
  • Weekday / Weekend
  • Tailor-made Classes
  • Practical Exercises

📖 Course Contents

Course Main Areas Covered
Java Programming OOP, Classes, Inheritance, Exception Handling, JDBC, Swing, Applets
Python Programming Variables, Functions, File Handling, GUI, MySQL, OOP, Tkinter
Pascal Programming Data Types, Arrays, Functions, File Handling, Objects & Classes
C++ Programming Classes, Constructors, Inheritance, Exception Handling, Streams
Web Development HTML, CSS, JavaScript, PHP, XML, Bootstrap, MySQL
DBMS with MySQL ERD, Normalization, SQL, Procedures, Triggers, MySQL
ICT Classes Regular Theory, Practical, Revision, Past Papers, Weak Area Improvement

🎓 Suitable For

School Students

Grade 6 - 11, O/L and A/L ICT students.

Higher Studies

BIT, HND, BCS, NIBM and Degree students.

Beginners

Anyone interested in learning programming & IT skills from basics.

📲 Join Today & Improve Your ICT Knowledge

Limited Seats Available for Small Group Classes

WhatsApp Now

👨‍🏫 Apputhurai Ganeshananthan

MBA, MBCS, MACS CT, PCP

Experienced ICT Lecturer with strong academic and industry background.

📞 Phone / WhatsApp: 076 7541411

📍 Physical Classes: Colombo 06 - Wellawatte, Kotahena, Bellanwila

🌐 Website: ictallclassnew.blogspot.com

👍 Facebook: LearnWithGanesh

Friday, October 19, 2018

Pseudocode GCE(O/L) Past Paper Questions and Answers

Question 1

A School has 1000 students. The following pseudocode segment prints the admission numbers of students who attended the school everyday (i.e 210 days) in a particular year.

N=0
While N <1000
         get AdmissionNumber
         get NumberOfDays
         if NumberOfDays=210 then
         	print AdmissionNumber
         end if
         N=N+1
End while

Draw a flowchart to represent the above pseudocode. (Use the same variable names as given in the pseudocode in your flowchart.)


Answer


GCE(O/L) Past Paper Pseudocode answer

Note for extra knowledge
Pseudocode and flowcharts are designing tool/technic for algorithm. Once we correctly did it, it would be very easy to write in any programming languages.
Pascal Program is given below.


progrma printadno;
var
  N:integer;
  AdmissionNumber:integer;
  NumberOfDays:integer;
begin
  N:=0;
  while N < 1000 do
  begin
    writeln('Enter Addmission Number ?');
    readln(AdmissionNumber);
    writeln('Enter Number of days?');
    readln(NumberOfDays);
    if NumberOfDays=210   then
       Writeln(AdmissionNumber);
   N:=N+1;
  end;
end.