Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Programming and Data Structures  >  Test: Arrays - 1 - Computer Science Engineering (CSE) MCQ

Test: Arrays - 1 - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test Programming and Data Structures - Test: Arrays - 1

Test: Arrays - 1 for Computer Science Engineering (CSE) 2024 is part of Programming and Data Structures preparation. The Test: Arrays - 1 questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Arrays - 1 MCQs are made for Computer Science Engineering (CSE) 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 Programming and Data Structures for Computer Science Engineering (CSE) & Test: Arrays - 1 solutions in Hindi for Programming and Data Structures course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Arrays - 1 | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Programming and Data Structures for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Arrays - 1 - Question 1

How do you initialize an array in C?

Detailed Solution for Test: Arrays - 1 - Question 1

This is the syntax to initialize an array in C.

Test: Arrays - 1 - Question 2

Which of the following is the correct way to declare a multidimensional array in Java?

Detailed Solution for Test: Arrays - 1 - Question 2

The syntax to declare multidimensional array in java is either int[][] arr; or int arr[][];

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

LB are UB are lower bound and upper bound of a linear array LA. Consider following algorithm -

  1. Repeat for K = LB to UB apply PROCESS to LA [K]
  2. Exit

The algorithm ______ the array LA.

Detailed Solution for Test: Arrays - 1 - Question 3

LB refers to the lower bound of an array ( first index element of an array ) and UB refers to the upper bound of an array, that is the last index of an array. 

Let's take an example to understand this - 
Array - [2,6,7,0,15], where 2 is the lower bound and 15 is the upper bound element.

The K is the variable that holds the index of the array. While the LA is the name of the array. A loop is used to visit to traverse the elements from LB to UB.

The K holds the index of element 2 which is 0 and reaches index 4 of element 15.

The LA array using K traverse all the elements in the array. So, Option 2 will be the answer. 

Test: Arrays - 1 - Question 4

In C, how do you properly initialise an array?

Detailed Solution for Test: Arrays - 1 - Question 4

Array:
An array is a group of data components that are stored in the same memory region at the same time. It is the most basic data structure, in which each data piece may be retrieved simply by its index number alone.

Array initialize:
Only square brackets [ ] must be used for declaring an array. The given {}, () are not useful for array initialization.
int arr[5]={11,12,15,16,19} is correct.
The above statement can store the 5 elements in a continuous manner. consider the array base address is 100.

Hence the correct answer is  int arr[5]={11,12,15,16,19}.

Test: Arrays - 1 - Question 5

What is the output of the following Java code?

public class array
{
    public static void main(String args[])
    {
        int []arr = {1,2,3,4,5};
        System.out.println(arr[5]);
    }
}

Detailed Solution for Test: Arrays - 1 - Question 5

Trying to access an element beyond the limits of an array gives ArrayIndexOutOfBoundsException.

Test: Arrays - 1 - Question 6

Which of the following concepts make extensive use of arrays?

Detailed Solution for Test: Arrays - 1 - Question 6

 Whenever a particular memory location is referred to, it is likely that the locations nearby are also referred, arrays are stored as contiguous blocks in memory, so if you want to access array elements, spatial locality makes it to access quickly.

Test: Arrays - 1 - Question 7

Consider the following array declaration in ‘C’ language:

int array[] = {2, 3, 4, 5};

What will be the output of the following statement?

printf("%d", array[2]);

Detailed Solution for Test: Arrays - 1 - Question 7

An array is defined as the collection of similar types of data items stored at contiguous memory locations. Arrays are the derived data type in C programming language which can store the primitive type of data such as int, char, double, float, etc. C array is beneficial if you have to store similar elements.

int array[] = {2, 3, 4, 5}; This array storage be like, 

The above array at index I can be accessed by, a[i], i[a], *(a+i) or *(i+a) all the above representations all are equal and gives the i th index value.

printf(%d', 2[array]); So, it gives the 2nd  index value. i.e 4.

Hence the correct answer is 4.

Test: Arrays - 1 - Question 8

Consider the following declaration of an array in ‘C’ language:

int A[6] = {1, 2, 3, 5};

Which of the following statements is true?

Detailed Solution for Test: Arrays - 1 - Question 8

Array name: A

To access 3rd element in an array A[2] or 2[A] is used.  Therefore Both A[2] and 2[A] represent the value 3

Test: Arrays - 1 - Question 9

What are the disadvantages of arrays?

Detailed Solution for Test: Arrays - 1 - Question 9

Arrays are of fixed size. If we insert elements less than the allocated size, unoccupied positions can’t be used again. Wastage will occur in memory.

Test: Arrays - 1 - Question 10

Find the number of elements in the following array.

char si [] = "India is great";

Detailed Solution for Test: Arrays - 1 - Question 10

char si [] = "India is great";

The above declaration is a dynamic allocation of array name si of character datatype.

Hence the correct answer is 15.

119 docs|30 tests
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

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)