Funcţia F are definiţia alăturată. Ce valoare are F(3)?
int F(int n)
{
if(n==0 || n==1) return 1;
else
return 2*F(n-1)+2*F(n-2);
}
Evaluare_recursivitate_XI
Quiz
•
Education
•
11th Grade
•
Medium
Carmen Preoteasa
Used 5+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Funcţia F are definiţia alăturată. Ce valoare are F(3)?
int F(int n)
{
if(n==0 || n==1) return 1;
else
return 2*F(n-1)+2*F(n-2);
}
1
12
6
10
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Subprogramul f are definiţia alăturată. Ce se va afişa în urma apelului f(12345);?
void f(long n)
{
if (n>9)
{cout<<n/100;
f(n/10);
}
}
1231210
123121
1234123121
123
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Ce valoare are f(100)?
int f(int n)
{ if(n==0) return 0; else return n%2+f(n/2); }
16
3
10
30
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Pentru subprogramul suma definit alăturat, scrieţi valoarea expresiei suma(5,4).
int suma (int a,int b)
{ if (a==0 && b==0) return 0;
else
if (a==0) return 1+suma(a,b-1);
else return 1+suma(a-1,b);
}
10
20
9
18
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Se consideră subprogramul recursiv f1 definit alăturat. Ce se va afişa în urma apelului f1(5);?
void f1(int x)
{ if (x<=9)
{ cout<<x+1;
f1(x+2);
cout<<x+3;
}
}
68101
681012108
2108
68112108
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Subprogramul re este definit alăturat. Ce valoarea are re(1)? Dar re(14)?
int re(int i)
{ if (i<9) return 3+re(i+2);
else
if (i==9) return -2;
else return 1+re(i-1);
}
re(1)=10 re(14)=3
re(1)=3 re(14)=10
re(1)=3 re(14)=3
re(1)=10 re(14)=10
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Considerăm subprogramul f definit alăturat. Ce valoare are f(7,11)? Dar f(11,7)?
int f(int x,int y)
{ if(x<=y) return x-y; return f(y-x,x-1)+3; }
f(7,11)=-14 f(11,7)=-11
f(7,11)=-11 f(11,7)=-4
f(7,11)=-2 f(11,7)=-10
f(7,11)=-4 f(11,7)=-11
8.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Se consideră subprogramul f definit alaturat. Ce se afişează la apelul f(1)?
void f(int i)
{
if(i<=5){
cout<<i<<” ” ;
f(i+1);
cout<<i/2<<” ”;
}
1 2 3 4 5 2 1 0
1 2 3 4 5 2 2 1 1 0
1 2 3 4 5
2 2 1 1 0
9.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Ce valoare are expresia f(1)+f(5)+f(15)?
int f(int n)
{ if (n>20) return 0; else return 5+f(n+5); }
0
50
100
25
13 questions
python для новичков
Quiz
•
4th - 11th Grade
10 questions
Bab 3.1.2 ASK T2
Quiz
•
1st - 12th Grade
6 questions
Урок 18: вспомнить пройденное
Quiz
•
6th - 11th Grade
10 questions
UH Seni Budaya Bab 2 (KM)
Quiz
•
9th - 12th Grade
6 questions
Tin nhóm 7
Quiz
•
11th Grade
11 questions
Conocimientos sobre Arduino y Sensores
Quiz
•
8th Grade - University
6 questions
Increment/Decrement
Quiz
•
9th - 12th Grade
5 questions
whileLoop
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