SlideShare a Scribd company logo
1 of 11
Download to read offline
2
9608/22/PRE/M/J/19© UCLES 2019
Teachers and candidates should read this material prior to the June 2019 examination for 9608 Paper 2.
Reminders
The syllabus states:
• there will be questions on the examination paper which do not relate to this pre-release material.
• you must choose a high-level programming language from this list:
o Visual Basic (console mode)
o Python
o Pascal / Delphi (console mode)
Note: A mark of zero will be awarded if a programming language other than those listed is used.
Questions on the examination paper may ask the candidate to write:
• structured English
• pseudocode
• program code
A program flowchart should be considered as an alternative to pseudocode for the documenting of an
algorithm design.
Candidates should be confident with:
• the presentation of an algorithm using either a program flowchart or pseudocode
• the production of a program flowchart from given pseudocode and vice versa
Some tasks may need one or more of the built-in functions or operators listed in the Appendix at the
end of this document.
There will be a similar appendix at the end of the question paper.
Declaration of variables
The syllabus document shows the syntax expected for a declaration statement in pseudocode.
DECLARE <identifier> : <data type>
If Python is the chosen language, each variable’s identifier (name) and its intended data type must be
documented using a comment statement.
Structured English – Variables
An algorithm in pseudocode uses variables, which should be declared. An algorithm in structured
English does not always use variables. In this case, the candidate needs to use the information given
in the question to complete an identifier table. The table needs to contain an identifier, data type and
description for each variable.
3
9608/22/PRE/M/J/19© UCLES 2019 [Turn over
TASK 1 – Arrays
Introduction
Candidates should be able to write programs to process array data both in pseudocode and in their
chosen programming language. It is suggested that each task is planned using pseudocode before
writing it in program code.
TASK 1.1
A 1D array of STRING data type will be used to store the name of each student in a class together with
their email address as follows:
<StudentName>'#'<EmailAddress>
An example string with this format would be:
"Eric Smythe#eric@email.com"
Write program code to:
1. declare the array
2. prompt and input name and email address
3. form the string as shown
4. write the string to the next array element
5. repeat from step 2 for all students in the class
6. output each element of the array in a suitable format, together with explanatory text such as
column headings
TASK 1.2
Consider what happens when a student leaves the class and their data item is deleted from the array.
Decide on a way of identifying unused array elements and only output elements that contain student
details. Modify your program to include this.
TASK 1.3
Extend your program so that after assigning values to the array, the program will prompt the user to
input a name, and then search the array to find that name and output the corresponding email address.
TASK 1.4
Modify your program so that it will:
• prompt the user to input part, or the whole, of a name
• search the whole array to find the search term within the <StudentName> string
• for each array element in which the search term is found within the <StudentName> string, output
the element in a suitable format.
4
9608/22/PRE/M/J/19© UCLES 2019
TASK 1.5
Convert your design to use a 2D array and add additional pieces of information for each student.
For example:
Array element Information Example data
MyArray[1,1] Student Name "Tim Smith"
MyArray[1,2] Email Address "TimSmith1099@email.com"
MyArray[1,3] Date of Birth "15/05/2001"
MyArray[1,4] Student ID "C3452-B"
TASK 1.6
Modify your program to work with the new structure.
Task 1.1
​'1 - Declaration of array to hold student records
​Dim​ clsRecords(30) As String
​Dim​ i As Integer
​For​ i = 0 ​to​ 29
clsRecords(i) = ​"---"
​Next
​'4 and 5 - Writing record to the array
​'nextElement - Acts as a pointer for accessing next blocks in the array
​'cond - Gives choice to the user whether to continue or quit
​Dim​ nextElement As Integer = 0
​Dim​ cond As String
​Do
​'2 - User Prompts
​Dim​ name As String
​Dim​ email As String
Console.WriteLine(​"Enter name: "​)
name = Console.ReadLine()
Console.WriteLine(​"Enter email: "​)
email = Console.ReadLine()
​'3 - Formatting of string as per the requirement
​Dim​ record As String = name & ​"#"​ & email
​'Record is getting written to the array
clsRecords(nextElement) = record
nextElement = nextElement + 1
​'User prompt for either continuing to add record or stop
Console.WriteLine(​"Any key to continue, S - stop: "​)
cond = Console.ReadLine()
​Loop​ Until cond = ​"S"​ ​or​ nextElement = 29
​'6 - Output
Console.WriteLine(​"Student Name#Email Address"​)
Console.WriteLine(​"--------------------------"​)
​For​ i = 0 ​to​ 29
Console.WriteLine(clsRecords(i))
​Next
1
Task 1.2
Console.WriteLine(​"Student Name#Email Address"​)
Console.WriteLine(​"--------------------------"​)
​For​ i = 0 ​to​ 29
​'Task 1.2 - To display only the current records
​If​ clsRecords(i) <> ​"---"​ ​Then
Console.WriteLine(clsRecords(i))
​End​ ​If
​Next
Task 1.3
​'Task 1.3 Searching a record and display its corresponding email
'Conditional variable that will determine whether user wants to keep
'searching or quit the loop
​Dim​ cond1 As String
​Do
'Prompt to ask name of the student
​Dim​ name1 As String
Console.WriteLine(​"Enter name: "​)
name1 = Console.ReadLine()
Console.WriteLine(​"Student Name#Email Address"​)
Console.WriteLine(​"--------------------------"​)
​For​ i = 0 ​to​ 29
​If​ clsRecords(i) <> ​"---"​ ​Then
​ 'If name in the record equals name entered, email will be
'displayed
​If​ clsRecords(i).Substring(0, name1.length) = name1 ​Then
Console.WriteLine(clsRecords(i).Substring(name1.length +1))
​End​ ​If
​End​ ​If
​Next
'Prompt whether to search for student name again or stop searching
Console.WriteLine(​"Any key to continue searching, S - Stop"​)
cond1 = Console.ReadLine()
​Loop​ Until cond1 = ​"S"
2
Task 1.4
​'Task 1.4 Searching a record by inputting full or part of the name and
'display the records
'Conditional variable that will determine whether user wants to keep
'searching or quit the loop
​Dim​ cond1 As String
​Do
​Dim​ name1 As String
Console.WriteLine(​"Enter name: "​)
name1 = Console.ReadLine()
​ 'Flag variable to indicate whether full or part of name is found
'In a record
​Dim​ flag As Boolean = ​False
Console.WriteLine(​"Student Name#Email Address"​)
Console.WriteLine(​"--------------------------"​)
​For​ i = 0 ​to​ 29
​If​ clsRecords(i) <> ​"---"​ ​Then
​'IndexOf method allows to search full name or part of the name
'Within the contagious records in the array.
'If record(s) found, flag variable is set to True.
​If​ clsRecords(i).IndexOf(name1) <> -1 ​Then
Console.WriteLine(clsRecords(i))
flag = ​True
​End​ ​If
​End​ ​If
​Next
'If no records found, flag not be set to True and will remain False.
'This will indicate no record is found in the array.
​If​ flag = ​False
Console.WriteLine(​"No Record found!"​)
​End​ ​If
'Prompt whether to search for student name again or stop searching
Console.WriteLine(​"Any key to continue searching, S - Stop"​)
cond1 = Console.ReadLine()
​Loop​ Until cond1 = ​"S"
3
Task 1.5 and Task 1.6 - Repeating Tasks 1.1 - 1.4 using 2D array
Task 1.1
​'1 - Declaration of 2D Arrays to hold student records
​Dim​ clsRecords(30,4) As String
​Dim​ row, col As Integer
'For accessing inner arrays or rows
​For​ row = 0 ​to​ 29
'For accessing elements by each column
​For​ col = 0 ​to​ 3
'Each empty block in the array will be represented by “---”
clsRecords(row, col) = ​"---"
​Next
​Next
​'4 and 5 - Writing all of the details to the empty blocks of array
'nexetRecord - Acts as a pointer for accessing next row. Each row is responsible to
'hold details of a student
'cond - Gives choice to the user whether to continue or quit
​Dim​ nextRecord As Integer
​Dim​ cond As String
​Do
'2 - User prompts
​Dim​ name As String
​Dim​ email As String
​Dim​ dob As String
​Dim​ studentID As String
Console.Writeline(​"Enter name: "​)
name = Console.Readline()
Console.Writeline(​"Enter email: "​)
email = Console.Readline()
Console.Writeline(​"Enter date of birth: "​)
dob = Console.Readline()
Console.Writeline(​"Enter student ID: "​)
studentID = Console.Readline()
'3 - All the details of a student are getting added in each of the blocks
'of the inner array
​'Name of the student is stored in the first block of the row
clsRecords(nextRecord, 0) = name
4
'Email address of the student is stored in the second block
clsRecords(nextRecord, 1) = email
'Date of birth of the student is stored in the third block
clsRecords(nextRecord, 2) = dob
'StudentID of the student is stored in the fourth block
clsRecords(nextRecord, 3) = studentID
​'Pointer is updated to move to the next row
nextRecord = nextRecord + 1
'User prompt for either continuing to add record or stop
Console.Writeline(​"Any key to continue, S - stop: "​)
cond = Console.Readline()
​Loop​ Until cond = ​"S"​ ​or​ cond = ​"s" ​or ​nextRecord = 29
'6 - Output
Console.Writeline(​"Student Name#Email Address#Date of Birth#Student ID"​)
Console.Writeline(​"---------------------------------------------------"​)
For​ row = 0 ​to​ 29
​For​ col = 0 ​to​ 3
​'To display elements of a row in same line followed by a separator - “#”
Console.Write(clsRecords(row, col) & ​"#"​)
​Next
'Once all details of a student is displayed, we move to the next line for
'Displaying the record of another student
Console.Writeline()
​Next
Task 1.2
Console.Writeline(​"Student Name#Email Address#Date of Birth#Student ID"​)
Console.Writeline(​"---------------------------------------------------"​)
​'flag variable - To allow moving to the next line only if a record is found
'This will prevent printing unnecessary blank lines.
Dim​ flag As Boolean = ​False
For​ row = 0 ​to​ 29
​For​ col = 0 ​to​ 3
​'To prevent printing empty slots in the console. Each elements or cells
'are checked if the slot is empty.
​If​ clsRecords(row, col) <> ​"---"​ ​Then
Console.Write(clsRecords(row, col) & ​"#"​)
​'After record of a student is displayed, flag is set to true
flag = ​True
​End​ ​If
5
​Next
'flag = True represents the record of a student is detected and will only
'allow moving to the next line after record of a student is displayed.
'After moving to next line, flag is then again set to False so that if row of
'are not detected, flag will remain False, and we then do not move to the next
'line.
​If​ flag = ​True​ ​Then
Console.Writeline()
flag = ​False
​End​ ​If
​Next
Task 1.3
​ 'Conditional variable that will determine whether user wants to keep
'searching or quit the loop
​ ​Dim​ ​cond1 As String
​Do
​'Prompt to ask name of the student
​Dim​ ​name1 As String
​ Console.Writeline(​"Enter name: "​)
​name1 = Console.Readline()
'Column headers
​Console.Writeline(​"StudentName#EmailAddress#DateofBirth#StudentID"​)
Console.Writeline(​"----------------------------------------------"​)
​Dim​ ​row1, col1 As Integer
​Dim​ ​flag1 As Boolean =​ ​False
​For​ ​row1 = 0​ ​to​ ​29
​For​ ​col1 = 0​ ​to​ ​3
​If​ ​clsRecords(row1, col1) <>​ ​"---"​ ​Then
​'First cell of the row is checked if it equals the name
'that is entered by the user.
'If True, next line is executed and email is displayed of
'the respective student of whose name was entered.
​If​ ​clsRecords(row1, 0) = name1​ ​Then
​ Console.Writeline(clsRecords(row1,1))
​flag1 = ​True
'Once email address is displayed, it is necessary to
'exit the inner loop as it will repeat itself, and then
'more than once, same email will be displayed as we
'explicitly pass number 1 to access the second column.
​exit​ ​for
​End​ ​if
6
​End​ ​If
​Next
​If​ ​flag1 =​ ​True​ ​Then
​Console.Writeline()
​flag1 = ​False
​End​ ​if
​Next
​Console.Writeline(​"Any key to continue, S - stop: "​)
​ cond1 = Console.Readline()
​Loop​ ​Until cond1 = ​"S" ​or​ ​cond1​ ​= ​"s"
Task 1.4
​Dim​ cond1 As String
​Do
​Dim​ name1 As String
Console.Writeline(​"Enter name: "​)
name1 = Console.Readline()
'Column headers
​Console.Writeline(​"StudentName#EmailAddress#DateofBirth#StudentID"​)
Console.Writeline(​"----------------------------------------------"​)
​Dim​ row1, col1 As Integer
​Dim​ flag1 As Boolean = ​False
​For​ row1 = 0 ​to​ 29
​For​ col1 = 0 ​to​ 3
​If​ clsRecords(row1, col1) <> ​"---"​ ​Then
​'If full name includes part of the name, then record(s)
'Of those students will be displayed.
​If​ clsRecords(row1, 0).IndexOf(name1) <> -1 ​Then
Console.Write(clsRecords(row1, col1) & ​"#"​)
flag1 = ​True
​'Here we don’t need to exit loop in advance as col1
'variable gets incremented at the end of the loop which
'will then allow us to access all of the elements of
'inner row(s) and therefore display details of
'student(s)
​End​ ​if
​End​ ​If
​Next
​If​ flag1 = ​True​ ​Then
Console.Writeline()
flag1 = ​False
​End​ ​if
7
​Next
Console.Writeline(​"Any key to continue, S - stop: "​)
cond1 = Console.Readline()
​Loop​ Until cond1 = ​"S"
8

More Related Content

What's hot

Generations of programming language
Generations of programming languageGenerations of programming language
Generations of programming languageJAIDEVPAUL
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stackAshok Raj
 
What is a Server
What is a ServerWhat is a Server
What is a ServerKuwait10
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
Introduction to computer literacy
Introduction to computer literacyIntroduction to computer literacy
Introduction to computer literacyMkhululi Silinga
 
All You Need to Know About Java – Advantages and Disadvantages
All You Need to Know About Java – Advantages and DisadvantagesAll You Need to Know About Java – Advantages and Disadvantages
All You Need to Know About Java – Advantages and Disadvantagescarolynebert3007
 
The Basic Configuration of a Microcomputer
The Basic Configuration of a Microcomputer The Basic Configuration of a Microcomputer
The Basic Configuration of a Microcomputer Taminul Islam
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingNeeru Mittal
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - OverviewAshita Agrawal
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming LanguagesJuhi Bhoyar
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language adnan usmani
 
New Trends in software development
New Trends in software developmentNew Trends in software development
New Trends in software developmentKabir Khanna
 
Careers in Information Technology
Careers in Information TechnologyCareers in Information Technology
Careers in Information TechnologyMyjobspace
 
Fundamentals Of Computer
Fundamentals Of ComputerFundamentals Of Computer
Fundamentals Of ComputerJack Frost
 
Chapter 1 introduction to computers
Chapter 1   introduction to computersChapter 1   introduction to computers
Chapter 1 introduction to computershaider ali
 

What's hot (20)

Generations of programming language
Generations of programming languageGenerations of programming language
Generations of programming language
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
 
Qbasic
QbasicQbasic
Qbasic
 
What is a Server
What is a ServerWhat is a Server
What is a Server
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Introduction to computer literacy
Introduction to computer literacyIntroduction to computer literacy
Introduction to computer literacy
 
All You Need to Know About Java – Advantages and Disadvantages
All You Need to Know About Java – Advantages and DisadvantagesAll You Need to Know About Java – Advantages and Disadvantages
All You Need to Know About Java – Advantages and Disadvantages
 
The Basic Configuration of a Microcomputer
The Basic Configuration of a Microcomputer The Basic Configuration of a Microcomputer
The Basic Configuration of a Microcomputer
 
Python Tutorial Part 2
Python Tutorial Part 2Python Tutorial Part 2
Python Tutorial Part 2
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
History of programming
History of programmingHistory of programming
History of programming
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - Overview
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
 
New Trends in software development
New Trends in software developmentNew Trends in software development
New Trends in software development
 
Operating System
Operating System Operating System
Operating System
 
Careers in Information Technology
Careers in Information TechnologyCareers in Information Technology
Careers in Information Technology
 
Fundamentals Of Computer
Fundamentals Of ComputerFundamentals Of Computer
Fundamentals Of Computer
 
Chapter 1 introduction to computers
Chapter 1   introduction to computersChapter 1   introduction to computers
Chapter 1 introduction to computers
 
Programming
ProgrammingProgramming
Programming
 

Similar to 9608 Computer Science Cambridge International AS level Pre-Release May June paper 22 2019 Tasks 1.1 - 1.6

Micro project project co 3i
Micro project project co 3iMicro project project co 3i
Micro project project co 3iARVIND SARDAR
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3Kuntal Bhowmick
 
MICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSMICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSARVIND SARDAR
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21chinthala Vijaya Kumar
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2Kaela Johnson
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptxarjun431527
 
Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)mehek4
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3Kuntal Bhowmick
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxflorriezhamphrey3065
 
