Which of the following is correct declaration of array in C/C++?
In C/C++, what will be the index number of the last element of an array with 9 elements?
What is an array in C/C++?
Which of the following accesses the seventh element stored in a C array?
Which of the following gives the memory address of the first element in array in C/C++?
What will be the output of this C++ program?
#include<iostream>
using namespace std;
int array1[] = {1200, 200, 2300, 1230, 1543};
int array2[] = {12, 14, 16, 18, 20};
int temp, result = 0;
int main()
{
for (temp = 0; temp < 5; temp++)
{
result += array1[temp];
}
for (temp = 0; temp < 4; temp++)
{
result += array2[temp];
}
cout << result;
return 0;
}
What will be the output of the this C++ program?
#include <iostream>
using namespace std;
int main ()
{
int array[] = {0, 2, 4, 6, 7, 5, 3};
int n, result = 0;
for (n = 0; n < 8; n++) {
result += array[n];
}
cout << result;
return 0;
}
What will be the output of below C++ program?
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 15;
int arr[3] = {&a, &b, &c};
cout << *arr[*arr[1] - 8];
return 0;
}
What will be the output of this C++ program?
#include <iostream>
using namespace std;
int main()
{
int array[] = {10, 20, 30};
cout << -2[array];
return 0;
}
How to create a dynamic array of pointers (to integers) of size 10 using new in C++?
Which is correct way to initialize array in C/C++?
What will be the output of this C program ?
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1]; //s1
j = a[1]++; //s2
m = a[i++]; //s3
printf("%d, %d, %d", i, j, m);
}
What will be the output of following C code?
#include <stdio.h>
int main(void)
{
char p;
char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8};
p = (buf + 1)[5];
printf("%d", p);
return 0;
}
In C/C++ ,array elements are always stored in ________ memory locations.
Which of the following operations cannot be performed on an array arr in C/C++?
I. ++arr
II. arr+1
III. arr++
IV. arr*2
What is the maximum number of dimensions an array in C can have?
In C/C++, we need to explicitly write size of an array, when _________________
What will be printed after execution of the following C code?
#include<stdio.h>
int main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}
What will be the output of the following C code?
#include<stdio.h>
int main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
When we pass array name as the argument in a function, what exactly is passed to the function in C/C++?
What will be the output of this C program if the array begins at 65472 and each integer occupies 2 bytes?
#include<stdio.h>
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u", a+1, &a+1);
}
What will be the output of this C program ?
#include<stdio.h>
int main()
{
float arr[ ] = {12.4, 2.3, 4.5, 6.7};
printf("%d", sizeof(arr)/sizeof(arr[0]));
}