Fill in the blanks in each of the following:
- C stores lists of values in _______.
- The elements of an array are related by the fact that they _____.
- When referring to an array element, the position number contained within square brackets is called a(n) __________.
- The names of the five elements of array p are ___, ____, ___, _____ and ____.
- The contents of a particular element of an array is called the _____ of that element.
- Naming an array, stating its type and specifying the number of elements in the array is called _____ the array.
- The process of placing the elements of an array into either ascending or descending order is called ____.
- In a two-dimensional array, the first index identifies the _____ of an element and the second index identifies the _____ of an element.
- An m-by-n array contains _____ rows, _____ columns and _____ elements.
- The name of the element in row 3 and column 5 of array d is ___.
a)
To fill in the blanks with appropriate word.
C stores the list of values in _Arrays.
Explanation of Solution
Arrays in C stores the homogenous data type of values in consecutive memory locations.Thus, the correct fill up is arrays.
b)
To fill in the blanks with appropriate word.
The elements of the array are related by the fact that they areHomogeneous.
Explanation of Solution
Arrays in C stores the homogenous data type (of the same type) of values in consecutive memory locations e.g. they can contain the same kind of elements like integers, characters, doubles and floats. etc.
Thus, the correct fill up is homogeneous.
c)
To fill in the blanks.
When referring to an array element, the position number contained within square brackets is called aSubscript.
Explanation of Solution
The elements in an array are accessed using the index value contained within the square bracket known as a subscript. It is used to identify the index of the element.
Thus, the correct fill up is subscript.
d)
To fill in the blanks.
The names of five elements of array p are p[0], p[1],p[2],p[3] and p[4].
Explanation of Solution
The elements of the array are accessed using the subscript which start from 0 to length-1.Thus, the correct fill up is p[0],p[1],p[2], p[3] and p[4]..
e)
To fill in the blanks.
The contents of the particular element of the array are called as thevalueof the element in the array.
Explanation of Solution
The content of the element of an array is called the value. For example a is an array and the element at its first positive contains the content 2. So the value will be 2.Thus, the correct fill up is value.
f)
To fill in the blanks.
Naming an array, stating its type and specifying the number of elements in the array is called thedeclarationof the array.
Explanation of Solution
Declaration syntax of an array is as follows-
type arrayname[size];
For example,intarr[5]; //declaration of integer array of size 5.
Thus, the correct fill up is Declaration.
g)
To fill in the blanks.
The process of placing the elements of an array either in ascending order or descending order is calledSorting.
Explanation of Solution
Sorting is the process of arranging the element either in increasing or decreasing order. Thus, the correct fill up is sorting.
h)
To fill in the blanks.
In a two-dimensional array, the first index identifies therow of an element and the second element identifies thecolumnof an element.
Explanation of Solution
The elements in two-dimensional array are stored in rows and column.
Following is the assignment in a 2D array.
a[0][1]=5;
Here 0 is the row number and 1 is the column number and at this position value 5 is stored.Thus, the correct fill up is rowandcolumn.
i)
To fill in the blanks.
An m by n array contains_m_ rows, _n_ columns and _m*n__ elements.
Explanation of Solution
The number of elements in 2 d array is always the product of the number of rows and columns.Thus, the correct fill up arem, n and m*n.
j)
To fill in the blanks.
The name of an element in row 3 and column 5 of array d isd[2][4].
Explanation of Solution
The array indices always start from 0, so the element in 3rd row and 5th column of 2 d array d will be denoted by d[2][4].
Thus, the correct fill up is d[2][4].
Want to see more full solutions like this?
Chapter 6 Solutions
EBK C HOW TO PROGRAM
Additional Engineering Textbook Solutions
Problem Solving with C++ (9th Edition)
Starting Out With Visual Basic (8th Edition)
Database Concepts (8th Edition)
Introduction to Programming Using Visual Basic (10th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Computer Systems: A Programmer's Perspective (3rd Edition)
- (C PROGRAMMING ONLY) 1. Spell-it-out!by CodeChum Admin Are you intimidated with complicated words? Don't be! The trick is to break it down letter by letter! Let’s create a program that prints out the character in the array index indicated by the input integer. For example, if the array has 3 character elements, 'j', 'r', and 'd', and the inputted integer value is 1, then we print 'r' because 'r' is found at index 1. Instructions: In the code editor, you are provided with an array of characters (or a string).Your task is to ask the user for an integer input which represents the index and then print out the character of the string found at that index.Input 1. Index of the array Output Enter the index: 4rarrow_forwardGiven the following set: {b, f, g, h, a, c} You are required to write a C++ programming code that will perform the following operations on the given elements. Write an array code in C++ that will: • Print the first and the last "sorted" character. [5] • Add character "z" in the given array, then print the new set array. [5]arrow_forwardFor a given array arr[6]-{1,3,10,12,6,9}. 3 Write a C++ program which creates the cummulative sum array named csum[6] for the given array. Cummulative sum array is a array where value at every index i stores the sum of elements from index @ to i of given array arr. Note- I dont need any input or functions, simply create the csum array for given arr and print it.arrow_forward
- 1. Program the following.· Prompt the values from user for a single dimensional integer array of length 5 and accept them in FirstIn First Out form.· Consider a one dimensional character array of length 5 and holding data a, e, i, o and u. Sort themin ascending order.· Randomly place values in a 2 dimensional integer array.· Prompt values from user for a one dimensional integer array of length 10 in FILO order. Arrange thisarray in ascending and descending order in other 2 arrays. Language Carrow_forwardQ1.Write a c++ program that adds the value present at index 5 8 and 3 of an array called Array_1having size 7. Now save this value and move it to the first location of a new array calledArray_2. Fill the rest of the array with the remaining values of array_1 in the same order. [8]arrow_forward2) For each of the following, write C++ statements that perform the specified task.a) Declare a built-in array of type unsigned int called values with five elements, andinitialize the elements to the even integers from 2 to 10.b) Declare a pointer vPtr that points to a variable of type unsigned int.c) Write two separate statements that assign the starting address of array values to pointervariable vPtr.d) Use a for statement to print the elements of array values using pointer/offset notation.e) Refer to the fifth element of values using pointer subscript notation.f) Assume that unsigned integers are stored in two bytes and that the starting address of thearray is at location 1002500 in memory.• If vPtr points to the first element of array values, then what address is referenced byvPtr + 3? (manually calculate)• What value is stored at that location?arrow_forward
- Write a code in C++ for inserting the following numbers in the array. (1) Create a Dynamic Array of size 14 using new operator.(2) Insert all numbers in the Array.(3) Print all elements of the Array. 4, 95, 23, 52, 65, 753, 878, 78, 95, 283, 197, 56, 79, 9arrow_forwardC programming I'm trying to fix memory leak but it kept giving that one error. Where did I go wrong? #include <stdlib.h>#include <stdio.h> void printArray(int *arr, int size){ int i; if (arr != NULL) { for( i = 0; i < size; i++) { // Print each element out printf("%d", *(arr+i)); //Print addresses of each element printf("%p", (arr+i)); //Printing a new line printf("\n"); }} } int main() { // Allows user to specify the original array size, stored in variable n1. printf("Enter original array size: "); int n1 = 0; scanf("%d", &n1); //a- Create a new array *a1 of n1 ints using malloc int *a1 = malloc(n1 * sizeof(int)); //b- Remove comments for if statment below //b- Set each element in a1 to 100 + indexValue ?? if(a1 == NULL){printf("Error! memory not allocated."); exit(0);} int i; for (i = 0; i < n1; i++) { a1[i] = 100 + i; } printf("Printing the first array allocated…arrow_forward1) Write the following C programs (Note : The use of flag or bool is not allowed) a.) A C program to get the largest element in an array using function.b.) Write a function double power (double x, int n) that will compute (xn)arrow_forward
- 1. Given the following array declaration: int A [ ][ ]={{13, -23}, {3, 80} ,{91,55} }; Write segment of code that will make the last element equal to 14? Answer: 2. Given the following arrays: int arry1 [ ]= {20, -5, 23, 4}; int arry2[4 ] ; If you write: arry2=arry1, will the two arrays become similar? (explain) Answer: 3. What is the number of rows and number of columns of array A declared in question 1? Answer: 4. Consider the arrays in Question 2. List the elements of arry1[ ] after doing the following code: arry1[1]+=2; Answer: 5. Declare a 2D array with 5 rows and 6 columns?arrow_forwardC++ 1- Creating an array of 8 random integers /// 2- Copying the elements from the first array to another array that fulfills the following condition: The sum of the element to twice its position is less than the square of the difference between the element that follows it and the element that precedes it except for the first and last element They are copied automatically //// 3- Finds the largest even number in the first array and in what position it is found //// 4- Finds the two smallest odd numbers in the first array and in what position it isarrow_forwardMark the following statements as true or false. A double type is an example of a simple data type. (1) A one-dimensional array is an example of a structured data type. (1) The size of an array is determined at compile time. (1,6) Given the declaration: int list[10]; the statement: list[5] - list[3] * list[2]; updates the content of the fifth component of the array list. (2) If an array index goes out of bounds, the program always terminates in an error. (3) The only aggregate operations allowable on int arrays are the increment and decrement operations. (5) Arrays can be passed as parameters to a function either by value or by reference. (6) A function can return a value of type array. (6) In C++, some aggregate operations are allowed for strings. (11,12,13) The declaration: char name [16] = "John K. Miller"; declares name to be an array of 15 characters because the string "John K. Miller" has only 14 characters. (11) The declaration: char str = "Sunny Day"; declares str to be a string of an unspecified length. (11) As parameters, two-dimensional arrays are passed either by value or by reference. (15,16)arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,