
Evaluare_recursivitate_XI
Authored by Carmen Preoteasa
Education
11th Grade
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Creative thinking and problem solving
Quiz
•
10th - 12th Grade
10 questions
AUTOcad @2D HM
Quiz
•
11th Grade
10 questions
CSS 4th Grading Quiz
Quiz
•
9th - 12th Grade
11 questions
Mr. Martin Multiview Exercise #4 -CTE DEPARTMENT
Quiz
•
9th - 12th Grade
12 questions
Horse Tack!
Quiz
•
KG - 12th Grade
10 questions
Unia Europejska
Quiz
•
KG - University
14 questions
Cấu trúc rẽ nhánh
Quiz
•
11th Grade
11 questions
Chapter 2 Oral Communication Review
Quiz
•
7th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade