Hicasct.files.wordpress.com



Python is a___________ programming language.A) Low levelB) High level C) AssemblyD) MachineANSWER: BPython was conceived in the late _______as a successor to the ABC language.A) At 1970sB) At 1960sC) At 1980sD) At 1990sANSWER: C Python was developed byA) Guido Van RossamB) Jhon BackusC) Kathleen BoothD)Alain ColmerauerANSWER: AShort cut for run your python programA) F1B) F3C) F5D) F6ANSWER: CIt does not use ______to delimit blocks.A) Square bracketsB) ParenthesesC) Curly bracketsD) None of theseANSWER: DPython 2.0 was released onA) At 1998B) At 1999C) At 2000D) At 2001ANSWER: CPython uses _______ indentation.A) TracesB) Curly bracketsC) WhitespaceD) TabANSWER: CIt has _____basic modes.A) OneB) TwoC) ThreeD) FourANSWER: BExtension for python programme file.A) DocB) TxtC) PyD) PptANSWER: CInteractive mode is a ______ shell which gives immediate feedback for each statement.A) Command lineB) CodeC) ProgramD) None of theseANSWER: APrint (“HELLO WORLD”). Output for this codeA) Print hello worldB) Hello worldC) HELLO WORLDD) None of theseANSWER: CSelect the python libraries A) TensorFlowB) SciPyC) GLIbD) Both a and bANSWER: DEditing your script is easier in ______mode.A) Interactive modeB) Insert modeC) Active modeD) Script modeANSWER: DThe ______statement is used for printing the lines on python programming.A) Printf()B) Scanf()c) Print()D) None of theseANSWER: CTo exit from help, type ___ for “quit”.A) QB) PC) AD) none of theseANSWER: AThe open source __ is the easiest way to perform python data science and machine language on Linux, Windows, and Mac OSX.A) WinpythonB) Anaconda DistributionC) SASD) Portable pythonANSWER: BIs python case sensitive when dealing with identifies?A) YesB) No C) Machine developmentD) None of the mentionedANSWER: AWhat is the maximum possible length of an identifier?A) Thirty one charactersB) Sixty three charactersC) Seventy nine charactersD) None of the mentionedANSWER: DWhich of the following is not a keyword?A) EvalB) AssertC) NonlocalD) PassANSWER: AWhich of the following is true for variable names in python?A) Unlimited lengthB) All private members must have leading and trailing underscoreC) Underscore and ampersand are the only two special characters allowedD) None of the mentionedANSWER: AWhy are local variable names beginning with an underscore discouraged?A) They are used to indicate a private variable of a classB) They confuse the interpreterC) They are used to indicate global variablesD) They slow down executionANSWER: AGiven a function that does not return any value, what value is thrown by default when executed in shell.A) IntB) BoolC) VoidD) NoneANSWER: DWhat is the return type of function id?A) IntB) FloatC) BoolD) DictANSWER: AWhat error occurs when you execute the following python code snippet?A) SyntaxerrorB) NameerrorC) ValueerrorD) TypeerrorANSWER: BSelect all options that print . hello-how-are-youA) Print(‘hello’,’how’,’are’,’you’)B) Print(‘hello’,’how’,’are’,’you’+’-‘*4)C) Print(‘hello-‘+’how-are-you’)D) Print(‘hello’+’-‘+’how’+’-‘+’are’+’you’)ANSWER: CWhat will be the output of the following Python code? [‘F’,’T’][bool(‘spam’)]A) TB) FC) No outputD) ErrorANSWER: DWhat arithmetic operators cannot be used with string?A) Addition(+)B) Multiplication(x)C) Subraction(-)D) All of the mentionedANSWER: CWhich predefined python function is used to find length of string?A) LengthB) Len()C) Strlen()D) Stringlenth()ANSWER: BWhat is the data type of (1)?A) TupleB) IntegerC) ListD) Both tuple and integerANSWER: AWhat is the correct syntax to copy one list into another?A) ListA = ListB[]B) ListA = ListB[:]C) ListA = ListB[]()D) ListA = ListBANSWER: BWhat is the answer of this expression, 22 % 3 is?A) SevenB) OneC) ZeroD) FiveANSWER: BAll keyword in python are inA) Lower caseB) Upper caseC) CapitalizedD) None of the mentionedANSWER: DWhich of these in not a core data type?A) ListsB) DictionaryC) TuplesD) ClassANSWER: DWhat is the output of this expression, 3*1**3?A) Twenty Seven B) NineC) ThreeD) OneANSWER: CWhat is called when a function is defined inside a class?A) ModuleB) ClassC) Another functionD) MethodANSWER: DPython supports the creation of anonymous functions at runtime, using a construct called______A) Lambdab) PiC) AnonymousD) None of the mentionedANSWER: AIDE stands forA) Integrated development environmentB) Interactive develop environmentC) Introduced developed environmentD) None of theseANSWER: AGuido van Rossam first released python in _____A) At 1991B) At 1992C) At 1995D) At 1980ANSWER: AWhat is the type of each element in sys.argv?A) SetB) ListC) TupleD) StringANSWER: DWhat is the length of sys.argv?A) Number of argumentsB) Number of arguments + 1C) Number of arguments – 1D) Nine of theseANSWER: B How many keyword arguments can be passed to a function in a single function call?A) ZeroB) OneC) Zero or moreD) One or moreANSWER: CHow are variable length arguments specified in the function heading?A) One star followed by a valid identified by a valid identifierB) One underscore followed by a valid identifierC) Two stars followed by a valid identifierD) Two underscores followed by a valid identifierANSWER: AWhich module in the python standard library pares options received from the command line?A) GetoptB) OSC) GetargD) MainANSWER: AProgram code making use of a given module is called a ________ of the module.A) Client B) DocstringC) InterfaceD) ModularityANSWER: AAll modular designs are because of a top-down design process.A) TrueB) FalseANSWER: BIn top-down design every module is broken into same number of submodules.A) TrueB) FalseANSWER: BTo include the use of functions which are present in the random library, we must use the option:A) Import randomB) Random.hC) Import.randomD) Random.randomANSWER: ABoth the functions randint and uniform accept ____________ parameters.A) ZeroB) OneC) ThreeD) TwoANSWER: AWhat is the output of print 0.1 + 0.2 == 0.3?A) TrueB) FalseC) Machine dependentD) ErrorANSWER: BWhat is the type of inf?A) BooleanB) IntegerC) FloatD) ComplexANSWER: CWhat does 3 ^ 4 evaluate to?A) Eighty oneB) TwelveC) Zero point fiveD) SevenANSWER: DWhich of the following is an invalid variable?A) Int My_string_1B) Int 1st_stringc) Int food) Int _ANSWER: BWhich of the following is an invalid statement?A) ABC = 1,000,000B) A B C = 1000 2000 3000C) A,B,C = 1000, 2000, 3000D) A_B_C = 1,000,000ANSWER: BWhich one of the following is a valid Python if statement?A) If a>=2 :B) If (a >= 2)C) If (a => 22)D) If a >= 22ANSWER: AWhat keyword would you use to add an alternative condition to an if statement?A) Else ifB) ElseifC) ElifD) None of theseANSWER: CCan we write if/else into one line in python?A) YesB) NoANSWER: AIn a Python program, a control structure:A) Defines program-specific data structuresB) Directs the order of execution of the statements in the programC) Dictates what happens before the program starts and after it terminatesD) None of the aboveANSWER: BWhat will be output of this expression: 'P' + 'Q' if '12'.isdigit() else 'R' + 'S'A) PQB) RSC) PQRSD) PQ12ANSWER: A Which statement will check if a is equal to b?A) IF a = b:B) IF a == b:C) IF a === c:D) IF a == bANSWER: BWhich of the following is a valid for loop in Python?A) FOR(i=0; i<n; i++)B) FOR i in range(0,5):C) FOR i in range(0,5)D) FOR i in range(5)ANSWER: BWhen does the else statement written after loop executes?A) When break statement is executed in the loopB) When loop condition becomes falseC) Else statement is always executedD) None of the aboveANSWER: BHow 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[last]D. ARR[-1]ANSWER: DSuppose a tuple ARR contains 10 elements. How can you set the 5th element of the tuple to ‘Hello’?A. ARR[4] = 'Hello'B. ARR(4) = 'Hello'C. ARR[5] = 'Hello'D. Elements of tuple cannot be changedANSWER: DWhat type of data is: arr = [(1,1),(2,2),(3,3)]?A. Array of tuplesB. Tuples of listsC. List of tuplesD. Invalid typeANSWER: COn assigning a value to a variable inside a function, it automatically becomes a global variable.A) TrueB) FalseANSWER: BWhich of the following data structures is returned by the functions globals () and locals ()?A) ListB) SetC) DictionaryD) TupleANSWER: CWhat happens if a local variable exists with the same name as the global variable you want to access?A) ErrorB) The local variable is shadowedC) Undefined behaviourD) The global variable is shadowedANSWER: DWhat is the default value of encoding in encode ()?A) AsciiB) QwertyC) Utf-8D) Utf-16ANSWER: AWhat is “Hello”.replace(“l”, “e”)?A) HeeeoB) HeeloC) HeleoD) NoneANSWER: CTo check whether string S1 contains another string S2, use ________A) S1.__contains__(S2)B) S2 in S1C) S1.contains(S2)D) Si.in(S2)ANSWER: AWhat function do you use to read a string?A) Input(“Enter a string”)B) Eval(input(“Enter a string”))C) Enter(“Enter a string”)D) Eval(enter(“Enter a string”))ANSWER: BWhich of the following commands will create a list?A) List1 = List()B) List1 = []C) List1 = List([1, 2, 3])D) All of the mentionedANSWER: DSuppose list Example is [‘h’,’e’,’l’,’l’,’o’], what is len(list Example)?A) FiveB) FourC) NoneD) ErrorANSWER: ATo shuffle the list(say List1) what function do we use?A) List1.shuffle()B) Shuffle(list1)C) Random.shuffle(list1)D) Random.shuffleList(list1)ANSWER: CSuppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?A) Print(list1[0])B) Print(list1[:2])C) Print(list1[:-2])D) All of the mentionedANSWER: DTo add a new element to a list we use which command?A) List1.add(5)B) List1.append(5)C) List1.addLast(5)D) List1.addEnd(5)ANSWER: BTo remove string “hello” from list1, we use which command?A) List1.remove(“hello”)B) List1.remove(hello)C) List1.removeAll(“hello”)D) List1.removeOne(“hello”)ANSWER: ATo which of the following the “in” operator can be used to check if an item is in it?A) ListsB) DictionaryC) SetD) All of the mentionedANSWER: ASuppose t = (1, 2, 4, 3), which of the following is incorrect?A) Print(t[3])B) T[3] = 45c) Print(max(t))d) Print(len(t))ANSWER: BIs the following Python code valid? >>>a,b=1,2,3.A) Yes, this is an example of tuple unpacking. a=1 and b=2B) Yes, this is an example of tuple unpacking. a=(1,2) and b=3C) No, too many values to unpackD) Yes, this is an example of tuple unpacking. a=1 and b=(2,3)ANSWER: CWhich one of these is floor division?A) SlashB) Double slashC) PercentageD) None of the mentionedANSWER: BOperators with the same precedence are evaluated in which manner?A) Left to RightB) Right to LeftC) Can’t sayD) None of the mentionedANSWER: ASet makes use of __________. Dictionary makes use of ____________A) Keys, keysB) Key values, keysC) Keys, key valuesD) Key values, key valuesANSWER: CWhich of the following functions cannot be used on heterogeneous sets?A) PopB) RemoveC) UpdateD) SumANSWER: DWhich of these about a dictionary is false?A) The values of a dictionary can be accessed using keysB) The keys of a dictionary can be accessed using valuesC) Dictionaries aren’t orderedD) Dictionaries are mutableANSWER: BWhich of the following isn’t true about dictionary keys?A) More than one key isn’t allowedB) Keys must be immutableC) Keys must be integersD) When duplicate keys encountered, the last assignment winsANSWER: CWhich of the statements about dictionary values if false?A) More than one key can have the same valueB) The values of the dictionary can be accessed as dict[key]C) Values of a dictionary must be uniqueD) Values of a dictionary can be a mixture of letters and numbersANSWER: CIf a is a dictionary with some key-value pairs, what does a.popitem() do?A) Removes an arbitrary elementB) Removes all the key-value pairsC) Removes the key-value pair for the key given as an argumentD) Invalid method for dictionaryANSWER: AWhat will be the output of the following Python code snippet? ['hello', 'morning'][bool('')]A) ErrorB) No outputC) HelloD) MorningANSWER: CWhich of the following Boolean expressions is not logically equivalent to the other three?A) Not(-6<0 or-6>10)B) A -6>=0 and -6<=10C) Not(-6<10 or-6==10)D) Not(-6>10 or-6==10)ANSWER: DWhat will be the output of the following Python code snippet? not(10<20) and not(10>30)A) TrueB) FalseC) ErrorD) No outputANSWER: BBitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.A) ORB) ANDC) XORD) NOTANSWER: CWhat will be the output of the following Python expression? 4^12A) TwoB) FourC) Eight D) TwelveANSWER: CWhich of the following expressions can be used to multiply a given number ‘A’ by 4?A) A<<2B) A<<4C) A>>2D) A>>4ANSWER: AThe value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.A) TrueB) FalseANSWER: AWhat will be the value of the following Python expression? 4 + 3 % 5A) FourB) SevenC) TwoD) ZeroANSWER: BWhich of the following expressions results in an error?A) Float(‘10’)B) Int(‘10’)C) Float(’10.8’)D) Int(’10.8’)ANSWER: DThe expression 2**2**3 is evaluates as: (2**2)**3.A) TrueB) FalseANSWER: BWhich of the following will run without errors?A) Round(45.8)B) Round(6352.898,2,5)C) Round()D) Round(7463.123,2,1)ANSWER: AWhat error occurs when you execute the following Python code snippet? apple = mangoA) SyntaxErrorB) NameErrorC) ValueErrorD) TypeErrorANSWER: BWhat data type is the object below? L = [1, 23, 'hello', 1]A) ListB) DictionaryC) ArrayD) TupleANSWER: AIn order to store values in terms of key and value we use what core data type.A) ListB) TupleC) ClassD) DictionaryANSWER: DWhat is the return value of trunc()?A) IntB) BoolC) FloatD) NoneANSWER: AWhich of the following is not a complex number?A) K = 2 + 3JB) K = complex(2, 3)C) K = 2 + 3lD) K = 2 + 3JANSWER: CWhich of the following is incorrect?A) X = 0b101B) X = 0x4f5C) X = 19023D) X = 03964ANSWER: DWhat is the result of cmp (3, 1)?A) OneB) ZeroC) TrueD) FalseANSWER: AWhich of the following is incorrect?A) Float(‘inf’)B) Float(‘nan’)C) Float(’56’+’78’)D) Float(’12+34′)ANSWER: DThe expression shown below results in an error.print("-%5d0",989)A) TrueB) FalseANSWER: BThe ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function.A) Hash (#)B) Dollar ($)C) At (@)D) Ampersand (&)ANSWER: CA function with parameters cannot be decorated.A) TrueB) FalseANSWER: AHow can we generate random numbers in python using methods?A) RANDOM.UNIFORM ()B) RANDOM.RANDINT()C) RANDOM.RANDOM()D) ALL OF THE ABOVEANSWER: DWhich code is used to open a file for binary writing?A) WB) WBC) R+D) AWhich of the following is correct about Python?A) Python is a high-level, interpreted, interactive and object-oriented scripting language.B) Python is designed to be highly readable.C) It uses English keywords frequently where as other languages use punctuation.D) All of the above.ANSWER: DWhich of the following is correct about Python?A) It supports functional and structured programming methods as well as OOP.B) It can be used as a scripting language.C) It provides very high-level dynamic data types and supports dynamic type checking.D) All of the above.ANSWER: DWhich of the following is correct about Python?A) It supports automatic garbage collection.B) It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.C) Both of the above.D) None of the above.ANSWER: CWhich of the following environment variable for Python is an alternative module search path?A) PYTHONPATHB) PYTHONSTARTUPC) PYTHONCASEOKD) PYTHONHOMEANSWER: DIs python a case sensitive language?A) trueB) falseANSWER: AWhich of the following data types is not supported in python?A) NumbersB) StringC) ListD) SliceANSWER: DWhich of the following data types is not supported in python?A) TupleB) DictionaryC) GenericsD) ListANSWER: CWhat is the output of print str if str = 'Hello World!'?A) Hello World!B) ErrorC) strD) None of the above.ANSWER: AWhat is the output of print str[0] if str = 'Hello World!'?A) Hello World!B) HC) ello World!D) None of the above.ANSWER: BWhat is the output of print str[2:5] if str = 'Hello World!'?A) llo World!B) HC) lloD) None of the above.ANSWER: CWhat is the output of print str[2:] if str = 'Hello World!'?A) llo World!B) HC) lloD) None of the above.ANSWER: AWhat is the output of print str * 2 if str = 'Hello World!'?A) Hello World!Hello World!B) Hello World! * 2C) Hello World!D) None of the above.ANSWER: AWhich of the following is correct about tuples in python?A) A tuple is another sequence data type that is similar to the list.B) A tuple consists of a number of values separated by commas.C) Unlike lists, however, tuples are enclosed within parentheses.D) All of the above.ANSWER: D ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download