C++ Programming
ARRAYS MCQs
Total Questions : 10
It's just printing the negative value of the concern element.
$ g++ array.cpp
$ a.out
-30
We are just printing the values of first 3 values.
$ g++ array.cpp
$ a.out
ABC
The conversion is invalid in this array. So it will arise error. The following compilation error
will be raised:
cannot convert from 'int *' to 'int'
We are adding all the elements in the array and printing it. Total elements in the array is 7, but
our for loop will go beyond 7 and add a garbage value.
What will be the output of this program?
1.
#include
2.
using namespace std;
3.
int array1[] = {1200, 200, 2300, 1230, 1543};
4.
int array2[] = {12, 14, 16, 18, 20};
5.
int temp, result = 0;
6.
int main()
7.
{
8.
for (temp = 0; temp < 5; temp++) {
9.
result += array1[temp];
10.
}
11.
for (temp = 0; temp < 4; temp++) {
12.
result += array2[temp];
13.
}
14.
cout
In this program we are adding the every element of two arrays. Finally we got output as 6533.
Output:
$ g++ array.cpp
$ a.out
6533
The array location starts from zero, So it can accessed by array[6].
Because the first element always starts at 0. So it is on 8 position.
Because array variable and values need to be declared after the datatype only.
None.
None.
Recent Questions
Q. The Value Engineering Technique In Which Experts Of The Same....
Q. If Transcription Should Not Be Carried Out Beyond The Insert....
Q. Buffalo Is To Leather As Llama Is To....?
Q. Choose The Correct Answer From The Given Options To Fill The....
Q. The Arithmetic Mean (average) Of The First 10 Whole Numbers ....
Q. Which Governor General Is Remembered For The Annulment Of Th....
Q. When The Voltage Across A Capacitor Is Tripled, The Stored C....
Q. My Mother Bakes Cakes.
Q. Log Mean Temperature Difference In Case Of Counter Flow Comp....
Q. Which Of The Following Is Not A Matter Of Local Government?
Q. Which Drugs Can Easily Pass The Placental Barrier?
Q. Which Of The Following Is Not A Benefit Of BLAST?
Q. A Part Of John's Salary Was Cut By The Government. What....
Q. The Swollen Part Of The Pistil Is Known As ________ .
Q. By Definition, Make A Map Is To Select Certain Features As R....
Q. Which Of The Following Is The Best Tube Material From Therma....
Q. If You Are Going To Use A Combination Of Three Or More AND A....
Q. (a) A Ball Is Dropped From A Height Of 30m. After Striking T....
Q. What Is The Approx. Value Of W, If W=(1.5)11, Given Log2 = 0....
Q. In The Following Questions, The Symbols $, ©, *, @ And # Ar....