Professional Documents
Culture Documents
Lab 09
Lab 09
Class: BESE-14AB
Learning Objectives:
Lab Tasks
Task 1:
Write a C++ program that declares an integer array of size 10. Initialize the array elements with
random numbers in the range 1-20 and graph the information as a histogram as shown:
Task 2:
Write a C++ program that declares an array of characters of size 10. Initialize the array
elements with random characters including a mix of lower case, upper case, digit, and special
characters. The program should traverse the array elements one by one and count how many
characters are lower case, upper case, digit, and special character as shown in sample output
below. *Note: Explore <cctype.h> for functions like isdigit(), islower(), etc.
a w R 3 % @ Q B % 2
Lower case = 2
Upper case = 3
Digit = 2
Special characters = 3
Task 3:
Write a C++ function that finds the smallest element in an array of double values using the
following header:
Given below is the algorithm for bubble sort that can be used to sort an array. Write a C++
function that implements the algorithm and then test it using a main() driver.
Task 5:
Binary search is used in some cases to improve search from an array. Given below is the
algorithm for iterative binary search. Write a C++ function that implements the algorithm and
then test it using a main() driver. *Note: A pre-requisite of binary search is that array should
be sorted. Therefore, use a sorted array.
Deliverables
Compile a single Word document with codes for each question and screenshots of the outputs
and submit this Word file on LMS.
Lab Rubrics
Your Lab 9 will be graded out of 5 for each rubric according to the following rubrics. Grades
for CLO3 will be shared at different intervals during the semester.
Sr. Assessment Unacceptable Does Not Meet Meets Expectations Exceeds Expectations
No. (0 Marks) Expectations (3/4 Marks) (5 Marks)
(1/2 Marks)
1 Application of The student is unable to The student requires some The student demonstrates a
Programming apply the appropriate guidance to apply the clear ability to apply the
Concepts programming concepts to appropriate programming appropriate
solve the given problem concepts to solve the given programming concepts to
(CLO2, PLO3) solve the given problem.
thus resulting in an problem.
incomplete or ineffective
The program flow requires The program flow is
solution. adequate.
minor improvements.
The program flow is
messy and Codes are semi-modular and Codes are modular,
semi-reusable. reusable, and easily
incomprehensible. readable.
Codes are non-modular
and cannot be reused.
2 Software Tool The student demonstrates The student demonstrates The student demonstrates a
Usage a lack of understanding of some understanding of tool good understanding of tool
The student did not tool usage. usage. usage.
(CLO3-PLO5) submit any work.
Implementation has The codes are correct in Furthermore, his/her
OR syntax/semantic/runtime terms of their syntax, coding is complete and
however, the program functional, and the program
errors, and the student is output is correct in all test
The student unable to debug and output is not always correct
in all test cases. cases.
plagiarized the correct the errors.
solution and/or used The code has limited The code has sufficient
unfair means. The code has inadequate comments and inconsistent comments and consistent
comments and variable variable names and may not variable names and
names and does not adhere to the coding reasonably adhere to the
adhere to the coding standards. coding standards.
standards.
Some Error handling has been Adequate Error handling has
No Error handling has performed. been performed.
been performed.
Documentation is adequately Documentation is well
Documentation is poorly structured. structured.
structured.