Back-End Programming Exam  >  Back-End Programming Tests  >  Test: Arrays - 1 - Back-End Programming MCQ

Test: Arrays - 1 - Back-End Programming MCQ


Test Description

10 Questions MCQ Test - Test: Arrays - 1

Test: Arrays - 1 for Back-End Programming 2024 is part of Back-End Programming preparation. The Test: Arrays - 1 questions and answers have been prepared according to the Back-End Programming exam syllabus.The Test: Arrays - 1 MCQs are made for Back-End Programming 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Arrays - 1 below.
Solutions of Test: Arrays - 1 questions in English are available as part of our course for Back-End Programming & Test: Arrays - 1 solutions in Hindi for Back-End Programming course. Download more important topics, notes, lectures and mock test series for Back-End Programming Exam by signing up for free. Attempt Test: Arrays - 1 | 10 questions in 20 minutes | Mock test for Back-End Programming preparation | Free important questions MCQ to study for Back-End Programming Exam | Download free PDF with solutions
Test: Arrays - 1 - Question 1

Which of the following correctly declares an array?

Detailed Solution for Test: Arrays - 1 - Question 1

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

Test: Arrays - 1 - Question 2

In C Programming, If we need to store word “INDIA” then syntax is as below –
char name[];
name = “INDIA”

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Arrays - 1 - Question 3

What is output?

# include <stdio.h>
 
void print(int arr[])
{
   int n = sizeof(arr) / sizeof(arr[0]);
   int i;
   for (i = 0; i < n; i++)
      printf("%d ", arr[i]);
}
 
int main()
{
   int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
   print(arr);
   return 0;
}

Test: Arrays - 1 - Question 4

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

Detailed Solution for Test: Arrays - 1 - Question 4

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

Test: Arrays - 1 - Question 5

What will be the output of the following code?

#include"stdio.h"
void main()
{
      int a[10];
      printf("%d %d", a[-1], a[12]);
}

Test: Arrays - 1 - Question 6

Assume the following C variable declaration
int *A [10], B[10][10]; 
Of the following expressions I A[2] II A[2][3] III B[1] IV B[2][3] which will not give compile-time errors if used as left hand sides of assignment statements in a C program (GATE CS 2003)?

Detailed Solution for Test: Arrays - 1 - Question 6

Test: Arrays - 1 - Question 7

What is the output of this program?

#include < stdio.h >

using namespace std;

int main()

{

int array[] = {10, 20, 30};

cout << -2[array];

return 0;

}

Detailed Solution for Test: Arrays - 1 - Question 7

It’s just printing the negative value of the concern element.

Test: Arrays - 1 - Question 8

What is the maximum number of dimensions an array in C may have?

Test: Arrays - 1 - Question 9

Predict the output of the below program:

#include <stdio.h>
#define SIZE(arr) sizeof(arr) / sizeof(*arr);

void fun(int* arr, int n)

{
    int i;
    *arr += *(arr + n - 1) += 10;
}

void printArr(int* arr, int n)

{
    int i;
    for(i = 0; i < n; ++i)
        printf("%d ", arr[i]);
}

int main()

{

    int arr[] = {10, 20, 30};
    int size = SIZE(arr);
    fun(arr, size);
    printArr(arr, size);
    return 0;

}

Detailed Solution for Test: Arrays - 1 - Question 9

The crux of the question lies in the expression: *arr += *(arr + n - 1) += 10; The composite operator (here +=) has right to left associativity. First 10 is added to the last element of the array. The result is then added to the first element of the array.

Test: Arrays - 1 - Question 10

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

Detailed Solution for Test: Arrays - 1 - Question 10
  • So here the last element is 9 so the index will be

        size =9;

      array-index of last element is = 9-1

        =  8.

Information about Test: Arrays - 1 Page
In this test you can find the Exam questions for Test: Arrays - 1 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Arrays - 1, EduRev gives you an ample number of Online tests for practice
Download as PDF