Exploring 1D Array Loops

Exploring 1D Array Loops

University

5 Qs

quiz-placeholder

Similar activities

Expression in C Programming

Expression in C Programming

University

10 Qs

C++ Array Quick Review

C++ Array Quick Review

University

10 Qs

C Find Output - 1

C Find Output - 1

University

10 Qs

C programming

C programming

11th Grade - University

10 Qs

Java Arrays

Java Arrays

University

10 Qs

TECHNICAL C PROGRAM

TECHNICAL C PROGRAM

University

10 Qs

Array in C

Array in C

University

10 Qs

cp06-01-1D-Array

cp06-01-1D-Array

University

10 Qs

Exploring 1D Array Loops

Exploring 1D Array Loops

Assessment

Quiz

Computers

University

Hard

Created by

Bhawna Suri

Used 7+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is a 1D array?

A 1D array is a linear collection of elements accessed by a single index.

A 1D array requires multiple indices to access elements.

A 1D array can only store integers.

A 1D array is a two-dimensional structure.

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Write a loop to print all elements of a 1D array of length N in C

int i = 1;

while( i <N) { printf("%d\n",array[i]); }

int i = 0;

while(i < N) { printf("%d",array[i++]); }

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

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

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How can you find the length of a 1D array in C?

length = sizeof(array) / sizeof(array[0])

length = count(array)

length = array.length()

length = sizeof(array)

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output of the following code snippet: int arr[] = {1, 2, 3}; for(int i=0; i<3; i++) { printf("%d ", arr[i]); }?

1 2 3

3 2 1

1 2

2 3 4

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

void checkEvenOrNot(int num)

{

    if (num % 2 == 0)

        goto even;

else

       goto odd;

  

even:

    printf("%d is even", num);   return;

odd:

    printf("%d is odd", num); }

  

int main()

{

    int num = -2;

    checkEvenOrNot(num);

    return 0;

}

Output

error

-2 is even

-2 is odd

none of the above