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 Wayground
20 questions
Matrici in C++ [1]

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

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

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

Quiz
•
9th - 12th Grade
23 questions
Java conditional/loop/method/user input

Quiz
•
9th - 12th Grade
20 questions
Basic Python

Quiz
•
10th - 12th Grade
20 questions
DATA STRUCTURES

Quiz
•
12th Grade
20 questions
11900程1-20

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade