Search Header Logo

Arrays 2022/02/15

Authored by André Carvalho

Computers

10th Grade

Used 6+ times

Arrays 2022/02/15
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int array_exemplo[5];

Esta instrução realiza algo ao array_exemplo. O que se será?

Inicializa o array

Declara o array

insere 5 elementos no array

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int array_exemplo[5];

Os indices deste array variam entre:

1 e 5

5 e 9

0 e 4

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Se pretender inicializar todos os elementos do seguinte array então o que deverá acrescentar ao final da seguinte instrução?

int array_exemplo[5]

= [3,4,6,7,23]

= {20,7,78,89}

= {56,23,34,99,2}

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int array_exemplo[5] = {20 , 30 , 10 , 50 , 40};

for(int i = 0; i < ???? ; i++) {

  cout << i << ": " << array_exemplo[i] << "\n"; }

Se quiser listar no ecrã os valores de todos os elementos do array então qual deverá ser o valor em falta (????) na condição do ciclo FOR?

4

20

5

5.

FILL IN THE BLANK QUESTION

1 min • 1 pt

A ________ de um dado valor x num array é realizada comparando esse valor com o 1º elemento do array e sucessivamente comparando x com cada um dos restantes elementos do array.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Este é um extrato do código para ordenação crescente de um array. Na condição falta o sinal. Qual deverá ser?

>

<

=

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int func( int valor )

{

    int i;

    for (i = 0; i < 5; i++){

        if (array_exemplo[i] == valor)

            return i;}

    return -1;

}

Esta função realiza que operação?

Percorre todos os elementos do array array_exemplo.

Ordena o array array_exemplo.

Pesquisa um valor em 5 elementos do array array_exemplo. Caso encontre então retorna o indice do elemento.

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?