I bob. Kompyuterning mantiqiy ishlash prinsipi


IV BOB. DASTURLASH ASOSLARI


Download 223.92 Kb.
bet5/7
Sana30.04.2023
Hajmi223.92 Kb.
#1402362
1   2   3   4   5   6   7
Bog'liq
informatika-test-9 (1)

IV BOB. DASTURLASH ASOSLARI



11. Dastur natijasini kо‘rsating.


x = 0

a = 0

b = -5

if a > 0:

if b < 0:


x = x + 5


elif a > 5:


x = x + 4


else:

x = x + 3

else:

x = x + 2

print(x)



A) 2;


B) 0;


C) 3;


D) 4.

12. Dastur natijasini kо‘rsating.


x = 0

while (x < 100):

x+=2

print(x)


A) 101;


B) 99;


C) 100;


D) 98.

13. Dastur natijasini kо‘rsating.


a, b = 12, 5


if a + b:


print(‘True’)


else:

print(‘False’)


A) False;


B) True;


C) 0;


D) 11.

14. Dastur natijasini kо‘rsating.


x = 0

a = 5

b = 5

if a > 0:

if b < 0:


x = x + 5


elif a > 5:


x = x + 4


else:

x = x + 3

else:

x = x + 2

print(x)



A) 0;


B) 4;


C) 2;


D) 3.

15. Dastur natijasini kо‘rsating.


for num in range(2,-5,-1):


print(num, end=”, “)




A) 2, 1, 0


B) 2, 1, 0, -1, -2, -3, -4, -5


C) 2, 1, 0, -1, -2, -3, -4


D) 1, 0, -1, -2, -3, -4

16. Dastur natijasini kо‘rsating.


for num in range(10, 14):


for i in range(2, num):


if num%i == 1:


print(num)


break



A) 10

11


12

13


B) 11

13


C) 10

11


D) 10

11


12

9-sinf informatika va axborot texnologiyalari


IV BOB. DASTURLASH ASOSLARI



17. Dastur natijasini kо‘rsating.


for num in range(-2,-5,-1):


print(num, end=”, “)


A) -2, -1, -3, -4


B) -2, -1, 0, 1, 2, 3


C) -2, -1, 0


D) -2, -3, -4


18. Dastur natijasini kо‘rsating.


var = 10

for i in range(10):

for j in range(2, 10, 1):


if var % 2 == 0:


continue

var += 1

var+=1

else:

var+=1

print(var)

A) 20;

B) 21;

C) 10;

D) 30.

19. Dastur natijasini kо‘rsating.


x = 0

for i in range(10):

for j in range(-1, -10, -1):


x += 1

print(x)

A) 99;

B) 90;

C) 100;

D) 85.



  1. Quyidagi funksiyalardan qaysi biri takrorlanuvchi obyektni qaytaradi?



A) len()


B) xrange()


C) range()


D) ord()

21. Quyidagi kod natijasini kо‘rsating.


for i in range(10, 15, 1):


print( i, end=’, ‘)


A) 10, 11, 12, 13, 14


B) 10, 11, 12, 13, 14, 15


C) 9, 10, 11, 12, 13, 14


D) 9, 10, 11, 12, 13, 14, 15


22. Quyidagi kod natijasini kо‘rsating.


p, q, r = 10, 20 ,30


print(p, q, r)


A) 10 20

B) 10 20 30


C) Error: invalid syntax

D) 10




  1. Quyidagi kod natijasini kо‘rsating: def a(b, c, d): pass



A) ro‘yxatni e’lon qiladi va uni ishga tushiradi;


B) hech narsa bajarmaydigan funksiyani e’lon qiladi;


C) parametrlarni uzatadigan funksiyani e’lon qiladi;


D) bo‘sh sinfni e’lon qiladi.
24. Quyidagi kod natijasini kо‘rsating.

def calculate (num1, num2=4): res = num1 * num2 print(res)


calculate(5, 6)


A) 20;



B) dastur xatolik qaytaradi;

C) 30;

D) 40.



9-sinf informatika va axborot texnologiyalari



Download 223.92 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling