SlideShare a Scribd company logo
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

Artificial Intelligence by B. Ravikumar
Artificial Intelligence by B. RavikumarArtificial Intelligence by B. Ravikumar
Artificial Intelligence by B. Ravikumar
Garry D. Lasaga
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
Darshan Gohel
 
Introduction to Computers Lecture # 2
Introduction to Computers Lecture # 2Introduction to Computers Lecture # 2
Introduction to Computers Lecture # 2
Sehrish Rafiq
 
Supervised Machine Learning in R
Supervised  Machine Learning  in RSupervised  Machine Learning  in R
Supervised Machine Learning in R
Babu Priyavrat
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
rajkumar1631010038
 
IELTS - How to prepare for writing
IELTS - How to prepare for writingIELTS - How to prepare for writing
IELTS - How to prepare for writingHussain Nawrasi
 
Computer-Science-Department-PowerPoint-Presentation.ppt
Computer-Science-Department-PowerPoint-Presentation.pptComputer-Science-Department-PowerPoint-Presentation.ppt
Computer-Science-Department-PowerPoint-Presentation.ppt
ImXaib
 
Evolution of computers
Evolution of computersEvolution of computers
Evolution of computers
Aleena Elizabeth Cyril
 
IELTS Speaking Overview
IELTS Speaking Overview   IELTS Speaking Overview
IELTS Speaking Overview
raihan shakil
 
pseudocode and Flowchart
pseudocode and Flowchartpseudocode and Flowchart
pseudocode and Flowchart
ALI RAZA
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
Shrey Malik
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Raja Hamid
 
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
SlideTeam
 
All tips for IELTS- Oxford English UK Vietnam
All tips for IELTS- Oxford English UK VietnamAll tips for IELTS- Oxford English UK Vietnam
All tips for IELTS- Oxford English UK Vietnam
Oxford English UK Vietnam
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Chapter1 fundamentals of computers by reema thareja
Chapter1 fundamentals of computers by reema tharejaChapter1 fundamentals of computers by reema thareja
Chapter1 fundamentals of computers by reema thareja
AlisherShah1
 
C programming for problem solving
C programming for problem solving  C programming for problem solving
C programming for problem solving
Anuradha Moti T
 

What's hot (20)

Artificial Intelligence by B. Ravikumar
Artificial Intelligence by B. RavikumarArtificial Intelligence by B. Ravikumar
Artificial Intelligence by B. Ravikumar
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Computer handout
Computer handoutComputer handout
Computer handout
 
Introduction to Computers Lecture # 2
Introduction to Computers Lecture # 2Introduction to Computers Lecture # 2
Introduction to Computers Lecture # 2
 
Supervised Machine Learning in R
Supervised  Machine Learning  in RSupervised  Machine Learning  in R
Supervised Machine Learning in R
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
IELTS - How to prepare for writing
IELTS - How to prepare for writingIELTS - How to prepare for writing
IELTS - How to prepare for writing
 
Computer-Science-Department-PowerPoint-Presentation.ppt
Computer-Science-Department-PowerPoint-Presentation.pptComputer-Science-Department-PowerPoint-Presentation.ppt
Computer-Science-Department-PowerPoint-Presentation.ppt
 
Evolution of computers
Evolution of computersEvolution of computers
Evolution of computers
 
IELTS Speaking Overview
IELTS Speaking Overview   IELTS Speaking Overview
IELTS Speaking Overview
 
pseudocode and Flowchart
pseudocode and Flowchartpseudocode and Flowchart
pseudocode and Flowchart
 
Writing algorithms
Writing algorithmsWriting algorithms
Writing algorithms
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
IELTS Writing
IELTS WritingIELTS Writing
IELTS Writing
 
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
Reinforcement Learning In AI Powerpoint Presentation Slide Templates Complete...
 
All tips for IELTS- Oxford English UK Vietnam
All tips for IELTS- Oxford English UK VietnamAll tips for IELTS- Oxford English UK Vietnam
All tips for IELTS- Oxford English UK Vietnam
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Chapter1 fundamentals of computers by reema thareja
Chapter1 fundamentals of computers by reema tharejaChapter1 fundamentals of computers by reema thareja
Chapter1 fundamentals of computers by reema thareja
 
C programming for problem solving
C programming for problem solving  C programming for problem solving
C programming for problem solving
 

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 3i
ARVIND SARDAR
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3
Kuntal Bhowmick
 
MICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSMICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMS
ARVIND SARDAR
 
Project3
Project3Project3
Project3
ARVIND 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-21
chinthala Vijaya Kumar
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
Kaela Johnson
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
arjun431527
 
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)
mehek4
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3
Kuntal 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.docx
florriezhamphrey3065
 
Section1 compound data class
Section1 compound data classSection1 compound data class
Section1 compound data class
Dươ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 COMPILER
ijseajournal
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
Salahaddin University-Erbil
 
Cosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutletCosc 1436 java programming/tutorialoutlet
Cosc 1436 java programming/tutorialoutlet
Woodardz
 
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
fashionbigchennai
 
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
PradipShinde53
 
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
joney4
 
COSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docxCOSC 2436 – PROJECT Contents TITLE ..................docx
COSC 2436 – PROJECT Contents TITLE ..................docx
bobbywlane695641
 

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 - 1
Isham 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 Cheatsheet
Isham Rashik
 
HackerRank Repeated String Problem
HackerRank Repeated String ProblemHackerRank Repeated String Problem
HackerRank Repeated String Problem
Isham Rashik
 
Operations Management - BSB INC - Case Study
Operations Management - BSB INC - Case StudyOperations Management - BSB INC - Case Study
Operations Management - BSB INC - Case Study
Isham Rashik
 
Corporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park ProjectCorporate Finance - Disney Sea Park Project
Corporate Finance - Disney Sea Park Project
Isham 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 Techniques
Isham 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 Cheatsheet
Isham Rashik
 
Android Application Development - Level 3
Android Application Development - Level 3Android Application Development - Level 3
Android Application Development - Level 3
Isham Rashik
 
Android Application Development - Level 2
Android Application Development - Level 2Android Application Development - Level 2
Android Application Development - Level 2
Isham Rashik
 
Android Application Development - Level 1
Android Application Development - Level 1Android Application Development - Level 1
Android Application Development - Level 1
Isham Rashik
 
Managerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon MuskManagerial Skills Presentation - Elon Musk
Managerial Skills Presentation - Elon Musk
Isham Rashik
 
Operations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - ExampleOperations Management - Business Process Reengineering - Example
Operations Management - Business Process Reengineering - Example
Isham Rashik
 
Lighting Design - Theory and Calculations
Lighting Design - Theory and CalculationsLighting Design - Theory and Calculations
Lighting Design - Theory and Calculations
Isham 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 Assignment
Isham Rashik
 
Transformers and Induction Motors
Transformers and Induction MotorsTransformers and Induction Motors
Transformers and Induction Motors
Isham 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 generators
Isham Rashik
 
Circuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage ApplicationsCircuit Breakers for Low Voltage Applications
Circuit Breakers for Low Voltage Applications
Isham 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

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

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