ICT final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

1. Determine Python data types python data types 1) XXX= int,float,str, tuple 2) YYY = list, set, dic

immutable, mutable

1. What will be displayed as an output of the following program? a = 35 b = 18 if a // 9 == 0 and b % 9 == 0: print ('number', a, 'won') else: print ('number', b, 'won') a. Number b won b. Number 35 won c. Number 18 won d. Number a won

Number 18 won

1. What sequence of numbers will a call to the range(1, 8) function give you? a. 1, 2, 3, 4, 5, 6, 7 b. 0, 1, 2, 3, 4, 5, 6, 7 c. 0, 1, 2, 3, 4, 5, 6, 7, 8 d. 1, 2, 3, 4, 5, 6, 7, 8

a. 1, 2, 3, 4, 5, 6, 7

11. What is the output of the given code? a = 5 b = 10 print(a+b) a. 15 b. 510 c. Error d. 0

a. 15

1. Determine output of given code x = 4.5 y = 2 print(x // y) a. 2.0 b. 2.25 c. 9.0 d. 20.25

a. 2.0

Determine output of the code def study (x, y): print (x+y*2) study (y = 1, x = 2) a. 4 b. 5 c. 6 d. Error

a. 4

. The result of the calculation print (24 // 3) will be the number: a. 8 b. 4 c. 12 d. 72

a. 8

11. Which operator is used to split list items? a. : (colon) b. , (comma) c. . (dot)

a. : (colon)

1. What method is? a. A function attached to an object dealt with an object-oriented programming b. A value passed to a function when calling the function c. A function which returns an asynchronous generator iterator

a. A function attached to an object dealt with an object-oriented programming

11. Determine the output of the code a = "A" b = 5 print(b*a) a. AAAAA b. AAAA c. 5A d. Error

a. AAAAA

1. What is indexing? a. Approaching to the data value by using the item index b. Specifying initial value c. Collecting defamiliarized information by indexes

a. Approaching to the data value by using the item index

Select the delete item command a. Del b. .delete c. Insert d. Append

a. Del

1. What is the difference between list and dictionary? a. Dictionary has a key related to the value b. Destiny of two functions c. List is data structure to save vales

a. Dictionary has a key related to the value

1. Determine output of given code Print (type (1 / 2)) a. Float b. Double c. Tuple d. Int

a. Float

1. What is the one type of file that expresses structural data through data text document? a. HTML b. XML c. JSON

a. HTML

1. Put the size of the row and column in for in range and index them to ... a. Identify size of 2 dimensional list b. Print the elements in the list c. Returns row size

a. Identify size of 2 dimensional list

1. Select the code that defines the smallest of the two numbers a and b: a. If a > b: print(b) else: print(a) b. If a > b: print(a) else: print(b) c. If a < b: print(b) else: print(a)

a. If a > b: print(b) else: print(a)

1. Complete line 7 in code below 1 list1 = [1, 2, 3, 4, 5] 2 list2 = [] 3 4 for i in list1: 5 line = [] 6 for j in range(i): 7 XXXX(j) 8 list2.append(line) 9 10 print(list2) [[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4]] a. Line.append b. List1.append c. List.append

a. Line.append

Determine the function of the following syntax: a_list[-2:]​ a. Slicing two items from the end​ b. Slicing entire items from the start except for the last two items​ c. Slicing the first two items in reverse order​

a. Slicing two items from the end​

1. Determine output of given code a = [1, 2, 3, none, a, f] a. Syntax error b. 4 c. 6 d. 9

a. Syntax error

1. Comprehension expression allows to create a list concisely and afficiently a. True b. False

a. True

1. No restrictions are applied to the data types to be included in the list a. True b. False

a. True

11. If an item is deleted the value referred by the key will change in dictionary a. True b. False

a. True

11. The key cannot be duplicated a. True b. False

a. True

Determine the output of the following code: 1 s1 = {1, 2, 3, 4, 5} 2 s2 = {1, 2, 3} s3 = {1, 2, 6} 1 s2.issubset(s1) a. True b. False c. SyntaxError: Invalid syntax

a. True

1. Is it possible to make set from tuple? a. Yes b. No

a. Yes

1. Is it possible using negative index? a. Yes b. Only by using {} c. No

a. Yes

11. If list_array is assigned to list 1 and then the value of list 1 is changed, will the value of list_array also be changed? a. Yes b. No

a. Yes

1. Parameter is... a. a variable defined in the function or method header b. a data type that can store a collection of values c. crucial term in every programming language

a. a variable defined in the function or method header

1. What is used to add new contents to the back of a life that has already been created? a. a+ b. add c. +++

a. a+

If a={1,2,3}, what happens when a.add(1) is executed? a. a={1,2,3} b. a={1,1,2,3} c. Error as 1 already exists in the set

a. a={1,2,3}

1. Fill the gap "Check if there is a value that will be deleted. Delete with the _____ method only if there is a value for deletion a. delete b. remove c. eliminate

a. delete

11. What does the discard(x) method do? a. delete element x from the set b. delete all elements in the set c. add element x to the set

a. delete element x from the set

1. What is function? a. set of codes that performs a specific operation within a program b. number of modules that performs a specific operation within a program c. operations that are used on conditional statements

a. set of codes that performs a specific operation within a program

11. To convert data to text, the function is used: a. string() b. input() c. print() d. int()

a. string()

1. In Python, variables are: a. Numbers you can perform calculations on b. Names that you can assign to different objects and use to reference those objects throughout your code c. Snippets of text that you can display on the screen

b. Names that you can assign to different objects and use to reference those objects throughout your code

11. Which of the following is a mutable data type? a. int b. Set list dictionary c. str

b. Set list dictionary

11. How empty lis is created? a. With // b. With [] c. With {}

b. With []

A term for large capacity data is? a. large data b. big data c. massive data

b. big data

1. What does the "pop" method do? a. returns the list b. deletes the last item c. adds item to the list

b. deletes the last item

What is a variable in this program: print("Please introduce yourself") name="Jean" print("Nice to meet you", name, "!") a. Jein b. name c. 'name' d. print

b. name

Select the true statement about the set a. Sets are unordered b. sets are written with curly brackets {} c. set object does support indexing

b. sets are written with curly brackets {}

11. Characteristics of tuple are: a. simple structure, but slow access speed b. simple structure and quick access speed c. complex structure and quick access speed

b. simple structure and quick access speed

1. In which case the TypeError meseage appears? a. When asterisk output is used b. When parameters are used c. When numbers of arguments are not matching

c. When numbers of arguments are not matching

1. Determine the output of the following code: 1 list1= [11, 22, 33, 44] * 2 2 print(list1) a. [11, 11, 22, 22, 33, 33, 44, 44] b. [22, 44, 66, 88] c. [11, 22, 33, 44, 11, 22, 33, 44]

c. [11, 22, 33, 44, 11, 22, 33, 44]

1. Fill the gaps: "To access the elements of a t-wdoimensional list or allocate values to the elements, use _______ twice after the lisatnd specify a row index and a column ______ within [ ]" a. Method, address b. {}, function c. [], index

c. [], index

Which operators will output 123? a. print(123) b. print('123') c. all three d. print(12, 3, sep="")

c. all three

1. How to get last element of list in python? Suppose we have list with name arr, contains 5 elements. a. arr[0] b. arr[5] c. arr[-1]

c. arr[-1]

1. Where arbitrary parameters are used? a. tuple b. list c. both of them

c. both of them

1. Fill in the gap: "In the list, the values (or items) are distinguished by using a ____ inside the []." a. dot b. slash c. comma

c. comma

Fill in the gap: " List is a Python data structure that can contain multiple items and replace ______ values.​ Supports extraction of ______ values from saved items." a. external; necessary b. internal; necessary c. internal; last

c. internal; last

11. Which is true about tuple? a. Used to store all items in single list b. it can be replaced by dictionary c. it cannot be changed

c. it cannot be changed

1. Which deletes an item from list? a. Split b. Eliminate c. pop

c. pop

Which of the following is not the correct syntax for creating a set? a. set((1,2,3,4)) b. set([1,2,2,3,4]) c. set([[1,2],[3,4]])

c. set([[1,2],[3,4]])

1. What is the output of following: set([1,1,2,3,4,2,3,4]) a. {1,1,2,3,4,2,3,4} b. [1,1,2,3,4,2,3,4] c. {1,2,3,4}

c. {1,2,3,4}

1. Determine the output of the following code: 1 a={3, 4, 5} 2 b={5, 6, 7} 3 a | b a. {5} b. {3,4,6,7} c. {3, 4, 5, 6, 7}

c. {3, 4, 5, 6, 7}

11. If an element is deleted in the list then the referred value changes a. True b. False

False

What is the output of code below? x = 5 print(x == 2) a. True b. False c. 0 d. 2

False

11. The most commonly used standard document for web services is _____

HTML

1. What's the output of the following Python program? # text = "Hi there!" print(text) a. Hi there! b. NameError: name 'text' is not defined c. There's no output

b. NameError: name 'text' is not defined

1. Inside a function assignment statement creates which variable? a. Global b. Double c. Local

c. Local

11. Which deletes an item from list? a. Split b. Eliminate c. Pop

c. Pop

1. Which statement is correct? a. List is immutable and Tuple is mutable b. List is mutable and Tuple is immutable c. Both are mutable

b. List is mutable and Tuple is immutable

1. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? a. 2 b. 25 c. none

b. 25

Determine the output of the following code: 1 nums = set([1, 1, 2, 3, 3, 4, 4]) 2 print(len(nums)) a. 7 b. 4 c. 8

b. 4

1. What is used to add new item to the jugged list? a. + b. Append method c. Adding function

b. Append method

1. It refers to actual value passed when a function or method is called. What is it? a. Function b. Argument c. Module

b. Argument

1. Which is not string methode? a. Count b. Avg c. Both of them

b. Avg

1. Using for with two-dimensional list, return the list of the elements from the last to the first a. True b. False

b. False

1. Which of the following is a Python Tuple? a. {1, 2, 3} b. [1, 2, 3] c. (1, 2, 3)

c. (1, 2, 3)

Symbols for exponentiation a. ^ b. != c. ** d. =+

c. **

1. Fill the gaps "In list the index of first value starts with ___, which is automatically _______" a. 0, identified b. 1, used c. 0, assigned

c. 0, assigned

Determine output of the code def surprise ( ) : print ("Boo") for x in range (1, 5): surprise ( ) a. 5 b. 6 c. 4 d. 1

c. 4( boo boo boo boo)

1. How to convert dictionary data type into json? a. By using chage__ function b. By using provide function c. By using dump function

c. By using dump function

11. To create the two in completely different memories, __________ function of the copy module must be used a. Cop.ind b. Copy_deemodule c. Copy.deecopy

c. Copy.deecopy

How structure programming is possible due to function? a. cause program is already developed b. cause one program can be divided into several parts c. cause program is modified

cause one program can be divided into several parts

In the following expression which element is a comparison operator? If a>b: print(a) a. a b. b c. if d. >

d. >

11. Determine output of given code name = 'Arman' if name == 'Arman' : print ('Hello, {name}!\n'.format(name=name)) else: print('You are a stranger! I don\'t know you\n') a. You are a Arman! I don't know you! b. You are a stranger! I don't know you! c. Hello, Dulat! d. Hello, Arman!

d. Hello, Arman!

1. How to get data from the user? a. Use method get() b. Use method cin() c. Use method read() d. Use method input()

d. Use method input()

Select the main command for the conditional operator a. glav b. elif c. else d. if

d. if

11. Simple Python data types include a. int, real, float b. int, str, real c. int, float, str d. int, str, char, bool

int, str, char, bool

1. Write the method to interest a new item into dictionary Answer:

name [key] = 2

Finish the code bellow 1 s1 = {1, 2, 3, 4, 5, 6} 1 s 2 = {4, 5, 6, 7, 8, 9} 1 XXXXXXXX {1, 2, 3, 4, 5, 6, 7, 8, 9}

s1.union(s2) or s1 | s2

1. Which of the following is not a core data type? a. class b. tuple c. list

v


Ensembles d'études connexes

Final COMP 530 - Operating Systems

View Set

PN Mental Health Online Practice (B)

View Set

316- Chap 54: Upper Respiratory Drugs PREPU

View Set