Section1 compound data class
Section1 compound data classSection1 compound data class
Section1 compound data classDương Tùng
 
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILER
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILERRANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILER
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILERijseajournal
 
Cosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutletCosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutletWoodardz
 
This is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdfThis is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdffashionbigchennai
 
22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdfPradipShinde53
 
Excel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment meExcel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment mejoney4
 
COSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docxCOSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docxbobbywlane695641
 

Similar to 9608 Computer Science Cambridge International AS level Pre-Release May June paper 22 2019 Tasks 1.1 - 1.6 (20)

Micro project project co 3i
Micro project project co 3iMicro project project co 3i
Micro project project co 3i
 
Dbms record
Dbms recordDbms record
Dbms record
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3
 
MICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSMICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMS
 
Project3
Project3Project3
Project3
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
C++
C++C++
C++
 
Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
 
Section1 compound data class
Section1 compound data classSection1 compound data class
Section1 compound data class
 
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILER
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILERRANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILER
RANDOM TESTS COMBINING MATHEMATICA PACKAGE AND LATEX COMPILER
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
 
Cosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutletCosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutlet
 
This is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdfThis is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdf
 
22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf
 
Excel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment meExcel analysis assignment this is an independent assignment me
Excel analysis assignment this is an independent assignment me
 
COSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docxCOSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docx
 

More from Isham Rashik

Text Preprocessing - 1
Text Preprocessing - 1Text Preprocessing - 1
Text Preprocessing - 1Isham Rashik
 
Fundamentals of Cryptography - Caesar Cipher - Python
Fundamentals of Cryptography - Caesar Cipher - Python Fundamentals of Cryptography - Caesar Cipher - Python
Fundamentals of Cryptography - Caesar Cipher - Python Isham Rashik
 
Python 3.x Dictionaries and Sets Cheatsheet
Python 3.x Dictionaries and Sets CheatsheetPython 3.x Dictionaries and Sets Cheatsheet
Python 3.x Dictionaries and Sets CheatsheetIsham Rashik
 
HackerRank Repeated String Problem
HackerRank Repeated String ProblemHackerRank Repeated String Problem
HackerRank Repeated String ProblemIsham Rashik
 
Operations Management - BSB INC - Case Study
Operations Management - BSB INC - Case StudyOperations Management - BSB INC - Case Study
Operations Management - BSB INC - Case StudyIsham Rashik
 
Corporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park ProjectCorporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park ProjectIsham Rashik
 
Questionnaire - Why women entrepreneurs are happier than men?
Questionnaire - Why women entrepreneurs are happier than men?Questionnaire - Why women entrepreneurs are happier than men?
Questionnaire - Why women entrepreneurs are happier than men?Isham Rashik
 
Human Resource Management - Different Interview Techniques
Human Resource Management - Different Interview TechniquesHuman Resource Management - Different Interview Techniques
Human Resource Management - Different Interview TechniquesIsham Rashik
 
Python 3.x File Object Manipulation Cheatsheet
Python 3.x File Object Manipulation CheatsheetPython 3.x File Object Manipulation Cheatsheet
Python 3.x File Object Manipulation CheatsheetIsham Rashik
 
Android Application Development - Level 3
Android Application Development - Level 3Android Application Development - Level 3
Android Application Development - Level 3Isham Rashik
 
Android Application Development - Level 2
Android Application Development - Level 2Android Application Development - Level 2
Android Application Development - Level 2Isham Rashik
 
Android Application Development - Level 1
Android Application Development - Level 1Android Application Development - Level 1
Android Application Development - Level 1Isham Rashik
 
Managerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon MuskManagerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon MuskIsham Rashik
 
Operations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - ExampleOperations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - ExampleIsham Rashik
 
Lighting Design - Theory and Calculations
Lighting Design - Theory and CalculationsLighting Design - Theory and Calculations
Lighting Design - Theory and CalculationsIsham Rashik
 
Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentIsham Rashik
 
Transformers and Induction Motors
Transformers and Induction MotorsTransformers and Induction Motors
Transformers and Induction MotorsIsham Rashik
 
Three phase balanced load circuits and synchronous generators
Three phase balanced load circuits and synchronous generatorsThree phase balanced load circuits and synchronous generators
Three phase balanced load circuits and synchronous generatorsIsham Rashik
 
Circuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage ApplicationsCircuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage ApplicationsIsham Rashik
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Isham Rashik
 

More from Isham Rashik (20)

Text Preprocessing - 1
Text Preprocessing - 1Text Preprocessing - 1
Text Preprocessing - 1
 
Fundamentals of Cryptography - Caesar Cipher - Python
Fundamentals of Cryptography - Caesar Cipher - Python Fundamentals of Cryptography - Caesar Cipher - Python
Fundamentals of Cryptography - Caesar Cipher - Python
 
Python 3.x Dictionaries and Sets Cheatsheet
Python 3.x Dictionaries and Sets CheatsheetPython 3.x Dictionaries and Sets Cheatsheet
Python 3.x Dictionaries and Sets Cheatsheet
 
HackerRank Repeated String Problem
HackerRank Repeated String ProblemHackerRank Repeated String Problem
HackerRank Repeated String Problem
 
Operations Management - BSB INC - Case Study
Operations Management - BSB INC - Case StudyOperations Management - BSB INC - Case Study
Operations Management - BSB INC - Case Study
 
Corporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park ProjectCorporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park Project
 
Questionnaire - Why women entrepreneurs are happier than men?
Questionnaire - Why women entrepreneurs are happier than men?Questionnaire - Why women entrepreneurs are happier than men?
Questionnaire - Why women entrepreneurs are happier than men?
 
Human Resource Management - Different Interview Techniques
Human Resource Management - Different Interview TechniquesHuman Resource Management - Different Interview Techniques
Human Resource Management - Different Interview Techniques
 
Python 3.x File Object Manipulation Cheatsheet
Python 3.x File Object Manipulation CheatsheetPython 3.x File Object Manipulation Cheatsheet
Python 3.x File Object Manipulation Cheatsheet
 
Android Application Development - Level 3
Android Application Development - Level 3Android Application Development - Level 3
Android Application Development - Level 3
 
Android Application Development - Level 2
Android Application Development - Level 2Android Application Development - Level 2
Android Application Development - Level 2
 
Android Application Development - Level 1
Android Application Development - Level 1Android Application Development - Level 1
Android Application Development - Level 1
 
Managerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon MuskManagerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon Musk
 
Operations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - ExampleOperations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - Example
 
Lighting Design - Theory and Calculations
Lighting Design - Theory and CalculationsLighting Design - Theory and Calculations
Lighting Design - Theory and Calculations
 
Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller Assignment
 
Transformers and Induction Motors
Transformers and Induction MotorsTransformers and Induction Motors
Transformers and Induction Motors
 
Three phase balanced load circuits and synchronous generators
Three phase balanced load circuits and synchronous generatorsThree phase balanced load circuits and synchronous generators
Three phase balanced load circuits and synchronous generators
 
Circuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage ApplicationsCircuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage Applications
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

9608 Computer Science Cambridge International AS level Pre-Release May June paper 22 2019 Tasks 1.1 - 1.6

  • 1. 2 9608/22/PRE/M/J/19© UCLES 2019 Teachers and candidates should read this material prior to the June 2019 examination for 9608 Paper 2. Reminders The syllabus states: • there will be questions on the examination paper which do not relate to this pre-release material. • you must choose a high-level programming language from this list: o Visual Basic (console mode) o Python o Pascal / Delphi (console mode) Note: A mark of zero will be awarded if a programming language other than those listed is used. Questions on the examination paper may ask the candidate to write: • structured English • pseudocode • program code A program flowchart should be considered as an alternative to pseudocode for the documenting of an algorithm design. Candidates should be confident with: • the presentation of an algorithm using either a program flowchart or pseudocode • the production of a program flowchart from given pseudocode and vice versa Some tasks may need one or more of the built-in functions or operators listed in the Appendix at the end of this document. There will be a similar appendix at the end of the question paper. Declaration of variables The syllabus document shows the syntax expected for a declaration statement in pseudocode. DECLARE <identifier> : <data type> If Python is the chosen language, each variable’s identifier (name) and its intended data type must be documented using a comment statement. Structured English – Variables An algorithm in pseudocode uses variables, which should be declared. An algorithm in structured English does not always use variables. In this case, the candidate needs to use the information given in the question to complete an identifier table. The table needs to contain an identifier, data type and description for each variable.
  • 2. 3 9608/22/PRE/M/J/19© UCLES 2019 [Turn over TASK 1 – Arrays Introduction Candidates should be able to write programs to process array data both in pseudocode and in their chosen programming language. It is suggested that each task is planned using pseudocode before writing it in program code. TASK 1.1 A 1D array of STRING data type will be used to store the name of each student in a class together with their email address as follows: <StudentName>'#'<EmailAddress> An example string with this format would be: "Eric Smythe#eric@email.com" Write program code to: 1. declare the array 2. prompt and input name and email address 3. form the string as shown 4. write the string to the next array element 5. repeat from step 2 for all students in the class 6. output each element of the array in a suitable format, together with explanatory text such as column headings TASK 1.2 Consider what happens when a student leaves the class and their data item is deleted from the array. Decide on a way of identifying unused array elements and only output elements that contain student details. Modify your program to include this. TASK 1.3 Extend your program so that after assigning values to the array, the program will prompt the user to input a name, and then search the array to find that name and output the corresponding email address. TASK 1.4 Modify your program so that it will: • prompt the user to input part, or the whole, of a name • search the whole array to find the search term within the <StudentName> string • for each array element in which the search term is found within the <StudentName> string, output the element in a suitable format.
  • 3. 4 9608/22/PRE/M/J/19© UCLES 2019 TASK 1.5 Convert your design to use a 2D array and add additional pieces of information for each student. For example: Array element Information Example data MyArray[1,1] Student Name "Tim Smith" MyArray[1,2] Email Address "TimSmith1099@email.com" MyArray[1,3] Date of Birth "15/05/2001" MyArray[1,4] Student ID "C3452-B" TASK 1.6 Modify your program to work with the new structure.
  • 4. Task 1.1 ​'1 - Declaration of array to hold student records ​Dim​ clsRecords(30) As String ​Dim​ i As Integer ​For​ i = 0 ​to​ 29 clsRecords(i) = ​"---" ​Next ​'4 and 5 - Writing record to the array ​'nextElement - Acts as a pointer for accessing next blocks in the array ​'cond - Gives choice to the user whether to continue or quit ​Dim​ nextElement As Integer = 0 ​Dim​ cond As String ​Do ​'2 - User Prompts ​Dim​ name As String ​Dim​ email As String Console.WriteLine(​"Enter name: "​) name = Console.ReadLine() Console.WriteLine(​"Enter email: "​) email = Console.ReadLine() ​'3 - Formatting of string as per the requirement ​Dim​ record As String = name & ​"#"​ & email ​'Record is getting written to the array clsRecords(nextElement) = record nextElement = nextElement + 1 ​'User prompt for either continuing to add record or stop Console.WriteLine(​"Any key to continue, S - stop: "​) cond = Console.ReadLine() ​Loop​ Until cond = ​"S"​ ​or​ nextElement = 29 ​'6 - Output Console.WriteLine(​"Student Name#Email Address"​) Console.WriteLine(​"--------------------------"​) ​For​ i = 0 ​to​ 29 Console.WriteLine(clsRecords(i)) ​Next 1
  • 5. Task 1.2 Console.WriteLine(​"Student Name#Email Address"​) Console.WriteLine(​"--------------------------"​) ​For​ i = 0 ​to​ 29 ​'Task 1.2 - To display only the current records ​If​ clsRecords(i) <> ​"---"​ ​Then Console.WriteLine(clsRecords(i)) ​End​ ​If ​Next Task 1.3 ​'Task 1.3 Searching a record and display its corresponding email 'Conditional variable that will determine whether user wants to keep 'searching or quit the loop ​Dim​ cond1 As String ​Do 'Prompt to ask name of the student ​Dim​ name1 As String Console.WriteLine(​"Enter name: "​) name1 = Console.ReadLine() Console.WriteLine(​"Student Name#Email Address"​) Console.WriteLine(​"--------------------------"​) ​For​ i = 0 ​to​ 29 ​If​ clsRecords(i) <> ​"---"​ ​Then ​ 'If name in the record equals name entered, email will be 'displayed ​If​ clsRecords(i).Substring(0, name1.length) = name1 ​Then Console.WriteLine(clsRecords(i).Substring(name1.length +1)) ​End​ ​If ​End​ ​If ​Next 'Prompt whether to search for student name again or stop searching Console.WriteLine(​"Any key to continue searching, S - Stop"​) cond1 = Console.ReadLine() ​Loop​ Until cond1 = ​"S" 2
  • 6. Task 1.4 ​'Task 1.4 Searching a record by inputting full or part of the name and 'display the records 'Conditional variable that will determine whether user wants to keep 'searching or quit the loop ​Dim​ cond1 As String ​Do ​Dim​ name1 As String Console.WriteLine(​"Enter name: "​) name1 = Console.ReadLine() ​ 'Flag variable to indicate whether full or part of name is found 'In a record ​Dim​ flag As Boolean = ​False Console.WriteLine(​"Student Name#Email Address"​) Console.WriteLine(​"--------------------------"​) ​For​ i = 0 ​to​ 29 ​If​ clsRecords(i) <> ​"---"​ ​Then ​'IndexOf method allows to search full name or part of the name 'Within the contagious records in the array. 'If record(s) found, flag variable is set to True. ​If​ clsRecords(i).IndexOf(name1) <> -1 ​Then Console.WriteLine(clsRecords(i)) flag = ​True ​End​ ​If ​End​ ​If ​Next 'If no records found, flag not be set to True and will remain False. 'This will indicate no record is found in the array. ​If​ flag = ​False Console.WriteLine(​"No Record found!"​) ​End​ ​If 'Prompt whether to search for student name again or stop searching Console.WriteLine(​"Any key to continue searching, S - Stop"​) cond1 = Console.ReadLine() ​Loop​ Until cond1 = ​"S" 3
  • 7. Task 1.5 and Task 1.6 - Repeating Tasks 1.1 - 1.4 using 2D array Task 1.1 ​'1 - Declaration of 2D Arrays to hold student records ​Dim​ clsRecords(30,4) As String ​Dim​ row, col As Integer 'For accessing inner arrays or rows ​For​ row = 0 ​to​ 29 'For accessing elements by each column ​For​ col = 0 ​to​ 3 'Each empty block in the array will be represented by “---” clsRecords(row, col) = ​"---" ​Next ​Next ​'4 and 5 - Writing all of the details to the empty blocks of array 'nexetRecord - Acts as a pointer for accessing next row. Each row is responsible to 'hold details of a student 'cond - Gives choice to the user whether to continue or quit ​Dim​ nextRecord As Integer ​Dim​ cond As String ​Do '2 - User prompts ​Dim​ name As String ​Dim​ email As String ​Dim​ dob As String ​Dim​ studentID As String Console.Writeline(​"Enter name: "​) name = Console.Readline() Console.Writeline(​"Enter email: "​) email = Console.Readline() Console.Writeline(​"Enter date of birth: "​) dob = Console.Readline() Console.Writeline(​"Enter student ID: "​) studentID = Console.Readline() '3 - All the details of a student are getting added in each of the blocks 'of the inner array ​'Name of the student is stored in the first block of the row clsRecords(nextRecord, 0) = name 4
  • 8. 'Email address of the student is stored in the second block clsRecords(nextRecord, 1) = email 'Date of birth of the student is stored in the third block clsRecords(nextRecord, 2) = dob 'StudentID of the student is stored in the fourth block clsRecords(nextRecord, 3) = studentID ​'Pointer is updated to move to the next row nextRecord = nextRecord + 1 'User prompt for either continuing to add record or stop Console.Writeline(​"Any key to continue, S - stop: "​) cond = Console.Readline() ​Loop​ Until cond = ​"S"​ ​or​ cond = ​"s" ​or ​nextRecord = 29 '6 - Output Console.Writeline(​"Student Name#Email Address#Date of Birth#Student ID"​) Console.Writeline(​"---------------------------------------------------"​) For​ row = 0 ​to​ 29 ​For​ col = 0 ​to​ 3 ​'To display elements of a row in same line followed by a separator - “#” Console.Write(clsRecords(row, col) & ​"#"​) ​Next 'Once all details of a student is displayed, we move to the next line for 'Displaying the record of another student Console.Writeline() ​Next Task 1.2 Console.Writeline(​"Student Name#Email Address#Date of Birth#Student ID"​) Console.Writeline(​"---------------------------------------------------"​) ​'flag variable - To allow moving to the next line only if a record is found 'This will prevent printing unnecessary blank lines. Dim​ flag As Boolean = ​False For​ row = 0 ​to​ 29 ​For​ col = 0 ​to​ 3 ​'To prevent printing empty slots in the console. Each elements or cells 'are checked if the slot is empty. ​If​ clsRecords(row, col) <> ​"---"​ ​Then Console.Write(clsRecords(row, col) & ​"#"​) ​'After record of a student is displayed, flag is set to true flag = ​True ​End​ ​If 5
  • 9. ​Next 'flag = True represents the record of a student is detected and will only 'allow moving to the next line after record of a student is displayed. 'After moving to next line, flag is then again set to False so that if row of 'are not detected, flag will remain False, and we then do not move to the next 'line. ​If​ flag = ​True​ ​Then Console.Writeline() flag = ​False ​End​ ​If ​Next Task 1.3 ​ 'Conditional variable that will determine whether user wants to keep 'searching or quit the loop ​ ​Dim​ ​cond1 As String ​Do ​'Prompt to ask name of the student ​Dim​ ​name1 As String ​ Console.Writeline(​"Enter name: "​) ​name1 = Console.Readline() 'Column headers ​Console.Writeline(​"StudentName#EmailAddress#DateofBirth#StudentID"​) Console.Writeline(​"----------------------------------------------"​) ​Dim​ ​row1, col1 As Integer ​Dim​ ​flag1 As Boolean =​ ​False ​For​ ​row1 = 0​ ​to​ ​29 ​For​ ​col1 = 0​ ​to​ ​3 ​If​ ​clsRecords(row1, col1) <>​ ​"---"​ ​Then ​'First cell of the row is checked if it equals the name 'that is entered by the user. 'If True, next line is executed and email is displayed of 'the respective student of whose name was entered. ​If​ ​clsRecords(row1, 0) = name1​ ​Then ​ Console.Writeline(clsRecords(row1,1)) ​flag1 = ​True 'Once email address is displayed, it is necessary to 'exit the inner loop as it will repeat itself, and then 'more than once, same email will be displayed as we 'explicitly pass number 1 to access the second column. ​exit​ ​for ​End​ ​if 6
  • 10. ​End​ ​If ​Next ​If​ ​flag1 =​ ​True​ ​Then ​Console.Writeline() ​flag1 = ​False ​End​ ​if ​Next ​Console.Writeline(​"Any key to continue, S - stop: "​) ​ cond1 = Console.Readline() ​Loop​ ​Until cond1 = ​"S" ​or​ ​cond1​ ​= ​"s" Task 1.4 ​Dim​ cond1 As String ​Do ​Dim​ name1 As String Console.Writeline(​"Enter name: "​) name1 = Console.Readline() 'Column headers ​Console.Writeline(​"StudentName#EmailAddress#DateofBirth#StudentID"​) Console.Writeline(​"----------------------------------------------"​) ​Dim​ row1, col1 As Integer ​Dim​ flag1 As Boolean = ​False ​For​ row1 = 0 ​to​ 29 ​For​ col1 = 0 ​to​ 3 ​If​ clsRecords(row1, col1) <> ​"---"​ ​Then ​'If full name includes part of the name, then record(s) 'Of those students will be displayed. ​If​ clsRecords(row1, 0).IndexOf(name1) <> -1 ​Then Console.Write(clsRecords(row1, col1) & ​"#"​) flag1 = ​True ​'Here we don’t need to exit loop in advance as col1 'variable gets incremented at the end of the loop which 'will then allow us to access all of the elements of 'inner row(s) and therefore display details of 'student(s) ​End​ ​if ​End​ ​If ​Next ​If​ flag1 = ​True​ ​Then Console.Writeline() flag1 = ​False ​End​ ​if 7
  • 11. ​Next Console.Writeline(​"Any key to continue, S - stop: "​) cond1 = Console.Readline() ​Loop​ Until cond1 = ​"S" 8