Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Questions and Answers Concerning LAB 04

Name: Daniyal

Date: 01/5/23

(1) Why do programmers often refer to arrays as subscripted variables?

The Programmers often refer to arrays as subscripted variables because all elements refer to same
name. That is, each element can be identified with the same name including different index value
(subscript value). Hence, an array is also called as a subscripted variable. By using, these index
values, an element in the array can be accessed directly.

(2) What is meant by the term parallel arrays?

In computing, a group of parallel arrays (also known as structure of arrays or SoA) is a form of
implicit data structure that uses multiple arrays to represent a singular array of records. It keeps a
separate, homogeneous data array for each field of the record, each having the same number of
elements.

(3) The statement below was incorporated in the Linear Search method that was given with the
starter code for this application. What was the purpose of this variable declaration? Why do
programmers often use the flag word for this purpose?
int flag = 0;

Flag variable is used as a signal in programming to let the program know that a certain condition
has met. It usually acts as a Boolean variable indicating a condition to be either true or false.
In this program flag variable are declare for the purpose to check the searching element is found
or not if is found then the flag value is going to 1 otherwise the flag value is 0 so the searching is
so easy.

(4) Why is a Linear Search referred to as " linear "?

In computer science, a linear search or sequential search is a method for finding an element
within a list. It sequentially checks each element of the list until a match is found or the whole
list has been searched.

(5) Why is a Bubble sort referred to as a " bubble " type sort?

The "bubble" sort is called so because the list elements with greater value than their surrounding
elements "bubble" towards the end of the list. For example, after first pass, the largest element is
bubbled towards the right most position.

You might also like