Subprogramul f este definit mai jos.
long f(int n)
{
if(n<=0) return 0;
else return f(n-1)+2*n;}
Dacă f(x) are valoarea 10100, care este valoarea lui x?
Recursivitate
Quiz
•
Computers
•
10th - 11th Grade
•
Hard
Eugenia-Maria Ohota
Used 12+ times
FREE Resource
20 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
2 mins • 1 pt
Subprogramul f este definit mai jos.
long f(int n)
{
if(n<=0) return 0;
else return f(n-1)+2*n;}
Dacă f(x) are valoarea 10100, care este valoarea lui x?
2.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Subprogramul f este definit mai jos.
long f(int n){
if(n<=0) return 0;
else return f(n-1)+n;}
Ce se afișează la apelul f(10)
10
55
0
110
3.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Subprogramul f este definit mai jos.
long f(int n){
if(n<=0) return 0;
else return f(n-1)+1;}
Ce se afișează la apelul f(10)
10
55
0
110
4.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Considerăm subprogramul f, definit mai jos. Care va fi valoarea variabilei globale x după apelul f(4962,x), dacă înainte de apel, x are valoarea 0?
void f(int n,int &a)
{int c;
if(n!=0){ c=n%10; if(a<c) a=c;
f(n/10,a); }}
0
2
9
4
5.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
Considerăm subprogramul f, definit mai jos. Care va fi valoarea variabilei globale x după apelul f(4962,x), dacă înainte de apel, x are valoarea 100?
void f(int n,int &a)
{int c;
if(n!=0){ c=n%10; if(a<c) a=c;
f(n/10,a); }}
100
2
9
4
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Se consideră subprogramul f, definit mai jos. Indicați ce valoare are f(15, 25).
int f(int a,int b)
{ if (b==0) return a;
else return f(b,a%b);
}
15
10
5
0
7.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Se consideră subprogramul f, definit mai jos.
int f(int x)
{ if(x<=0)
return 0;
return x+f(x-5);
}
Care este rezultatul apelului f(20)?
20 questions
Arrays in Java
Quiz
•
9th - 12th Grade
17 questions
Elementele de bază ale limbajului C++
Quiz
•
10th Grade
16 questions
Structuri repetitive în C++
Quiz
•
9th - 12th Grade
20 questions
Array
Quiz
•
10th - 12th Grade
15 questions
Intro to Java Loops
Quiz
•
9th - 12th Grade
15 questions
Struktur Kontrol Perulangan, Array, dan Function (Bahasa C)
Quiz
•
10th Grade
18 questions
Pemrograman C++ (Dasar)
Quiz
•
11th Grade
15 questions
Structuri neomogene
Quiz
•
9th - 12th Grade
10 questions
Chains by Laurie Halse Anderson Chapters 1-3 Quiz
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
12 questions
Multiplying Fractions
Quiz
•
6th Grade
30 questions
Biology Regents Review #1
Quiz
•
9th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
14 questions
Attributes of Linear Functions
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University
50 questions
Biology Regents Review 2: Ecology
Quiz
•
9th - 12th Grade
20 questions
Investing
Quiz
•
9th - 12th Grade