Showing posts with label Test. Show all posts
Showing posts with label Test. Show all posts

Saturday, April 22, 2023

Multiple selections flowchart and Pascal Program

ICT Past Paper Questions and Answers

Question:

The following flow chart is drawn to calculate average marks (avg) and display the grades when marks (M1, M2, M3) of three subjects are given as input. The grades are decided according to the following table.

Average marks (avg) Grade
Greater than or equal to 80A
Less than 80 and greater than or equal to 65B
Less than 65 and greater than or equal to 50C
OtherwiseNo Grade


Multiple if in Pascal with flowchart

  • Fill the blank indicated by ? according to the given scenario.
  • Convert the flow chart to Pascal Program.


Answer:
1:


Multiple if flowchart and Pascal answer

2:
program Multipleif;
var
m1,m2,m3:integer;
avg:real;
begin
  writeln ('Enter three Marks');
  readln(m1);
  readln(m2);
  readln(m3);
  avg:=(m2+m3+m3)/3;
  if (avg>=80) then
  writeln('A')
  else
  if(avg>=65) then
  writeln('B')
  else
  if (avg>=50) then
  writeln('C')
  else
  writeln('No Grade')
end.

  

Wednesday, February 23, 2022

RDBMS Past Paper Questions and Answers

Relational Database Management System Questions and Answer

Question 1
i) Convert the following ER diagram to table structure in a relational database. The attribute capacity may have values such as captain, vice captain, member etc.

RDBMS Past Paper Questions and Answers

Based on the table Structures obtained above answer the below questions.

ii) Write an SQL statement to get a list of sports that do not have captains.
iii) Write an SQL statement to obtain a list of students (StudentID and Name) who participate in any sport as a captain.


Answer

i)
Student(StudentID, Name)
Sport(SportID, Name)
StudentSport(StudentID, SportID, Year, Capacity)

ii)
Select distinct SportID from StudentSport where capacity <> "captain"

iii) Select Student.ID, Student.Name from Student, StudentSport where Student.StudentID=StudentSport.StudentID and StudentSport.Capacity="captain"


Question 2
The candidates who have been selected for university entrance should register for the given academic year with the university given to them. Candidate who do not register before the Last date announced by each university will lose their university entrance. Once a candidate registers with given university , the candidate becomes a registered student of that university. Registered students can apply for financial support. A student can get many financial support. These financial supports could be either full or partial. All registered students will receive a laptop. However, its ownership cannot be transferred to another student. The user requirements of the above system are listed below. A user shall be able to obtain.
i) a list of students registered for a given academic year with a given university.
ii) information (such as model, serial number, warranty period) about the laptops given to each student.
iii) list of students who applied for financial support.

Draw an entity Relationship(ER) diagram required to design a database to represent the above system description and to satisfy the user requirements. State all your assumptions clearly.

Answer

RDBMS ERD QUESTIONS ANSWERS



Tuesday, February 22, 2022

Combinational circuits Design Questions and Answers

ICT Questions and Answers

Question 1
A digital circuit takes four digits as an input, and produce 'X' as its output. If the decimal value represented by the four binary digit is a prime number. If it is prime output is 1 otherwise 0. Assume that all four binary digit represent positive decimal values.

i) Draw a truth table for the above problem.
ii) Write the Boolean expression in the sum of product form.
iii) Design a logic circuit for the Boolean expression, which is obtained above.
iv) Simplify the expression using Boolean algebra/ Karnaugh map.

Answer
i) Truth Table

ABCDX
00000
00010
00101
00111
01000
01011
01100
01111
10000
10010
10100
10111
11000
11011
11100
11110


ii) X= A'B'CD' + A'B'CD + A'BC'D + A'BCD + AB'CD + ABC'D

iii)
Combinational Circuit to detect prime numbers


iv)
Combinational Circuit Questions and Answers



Question 2
Consider the logic circuit shown here to answer the below questions.

Combinational Circuit Design ICT A/L

i) Write and simplify the Boolean expression for the above circuit using Boolean algebra . Show all the workings and algebraic rules used for the simplification.

ii) Construct the logic circuit using combination of only AND, OR and NOT gates for the simplified Boolean expression obtained above.

Answer
i)
ABC + A'BC + ABC'
BC(A+A') + ABC'
BC + ABC'
B(C+AC')
B(A+C)

ii)

Combinational Past Paper ICT Answer


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





Saturday, August 1, 2020

ICT Past Paper Essay and Struture 1

ICT AL Past Paper Questions and Answers


Answer all Questions yourself and click the button CheckForAnswer to get  correct answers.



  1. The following statement has been used to create a table in a database.

    create table student(student_no char(5), name char(30), address char(100), primary key (student_no))

    1. Write a query in SQL to add the following data to the student table.
      student number - 10001
      Name - Saman Kumar
      address - 78, Mahara Road, Maharagama


    2. If the address of the student entered in the above should be changed to 13, School Lane, Jaffna. write a query in SQL to update the relevant record in the student table.


    1. In an operating system, what are the events that change the state of a process in the 'running' state?



    2. Explain the main actions performed by an operating system during context switching.



    3. Explain what will happen during the booting process of a computer.



  2. The memory of a computer system is byte addressable and has a maximum usable size of 4GB. What is the minimum width of its address bus in bits? Show all you working clearly.






Monday, July 27, 2020

ICT MCQ Practice Test 3

ICT MCQ Questions and Answers

Press the Get Questions button to get MCQ Questions and answered all the question and Press the Check with Answers button to get your marks and correct answers.



ICT MCQ Test Practice

Friday, July 24, 2020

ICT MCQ Practice Test Online

ICT MCQ Test Practice

MCQ OnLine Test for ICT

Press the Get Questions button to get the Questions and answer all the questions and Press the Check with Answers button to get your marks and correct answers.

ICT MCQ Test Practice

Monday, April 27, 2020

System Analysis and Design Questions Answers

SAD
Question 1

(A/L ICT Past Paper)
Fill in the blanks in the following Data Flow Diagram of the sales information system of a company called Bookland, only by using the words in Boldface in the description given below.

Bookland is a book store that specializes in selling rare books, which are usually not available from other sources. As a practice, Bookland maintains just a one copy of any book at a time due to the higher price of rare books.

Typically, a customer makes a book inquiry over the phone from the Sales Assistant at Bookland. She then goes through book details in the Inventory file to check whether such a book is in their stock. If the details of the book is found in the Inventory file, the Sales Assistant then refers to the Hold-on Requests tray to make sure that the book status is 'available' and makes a reply to the inquiry. If the book status is 'available' and the customer wishes to reserve the book, she then takes customer's personal details and places a hold-on request against that book in the hold-on Request tray making the book no longer available.

When the customer comes to make the payment and collect the book, the Cashier at Bookland refer to the Hold-on Requests tray and finds the relevant hold-on request made by the customer. If there is a valid hold-on Requests she then accept the Payment from the customer, issues a payment receipt to the customer and finalize the sale. The customer is then allowed to take away the book. The cashier also files the copy of the payment receipt in the Sales file, uses it at the end of the day to compile a sales report and sends it to the Owner of the book land. After every sale, the cashier updates the book details in the inventory file and keeps the stock up to date. When the Owner supplies books to Bookland, he sends details of books to cashier and cashier adds them one by one to the Inventory file.

Answer

SAD - Answer for Question 1





















Question 2
(A/L ICT Past Paper)
Draw a context diagram to show the operations of the online assignment management system described below adhering to the standards of the Structured System Analysis and Design Methodology(SSADM). Clearly indicate external entities and data flow of your diagram. State any assumption that you have made.

The National University of ICT (NUICT) conducts distance learning programs. The students of NUICT are continuously assessed through online assignments. The students of NUICT use an online assignment management system called NetAssign to download assignments and upload answer scripts. The examiners use NetAssign to upload assignments and to download answer scripts. Once the answer scripts are marked, the examiner enter marks into NetAssign. The students can view only the grades determined by NetAssign. To use NetAssign, both examiners and students must provide authentication details to the system. These authentication details are provided by NUICT to its students and examiners.


Answer

SAD Context Diagram Answer

Question 3
(A/L ICT Past Paper)
Draw a context diagram to show the overview of the library system described below, Clearly indicate external entities and data flows of your diagram and state any acceptable assumptions that you have made.

The National Information Technology Library (NITL) provides e-books to its users through an online system named "Library Information Processing System(LIPS)".

A Person should submit an application to NITL to become a member of the LIPS. The NITL evaluates the application and enters it to the LIPS, if it is approved. After entering the application data, LIPS issues an activation code to NITL which in turn passes it to the relevant person. Once the activation code is received, the person becomes a member of LIPS. A member can obtain his/her username and password by providing the activation code to the LIPS. A member can subsequently access e-books by entering his/her username and the password to the LIPS.

Answer


SAD Answer - Context Diagram


























Note :


Different DFD Notations



Monday, May 20, 2019

Python Past Paper Questions and Answers

Learn Python by Examples

Python Questions and answers selected from past papers

Question 1)
Write Python program to computes the sum of integer from 1 to 10 (including 1 and 10)?

 
Program

tot=0
i=1
while i<=10:
     tot=tot+i
     i=i+1
print ('Total of 1 to 10=',tot)


Output
Total of 1 to 10= 55


Question 2)
What would be the value of the variable temp after executing the statements temp=[23,45,2,-2,0][:3] of Python program?

 
Program

temp=[23,45,2,-2,0][:3:]
print(temp)


Output
[23, 45, 2]

Question 3)
What would be the value of the variable x after executing the statements x=3-4*6/3+12/4*3 of Python program?

 
Program

x=3-4*6/3+12/4*3
print(x)


Output
4.0

Question 4)
Factorial of a positive integer n is defined as n x (n-1) x (n-2) x ....3 x 2 x 1.
i) Propose an algorithm by using a Pseudocode to print the factorial of a given positive integer n.
ii) Write a Python program to implement your Pseudocode.
iii) Write a Python Function to implement your Pseudocode.

 
i)

start
input n
i=n
tot=1
while i>=1
	tot=tot*i
	i=i-1
endwhile
print tot
end

ii)

Program

n=eval(input('Enter a positive integer?'))
i=n
tot=1
while i>=1:
     tot=tot*i
     i=i-1
print('Factorial value of',n,'=',tot,sep=' ')


Output
Enter a positive integer?5
Factorial value of 5 = 120

iii)

#define a function
def my_factorial():
     n=eval(input('Enter a positive integer?'))
     i=n
     tot=1
     while i>=1:
          tot=tot*i
          i=i-1
     print('Factorial value of',n,'=',tot,sep=' ')
#call the function
my_factorial()


Output
Enter a positive integer?5
Factorial value of 5 = 120

Note :
Another way to define the algorithm is given below where input variable n directly assign to the multiplication variable value tot  but remember to get correct answer, statements' order should be changed  within the repetition.
Carefully compare both algorithm.

 
#define a function
def my_factorial():
     n=eval(input('Enter a positive integer?'))
     tot=n
     while n>1:
          n=n-1
          tot=tot*n
     print('Factorial value of',tot,'=',tot,sep=' ')
#call the function
my_factorial()

Question 5)

Flowchart to Python

a) The outputs of the flowchart
b) Write correct pseudo code

 
Output
a) 11, 22, 44 

b) 
Pseudocode
start
r=5
s=3
do
  r=r+s
  s=r+3
  print s
while (r<25)

Note:
Programming languages such as Pascal, C, Java are having do..while and repeat...until repetition; but Python doesn't have repeat...until. The Python code to simulate the repeat...until is given below.

 
r=5
s=3
while True:
    r=r+s
    s=r+3
    print(s)
    if r>=25:
    	break



Saturday, December 22, 2018

ICT MCQ Test Practice

ICT MCQ Questions and Answers

ICT MCQ Test Practice 

ICT MCQ Test Practice

Press the Get Questions button to get MCQ Questions and answered all the question and Press the Check with Answers button to get your marks and correct answers.

Friday, October 19, 2018

GCE(O/L) Past Paper question and answer Flow chart

A teacher of a class of 35 students obtains the student preference to travel either by train or bus on their annual trip. The following flow chart with missing terms labelled A to E represents this scenario. Write down the appropriate terms for the labels A to E. (Any variable names that are used in your answer must be exactly as given in the question.)

GCE(O/L) Past Paper Question

Answer

A   -  0                    (bus_count=0)
B   -  35                   (student_count < 35)
C   -  train_count          (train_count=train_count + 1)
D   -  train_count          (train_count > bus_count)
E   -  tour by bus


Note
Pascal program is given for the above algorithm for extra knowledge.


program findTravelPreference;

var
  total_student:integer;
  student_count:integer;
  train_count:integer;
  bus_count:integer;
  student_preference:String;
begin
  total_student:=2;
  student_count:=0;
  train_count:=0;
  bus_count:=0;
  while student_count < 35 do
  begin
    writeln('Enter your prefernce Bus/Train');
    readln(student_preference);
    if student_preference='Bus' then
       bus_count:=bus_count + 1
    else
        train_count:=train_count +1;
    student_count:=student_count+1;
  end;
  if train_count > bus_count then
     writeln('tour by train')
  else
      writeln('tour by bus');
  readln;
end.
               



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.



Thursday, October 18, 2018

Pascal Question GCE(O/L) MCQ and Essay

Question 1
Consider the following pascal programme
program repetition(input, output);
var x: integer;
begin
  x:=1;
  repeat
    write(x);
    x:=x+1;
  until x=3;
end.

What is the correct output when the above program is executed ?
Answer
until x reach 3 the   repetition will work. The write statement which is above the increment statement  when x gets value 1 and 2 display it, when x gets 3 condition becomes true and repetition end.
(write statement in Pascal display the output horizontally)
The output of the program will be
1 2

Question 2
Consider the following pseudocode with label ® to calculate the sum of numbers from 1 to 100.

sum=0
num=0
repeat
  num=num+1
  sum=sum+num
until
®

for the above mentioned
pseudocode, what is the correct condition that matches with the label ®? 

Answer
The condition given should be false to work repeat until repetition. Sum is happening after increased the variable num by 1. Finally when the variable num gets 100, the value 100 should add to sum  and repetition should break. 
so the answer is 
num=100
 


Question 3
Consider the following pascal programme.
var 
  count:integer;
begin
  repeat
    count:=0;
    write('Hellow   ');
    count:=count+1;
  until count >4;
  while count > 4   do
    begin
    write('Hellow  ');
    count:=count -1;
    end;
  readln;

end.    
What is the correct output when the above program is executed ?

Answer
Count value start from 0.
Until condition is count >0.
Write command is above the increment statement of count variable.
The write statement is which is within the repetition, output 'Helow' will appear  when  count  0,1,2,3,4.
Once count get five break the repetition.
Now  count is 5.
It check the while condition count > 4, the result true so it write the output 'Hellow' and then decrease the count by 1.
Now count 4 then while condition get false.

So repeat until loop print hellow 5 times and while loop print hellow 1 time. total times is 6.

->6 times

Question 4
Consider the following program segment in pascal and write the output of the below program.

program myarr;
var
   num:array[0..4] of integer;
   i:integer;
begin
  num[0]:=15;
  num[2]:=18;
  num[4]:= 50;
  num[1]:=num[4]+10;
  num[3]:=num[0]+num[2];
  for i:=1 to 4 do
      writeln(num[i]);
  readln;

end. 

Answer
60
18
33
50

Explanation
Pascal Questions and Answers from Past Paper