LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C++ Programming
  • Arrays

C++ Programming

ARRAYS MCQs

Total Questions : 10

Question 1.


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int array[] = {10, 20, 30};
6.
cout << -2[array];
7.
return 0;
8.
}


  1.    -15
  2.    -30
  3.    compile time error
  4.    garbage value
 Discuss Question
Answer is Option B. -> -30

It's just printing the negative value of the concern element.
$ g++ array.cpp
$ a.out
-30

Question 2.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char str[5] = "ABC";
6.
cout
  1.    ABC
  2.    ABCD
  3.    AB
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> ABC

We are just printing the values of first 3 values.
$ g++ array.cpp
$ a.out
ABC

Question 3.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 10, c = 15;
6.
int arr[3] = {&a, &b, &c};
7.
cout
  1.    15
  2.    18
  3.    garbage value
  4.    compile time error
 Discuss Question
Answer is Option D. -> compile time error

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'

Question 4.


What will be the output of the this program?



1.
#include
2.
using namespace std;
3.
int main ()
4.
{
5.
int array[] = {0, 2, 4, 6, 7, 5, 3};
6.
int n, result = 0;
7.
for (n = 0; n < 8; n++) {
8.
result += array[n];
9.
}
10.
cout
  1.    25
  2.    26
  3.    27
  4.    None of the mentioned
 Discuss Question
Answer is Option D. -> None of the mentioned

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.

Question 5.


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
  1.    6553
  2.    6533
  3.    6522
  4.    12200
 Discuss Question
Answer is Option B. -> 6533

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

Question 6.

Which of the following accesses the seventh element stored in array?


  1.    array[6];
  2.    array[7];
  3.    array(7);
  4.    array;
 Discuss Question
Answer is Option A. -> array[6];

The array location starts from zero, So it can accessed by array[6].

Question 7.

What is the index number of the last element of an array with 9 elements?


  1.    9
  2.    8
  3.    0
  4.    Programmer-defined
 Discuss Question
Answer is Option B. -> 8

Because the first element always starts at 0. So it is on 8 position.

Question 8.

Which of the following correctly declares an array?


  1.    int array[10];
  2.    int array;
  3.    array{10};
  4.    array array[10];
 Discuss Question
Answer is Option A. -> int array[10];

Because array variable and values need to be declared after the datatype only.

Question 9.

What is a array?


  1.    An array is a series of elements of the same type in contiguous memory locations
  2.    An array is a series of element
  3.    An array is a series of elements of the same type placed in non-contiguous memory locations
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> An array is a series of elements of the same type in contiguous memory locations

None.

Question 10.

Which of the following gives the memory address of the first element in array?


  1.    array[0];
  2.    array[1];
  3.    array(2);
  4.    array;
 Discuss Question
Answer is Option D. -> array;

None.

  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Abstract Classes
  • Access Control
  • Argument Passing
  • Arrays
  • Booleans
  • C++ Concepts
  • Catching Exceptions
  • Character Types
  • Class Hierarchies And Abstract Classes
  • Class Hierarchies Introduction
  • Classes
  • Comments And Indentation
  • Complex Number Type
  • Constants
  • Constructors And Destructors
  • Container Design
  • Conversion Operators
  • Declaration
  • Default Arguments
  • Dereferencing
  • Derivation And Templates
  • Derived Classes
  • Design Of Class Hierarchies
  • Enumerations
  • Error Handling
  • Error Handling Alternatives
  • Essential Operators
  • Exception Specifications
  • Exceptions
  • Exceptions And Efficiency
  • Exceptions That Are Not Errors
  • Floating Point Types
  • Free Store
  • Friends
  • Function Call
  • Function Declarations
  • Function Templates
  • Functions
  • Grouping Of Exceptions
  • Header Files Usage
  • Increment And Decrement
  • Integer Types
  • Large Objects
  • Linkage
  • Macros
  • Modularization And Interfaces
  • Multiple Inheritance
  • Namespaces
  • Objects
  • Objects And Classes
  • Oops Concepts
  • Operator Functions
  • Operators
  • Overloaded Function Names
  • Pointer To Function
  • Pointer To Void
  • Pointers
  • Pointers Into Arrays
  • Pointers To Members
  • References
  • Resource Management
  • Run Time Type Information
  • Sequence Adapters
  • Sequences
  • Simple String Template
  • Sizes
  • Specialization
  • Standard Exceptions
  • Standard Library Design
  • Statements
  • String Class
  • Structures
  • Subscripting
  • Template Arguments To Specify Policy Usage
  • Types
  • Uncaught Exceptions
  • Unspecified Number Of Arguments
  • User Defined Types
  • Value Return
  • Vector
  • Void

Recent Posts

  • Is Ssc Difficult Than Upsc?
  • Quantitative Aptitude Faqs
  • Ssc Exam Guide Book
  • Sail E0 Exam Results Cancelled - Exam Will Be Rescheduled
  • Sail E0 Results 2022
  • Vedic Maths Faq
  • Best Ssc Exam For Girls

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....

Topics

Computer Aptitude
SAIL Junior Officer (E-0)
10th Grade
11th Grade
12th Grade
4th Grade
5th Grade
6th Grade
7th Grade
8th Grade
9th Grade
NCERT
Cat
Commerce
Computer Science
Engineering
English
General Knowledge
Ias
Management
Quantitative Aptitude
Reasoning Aptitude
General Studies (Finance And Economics)
Vedic Maths
Analytical Instrumentation
Biochemistry
Bioinformatics
Biology
Biotechnology
Bitsat
Business Statistics
C Programming
C++ Programming
Cell Biology
Chemistry
Cost Accounting
Drug And Pharmaceutical Biotechnology
Electrical Measurement And Instrumentation
Environment Management
Environmental Biotechnology
Enzyme Technology
Financial Management And Financial Markets
Gate
General Science
Geography
Heat Transfer
History And National Movements
Human Anatomy And Physiology
Human And Cultural Diversity
Human Resource Management
Indian Economy
Indian Geography
Indian History
Indian Polity
Instrumentation Transducers
International Relations
Life Sciences
Marketing And Marketing Management
Mass Transfer
Mechanics Of Materials
Microbiology
Neet
Professional Communication
Renewable Energy
Sociology
Surveying
Total Quality Management
Uidai Aadhaar Supervisor Certification
Virology
LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password