Back to marketplace

Built-in Functions (1)

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

#Built in functions #Write the arguments of slice()

Back (Answer)

slice(stop) slice(start, stop, step)

#2
Front (Question)

Outcome of: String =’GeeksforGeeks’ Gee ek

Back (Answer)

s1 = slice(3) s2 = slice(1, 5, 2) print(String[s1]) print(String[s2])

#3
Front (Question)

#Built in functions #Write the arguments of .countOf()

Back (Answer)

Operator.countOf(freq = a, value = b)

#4
Front (Question)

Count frequency of 3 arr = [ 1, 2, 3, 3, 3 ]

Back (Answer)

from operator import * arr = [ 1, 2, 3, 3, 3 ] print(countOf(arr, 3))

#5
Front (Question)

#Built in functions #Write the arguments of copysign() and explain what it does

Back (Answer)

math.copysign(x, y) Returns : float value consisting of magnitude from parameter x and the sign from parameter y.

#6
Front (Question)

Outcome of: import math math.copysign(-5,7)

Back (Answer)

5

#7
Front (Question)

#Built in functions # int.bit_length(), explain what it does

Back (Answer)

Returns the number of bits required to represent an integer in binary, excluding the sign and leading zeros.

#8
Front (Question)

Outcome of: num = 7 print(num.bit_length())

Back (Answer)

3

#9
Front (Question)

#Built in functions #Write the arguments of isinstance() and explain what it does

Back (Answer)

isinstance(obj, class) Returns : True, if object belongs to the given class/type if single class is passed or any of the class/type if tuple of class/type is passed, else returns False. Raises a TypeError if anything other than mentioned valid class type.

#10
Front (Question)

Check whether the object test=’stre’ belongs to the class integer

Back (Answer)

test=’stre’ isinstance(test, int) Outcome: False

#11
Front (Question)

Write the arguments of range()

Back (Answer)

range(start, stop, step)

#12
Front (Question)

Get this outcome using range(): [0, 2, 4, 6, 8]

Back (Answer)

list(range(0,10,2))

#13
Front (Question)

Write the arguments of set() and explain what it does

Back (Answer)

set(iterable) Returns : An empty set if no element is passed. Non-repeating element iterable modified as passed as argument.

#14
Front (Question)

Code lis1 = [ 3, 4, 1, 4, 5 ] {1, 3, 4, 5}

Back (Answer)

set(lis1)

#15
Front (Question)

Parameters of hash(obj) and explain what it does

Back (Answer)

obj : The object which we need to convert into hash. Returns : Returns the hashed value if possible.

#16
Front (Question)

Outcome of: lis1 = [1, 2, 3, 4, 5] lis1 = iter(lis1) next(lis1)

Back (Answer)

Once the iteration is complete, it raises a StopIteration exception and iteration count cannot be reassigned to 0. herefore, it can be used to traverse the container just once.

#17
Front (Question)

Arguments of iter() and explain limitations

Back (Answer)

iter(obj, sentinel) obj : Object which has to be converted to iterable ( usually an iterator ). sentinel : value used to represent end of sequence. Once the iteration is complete, it raises a StopIteration exception and iteration count cannot be reassigned to 0.

#18
Front (Question)

Complete code class GfG : name = "GeeksforGeeks" age = 24 …= GfG …(obj,’name’) Outcome: ‘GeeksforGeeks’

Back (Answer)

class GfG : name = "GeeksforGeeks" age = 24 obj = GfG getattr(obj,’name’)

#19
Front (Question)

Explain random.sample() function

Back (Answer)

Syntax : random.sample(sequence, k) Parameters: sequence: Can be a list, tuple, string, or set. k: An Integer value, it specify the length of a sample. random sampling without replacement.

#20
Front (Question)

Get a sample of three numbers from a list called list1

Back (Answer)

from random import sample list1 = [1, 2, 3, 4, 5] sample(list1,3) Outcome: [2, 3, 4]

#21
Front (Question)

Finish code from collections import … x = …(“geeksforgeeks”) Outcome: g g e e e e k k s s f o r

Back (Answer)

from collections import Counter x = Counter(“geeksforgeeks”) for i in x.elements(): print ( i, end = “ “)

#22
Front (Question)

Code to get: bytearray(b’Geeksforgeeks’)

Back (Answer)

str = “Geeksforgeeks” array1 = bytearray(str, ‘utf-8’) print(array1)

#23
Front (Question)

standard deviation of list1.

Back (Answer)

import statistics # creating a simple data - set list1 = [1, 2, 3, 4, 5]

#24
Front (Question)

Get the standard deviation list1=list(range(1,8)) #Outcome: 2.16

Back (Answer)

round(statistics.stdev(list1),2)