Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

DCS1101: Fundamental of Programming Tutorial 8 – Array

1. Define the following arrays:

a) empNum, a 100 -element array of ints

b) pay Rate, a 25-element array of doubles

c) miles, a 14-element array of longs

d) stateCapital, a 50-element array of string objects .

e) lightYears, a 1,000-element array of doubles

2. Assume a program includes the following two statements. They both use square brackets, but they mean different things. int score[15] ; score[6] = 45 ;

a) Which number is the size declarator ?

b) Which number is a subscript?

3. What is the output of the following code? int values[5], count; for (count= 0; count< 5; count++) values[count ] =count+ 1; for (count= O; count< 5; count++) cout << values[count] << endl;

4. Complete the following program skeleton so it will have a 10-element array of int values called fish. When completed, the program should ask how many fish were caught by fishermen 1 through 10, and store this information in the array. Then it should display the data. #include using namespace std; int main () { const int NUMMEN = 10 ; II Define an array named fish that can hold 10 int values. II You must finish this program so it works as II described above. return O; }

5. Define the following arrays :

a) ages, a 10-element array of ints initialized with the values 5, 7, 9, 14, 15, 17, 18, 19, 21, and 23

b) temps , a 7-element array of doubles initialized with the values 14.7, 16.3,18.43, 21.09, 17.9, 18.76, and 26 .7

c) alpha, an 8-element array of chars initialized with the values 'J', 'B', 'L','A' ,"*" ,'$ ', 'H', and 'M'

6. Given the following array definition: int values [ ] = { 2 , 6, 10, 14} ; what do each of the following display?

a) cout << values[2] ;

b) cout << ++values [0] ;

c) cout << values[1]++;

d) x = 2 ; cout << values[++x ] ;

7. Define a two -dimensional array of ints named grades . It should have 30 rows and 10 columns.

8. How many elements are in the following array? double sales[6 ][ 4] ;

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education