Question

C++ Programming Given int ages={7,12,9,6 }; What will be the output statement: cout<<ages; This will display...

C++ Programming

Given int ages={7,12,9,6 };

  1. What will be the output statement: cout<<ages;
  1. This will display a compiler error
  2. 7,12,9,6
  3. 0
  4. A hex value
  1. Char course [20]=”Intro to c++” ; what character at course[12] will be:
  1. \0
  2. A hex value
  3. +
  4. A space
  1. Given char course [20]={ “Intro to c++”}; the character at course[6] will be:
  1. \0
  2. The letter o
  3. The letter t
  4. A space
  1. In the following two dimensional Array table [4][3]= {3,7,0,2,4,9,8,1,3,6,5,4};

What is the value of table [2][1]?

  1. 4                  b. 7                    c. 6                  d. 1

  1. In the following two-dimensional Array table [3][4] = {3,7,0,2,4,9,8,1,3,6,5,4};

What is the value of table [2][1]?

  1. 4                                     7                                      c. 6                                          d. 1
  1. What is the value of the length?

    int length;

   string s1="programming is fun!";

   length=s1.size();

   cout<<length<<endl;

  1. 20                           b.19                                             c.25                                      d.18
  1. What is the correct declaration statement for an array of 100 integer data type?
  1. Dimension int [100];
  2. Int numbers [99];
  3. Dim numbers [100];
  4. int numbers [100];
  1. A two-dimensional array can be viewed as ------------------   and -----------------------
  1. Increments, decrements
  2. Arguments, parameters
  3. Rows, columns
  4. All of these
  1. Which one of the following is a valid C++ array definition?
  1. float $payment [10];
  2. int score[10];
  3. int reading[4.5];
  4. int scores[0];
  1. Given the following declaration, where 77 stored in the scores array?

Int scores[]={83,62,77,97};

  1. scores[1]                       b. scores[4]                         c. scores[2]                   d. scores[0]
  1. An Array can easily be stepped through by using a:
  1. Named constant               b. for loop                 c. reference value            d. none
  1. What will the following c++ code display?

int numbers[]={99,87,66,55,101};

for(int i=1; i<4; i++)

      {

         cout<<setw(5)<<numbers[i];

}

87   66   55              b. 99    87   66   55        c. 87   66   55    101      d. 66      55   101    

Homework Answers

Answer #1

Ans1) Correct Option - (d) A hex value

Explaination :- Array name always stores the address of the first block.

Ans2) Correct Option - (d) A space

Explanation :- There is no character at that postion

Ans3) Correct Option - (c) the letter

Explanation :- Letter t is present at index 6

Ans4 Correct Option - (d) 1

Explanation :- Number 1 is present at table[2][1]

Ans5 Correct Option - (b) 19

Explanation :- The size of the string is 19

Ans6 Correct Option -(d) int numbers[100]

Explanation :- The syntax of varibale declaration is data_type variable_name;

Ans7 Correct Option - (c) Rows, columns

Explanation :- Two dimensional array consists of rows and columns.

Ans8 Correct Option - (b) int score[10];

Explanation :- Syntax of array declaration in C++ is data_type array_name[size]

Ans9 Correct Option - (c) scores[2]

Explanation :- Number 77 is stored at index 2

Ans10 Correct Option - (b) for loop

Explanation :- Usually for loops are being used for arrays

Ans11 Correct Option - (a) 87 66 55

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics relating to data supplied by the user. The program will ask the user to enter the number of items making up the data. It will then ask the user to enter data items one by one. It will store the data items in a double array. Then it will perform a number of statistical operations on the data. Finally, it will display a report...
C++ #include<iostream> #include<string> #include<fstream> #include<cstdlib> using namespace std; const int ROWS = 8; //for rows in...
C++ #include<iostream> #include<string> #include<fstream> #include<cstdlib> using namespace std; const int ROWS = 8; //for rows in airplane const int COLS = 4; void menu(); //displays options void displaySeats(char[][COLS]); void reserveSeat(char [ROWS][COLS]); int main() { int number=0; //holder variable char seatChar[ROWS][COLS]; for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLS; j++) { seatChar[i][j] = '-'; } } int choice; //input from menu bool repeat = true; //needed for switch loop while (repeat...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
Please follow ALL the instructions and solve it by C++. Please and thank you! There are...
Please follow ALL the instructions and solve it by C++. Please and thank you! There are two ways to write loops: (1) iterative, like the for-loops we're used to using, and (2) recursive. Your prerequisite preparation for this course should have exposed you to both, although your working knowledge of recursive loops may not be as strong as that of iterative loops. Consider the following iterative function that prints an array of characters backward: #include <iostream> #include <cstring> // print...
I tried using the modulo to skip the chars but I doesnt work in some cases....
I tried using the modulo to skip the chars but I doesnt work in some cases. There are two ways to write loops: (1) iterative, like the for-loops we're used to using, and (2) recursive. Your prerequisite preparation for this course should have exposed you to both, although your working knowledge of recursive loops may not be as strong as that of iterative loops. Consider the following iterative function that prints an array of characters backward: #include #include // print...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
There are two ways to write loops: (1) iterative, like the for-loops we're used to using,...
There are two ways to write loops: (1) iterative, like the for-loops we're used to using, and (2) recursive. Your prerequisite preparation for this course should have exposed you to both, although your working knowledge of recursive loops may not be as strong as that of iterative loops. Consider the following iterative function that prints an array of characters backward: #include <iostream> #include <cstring> // print an array backwards, where 'first' is the first index // of the array, and...
q : explain the code for a beginner in c what each line do Question 2....
q : explain the code for a beginner in c what each line do Question 2. The following code defines an array size that sums elements of the defined array through the loop. Analyze the following code, and demonstrate the type of error if found? What we can do to make this code function correctly ? #include <stdio.h> #define A 10 int main(int argc, char** argv) { int Total = 0; int numbers[A]; for (int i=0; i < A; i++)...
Using the following code perform ALL of the tasks below in C++: ------------------------------------------------------------------------------------------------------------------------------------------- Implementation: Overload input...
Using the following code perform ALL of the tasks below in C++: ------------------------------------------------------------------------------------------------------------------------------------------- Implementation: Overload input operator>> a bigint in the following manner: Read in any number of digits [0-9] until a semi colon ";" is encountered. The number may span over multiple lines. You can assume the input is valid. Overload the operator+ so that it adds two bigint together. Overload the subscript operator[]. It should return the i-th digit, where i is the 10^i position. So the first...