11. Quyidagi dasturda xatosi qaysi qatorda ? using System;
class Test {
public void MTest() {
Console.WriteLine("Harakat boshlanmadi");}
public int MTest(int t, int v) {
Console.Write(t+" soat vaqtda "+v+" tezlik bilan: ");
return v*t;}
public double MTest(int t, int v, int a) {
Console.Write(t+" soat vaqtda "+v+" boshlangich tezlik bilan "+a+" tezlanishda: ");
return v*t+a*t*t/2;}
Dasturlash tillari va axborot-kommunikatsiya texnologiyalari 1-semestr
310
public static void Main(){
Test ob1=new Test();
int yul;
ob1.MTest();
yul=ob1.MTest(2,10); Console.WriteLine(yul+" yulni yurdi");
yul=ob1.MTest(2,10,2); Console.WriteLine(yul+" yulni yurdi");}}
A) 10
B)15
C) 23
D) xatolik bermaydi
E) 17
12. b1=1; b2=-1; bk=bk-2+bk-1 k=3,4,… ko‘rinishdagi ketma ketlikni xosil qilish rekursiya funksiyasi A) public void recurs(int k) {
int b;
if (k==1) return 1; if (k==2) return -1;
b=recurs(k-2)+ recurs(k-1);
return b;}
B) public int recurs(int k) {
int b;
if (k==1) return 1; if (k==2) return -1;
b=recurs(k-2)+ recurs(k-1);
return b;}
C) public int recurs(int k) {
int b;
if (k==1) return 1;
else if (k==2) return -1;
else b=recurs(k-2)+ recurs(k-1);
return b;}
D) public int recurs(int k) {
int b;
if (k==1) return 1;
else if (k==2) return -1;
b=recurs(k-2)+ recurs(k-1);
return b;}
E) public int recurs(int k) {
int b;
if (k==1) return 1;
else return -1;
b=recurs(k-2)+ recurs(k-1);
return b;}
13. Quyidagi dasturda xatosi qaysi qatorda ?
Dasturlash tillari va axborot-kommunikatsiya texnologiyalari 1-semestr
311
class Test {
public int x;
public static int mymeth1(Test ob){
return ob.x/5;}
public static void mymeth2(){
x=30; Console.Write(mymeth1(x));}}
A) 5
B) 4
C) 6
D) 3
E) 2