Cosa si intende per caso base in una funzione ricorsiva?

Funzioni Ricorsive

Quiz
•
Computers
•
12th Grade
•
Hard
F M
FREE Resource
24 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
La chiamata finale alla funzione
Il parametro della funzione
La condizione in cui la funzione smette di chiamare sé stessa
Il tipo di ritorno della funzione
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In una funzione ricorsiva, quale delle seguenti affermazioni è vera?
Il caso ricorsivo viene eseguito per primo
Il caso base deve essere evitato
Il caso base impedisce la ricorsione infinita
La ricorsione si ferma dopo 5 chiamate
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cosa sono i parametri formali in una funzione?
I valori passati dal main
Le variabili locali
Le variabili dichiarate tra parentesi tonde nella definizione della funzione
Le costanti
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual è la relazione tra parametri attuali e formali?
Non c'è nessuna relazione
I parametri attuali inizializzano quelli formali
Sono la stessa cosa
I parametri formali vengono passati come costanti
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Il codice seguente rappresenta una funzione ricorsiva corretta:
int funzione(int n) {
if (n <= 0)
return 0;
else
return funzione(n);
}
Sì
No, manca il caso base
No, la funzione non termina
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Completare la funzione somma per sommare i primi N interi:
int somma(int N) {
if (N == 0)
return 0;
else
return ___________;
}
N + somma(N)
N + somma(N - 1)
somma(N - 1)
N * somma(N - 1)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cosa restituisce somma(3) con questa funzione?
int somma(int N) {
if (N == 0) return 0;
else return N + somma(N - 1);
}
3
6
0
9
Create a free account and access millions of resources
Similar Resources on Quizizz
20 questions
EXCEL

Quiz
•
12th Grade
20 questions
C++ Chapter 6 Review - Functions

Quiz
•
10th Grade - University
20 questions
Java, part I

Quiz
•
11th Grade - University
20 questions
Java Values and datatypes

Quiz
•
9th - 12th Grade
20 questions
Functions

Quiz
•
9th - 12th Grade
19 questions
Unit 5 - Two-Dimensional Arrays

Quiz
•
9th - 12th Grade
20 questions
function in python

Quiz
•
12th Grade
20 questions
APCS A - Array 6.1,6.2,6.3,6.

Quiz
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade