Search Header Logo

Arrays and Functions

Authored by Ansgar Meroth

Computers

University

Used 90+ times

Arrays and Functions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you initialize an array in C?

int arr[3] = (1,2,3);

int arr(3) = {1,2,3};

int arr[3] = {1,2,3};

int arr(3) = (1,2,3)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid C++ array definition?

int scores [0];

float $payments [10];

int readings [4.5];

int scores [10];

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To assign the contents of one array to another, you must use

the assignment operator with the array names

the equality operator with the array names

a loop to assign the elements of one array to the other array

Any of these

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of C Program.?

int main()

{

char grade[] = {'A','B','C'};

cout << "GRADE="<< *grade<< ", GRADE="<< grade;

}

GRADE=some address of array, GRADE=A

GRADE=A, GRADE=some address of array

GRADE=A, GRADE=A

Compiler error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of C Program.?

int main() {

int a[3] = {10,12,14};

a[1]=20;

int i=0;

while(i<3)

{ cout << a[i] << " ";

i++; }

}

20 12 14

10 20 14

10 12 20

Error

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

When passing an array from the main to a sub-program, would you pass this by reference or by value?

Reference

Value

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

A variable created inside the function has_____ scope.

local

global

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?