Description : To insert 5 to the third position in list1, we use which command ? a) list1.insert(3, 5) b) list1.insert(2, 5) c) list1.add(3, 5) d) list1.append(3, 5)
Last Answer : a) list1.insert(3, 5)
Description : To 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)
Last Answer : a) list1.add(5)
Description : To shuffle the list(say list1) what function do we use ? a) list1.shuffle () b) shuffle(list1) c) random.shuffle(list1) d) random.shuffleList(list1)
Last Answer : c) random.shuffle(list1)
Description : Which command is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric characters? A. cat emp[!0-9] B. more [emp][!0-9] C. cat emp[x-z]
Last Answer : A. cat emp[!0-9]
Description : Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3? A. chmod u+x emp[l-3] B. chmod 777 emp* C. chmod u+r ??? emp D. chmod 222 emp? E. None of the above
Last Answer : A. chmod u+x emp[l-3]
Description : Which command is used to copy all files having the string chap and any two characters after that to the progs directory? A. cp chap?? progs B. cp chap* progs C. cp chap[12] /progs/*.*
Last Answer : A. cp chap?? progs
Description : What does the following command do? grep −vn abc x (A) It will print all of the lines in the file x that match the search string abc (B) It will print all of the lines in file x that do not ... (D) It will print the specific line numbers of the file x in which there is a match for string abc
Last Answer : (A) It will print all of the lines in the file x that match the search string “abc”
Description : What is the output when following code is executed ? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2 is a) True b) False c) Error d) None
Last Answer : b) False
Description : Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is : a) [0, 1, 2, 3]. b) [0, 1, 2, 3, 4]. c) [0.0, 0.5, 1.0, 1.5]. d) [0.0, 0.5, 1.0, 1.5, 2.0].
Last Answer : c) [0.0, 0.5, 1.0, 1.5].
Description : Suppose list1 is [1, 3, 2], What is list1 * 2 ? a) [2, 6, 4]. b) [1, 3, 2, 1, 3]. c) [1, 3, 2, 1, 3, 2] . D) [1, 3, 2, 3, 2, 1].
Last Answer : c) [1, 3, 2, 1, 3, 2] .
Description : Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1] ? a) [2, 33, 222, 14]. b) Error c) 25 d) [25, 14, 222, 33, 2].
Last Answer : a) [2, 33, 222, 14].
Description : Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ? a) Error b) None c) 25 d) 2
Last Answer : c) 25
Description : Suppose 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 mentioned
Last Answer : d) all of the mentioned
Description : Suppose list1 is [1, 5, 9], what is sum(list1) ? a) 1 b) 9 c) 15 d) Error
Last Answer : c) 15
Description : Suppose list1 is [3, 5, 25, 1, 3], what is min(list1) ? a) 3 b) 5 c) 25 d) 1
Last Answer : d) 1
Description : Suppose list1 is [2445, 133, 12454, 123], what is max(list1) ? a) 2445 b) 133 c) 12454 d) 123
Last Answer : c) 12454
Description : Which of the following commands will create a list? a) list1 = list() b) list1 = []. c) list1 = list([1, 2, 3]) d) all of the mentioned
Description : Which command is used to remove a file? A. remove B. rm C. mv D. del E. None of the above
Last Answer : B. rm
Description : Which command is used to remove the read permission of the file 'note' from both the group and others? A. chmod go+r note B. chmod go+rw note C. chmod go-x note D. chmod go-r, 4-x note E. None of the above
Last Answer : D. chmod go-r, 4-x note
Description : Which command is used to remove a directory? A. rd B. rmdir C. dldir D. rdir E. None of the above
Last Answer : B. rmdir
Description : What will be the output of the following Unix command ? $rm chap0\[1 - 3\] (A) Remove file chap0[1 - 3] (B) Remove file chap01, chap02, chap03 (C) Remove file chap\[1 - 3\] (D) None of the above
Last Answer : (A) Remove file chap0[1 - 3]
Description : What is the output when we execute list(“hello”)? a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]. b) [‘hello’]. c) [‘llo’]. d) [‘olleh’].
Last Answer : a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’].
Description : Consider a program that consists of 8 pages (from 0 to 7) and we have 4 page frames in the physical memory for the pages. The page reference string is : 1 2 3 2 5 6 3 4 6 3 7 3 1 5 3 6 3 4 2 4 3 4 5 ... to fill available page frames with pages): (A) 9 and 6 (B) 10 and 7 (C) 9 and 7 (D) 10 and 6
Last Answer : (B) 10 and 7
Description : Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use? a) d.size() b) len(d) c) size(d) d) d.len()
Last Answer : b) len(d)
Description : Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use a) d.delete(“john”:40) b) d.delete(“john”) c) del d[“john”]. d) del d(“john”:40)
Last Answer : c) del d[“john”].
Description : What is the output when following code is executed ? >>>str1="helloworld" >>>str1[::-1] a) dlrowolleh b) hello c) world d) helloworld
Last Answer : a) dlrowolleh
Description : hat is the output when following code is executed ? >>>print r"\nhello" The output is a) a new line and hello b) \nhello c) the letter r and then hello d) error
Last Answer : d) error
Description : What is the output when following code is executed ? >>> str1 = 'hello' >>> str2 = ',' >>> str3 = 'world' >>> str1[-1:] a) olleh b) hello c) h d) o
Last Answer : b) hello
Description : What will be the output of the following segment of the program? main( ) { char *s = “hello world”; int i = 7; printf(“%, *s”, i, s); } (A) Syntax error (B) hello w (C) hello (D) o world
Last Answer : Answer: Marks given to all
Description : Which of the following derivations does a top-down parser use while parsing an input string ? The input is scanned from left to right. (A) Leftmost derivation (B) Leftmost derivation traced out in reverse (C) Rightmost derivation traced out in reverse (D) Rightmost derivation
Last Answer : (A) Leftmost derivation
Description : In what way is a file more flexible than a String?
Last Answer : Ans: A file is stored permanently in a storage device.It is easy to access a file whenever required. On the other hand, a string is stored temporarily in RAM, and the contents of a string will be erased automatically when the power is switched off or when the program execution is terminated.
Description : Why is the ‘S’ of String capital?
Last Answer : A: Since String is a class.
Description : Is it compulsory to write String args[] when running a program in BlueJ?
Last Answer : A: No it is not compulsory when we are running it in BlueJ. But normally (in all other cases) it is always better to have it, as the JVM looks for the main method with a String array as a parameter.
Description : In java, string is a ............. A) primitive data type B) abstract data type C) combination of boolean D) None of the above
Last Answer : B) abstract data type
Description : Which of the following methods belong to the string class? A) length( ) B) compare To ( ) C) equals ( ) D) All of them
Last Answer : D) All of them
Description : The class string belongs to ................... package. A) java.awt B) java.lang C) java.applet D) java.string
Last Answer : B) java.lang
Description : What would happen if "String[]args" is not included as argument in the main method. A) No error B) Compilation error C) Program won't run D) Program exit
Last Answer : C) Program won't run
Description : ………… function writes a string of text to a window. A) cputs () B) put () C) gets () D) tputs ()
Last Answer : A) cputs ()
Description : The ..................... is essentially used to search for patterns in target string. A) Like Predicate B) Null Predicate C) In Predicate D) Out Predicate
Last Answer : A) Like Predicate
Description : Data items grouped together for storage purposes are called a A) record B) title C) list D) string
Last Answer : A) record
Description : The output of executing string.ascii_letters can also be achieved by: a) string.ascii_lowercase_string.digits b) string.ascii_lowercase+string.ascii_upercase c) string.letters d) string.lowercase_string.upercase
Last Answer : d) string.lowercase_string.upercase
Description : Which is the correct statement(s) for Non Recursive predictive parser? S1: First(α) = {t | α => * t β for some string β } => *tβ S2: Follow(X) = { a | S => * αXa β for some strings ... and S2 is correct. (C) S1 is correct and S2 is incorrect. (D) Both statements S1 and S2 are correct.
Last Answer : (D) Both statements S1 and S2 are correct.
Description : The control string in C++ consists of three important classifications of characters (A) Escape sequence characters, Format specifiers and Whitespace characters (B) Special characters, White-space ... and Non-white space characters (D) Special characters, White-space characters and Format specifiers
Last Answer : (C) Format specifiers, White-space characters and Non-white space characters
Description : The Servlet Response interface enables a servlet to formulate a response for a client using the method ............... (A) void log(Exception e, String s) (B) void destroy() (C) int getServerPort() (D) void setContextType(String Type)
Last Answer : (D) void setContextType(String Type)
Description : The process of dividing an analog signal into a string of discrete outputs, each of constant amplitude, is called: (A) Strobing (B) Amplification (C) Conditioning (D) Quantization
Last Answer : (D) Quantization
Description : A LRU page replacement is used with four page frames and eight pages. How many page faults will occur with the reference string 0172327103 if the four frames are initially empty? (A) 6 (B) 7 (C) 5 (D) 8
Last Answer : (B) 7
Description : Consider the reference string 0 1 2 3 0 1 4 0 1 2 3 4 If FIFO page replacement algorithm is used, then the number of page faults with three page frames and four page frames are .......... and ........... respectively. (A) 10, 9 (B) 9, 9 (C) 10, 10 (D) 9, 10
Last Answer : (D) 9, 10
Description : Which of the following is FALSE ? (A) The grammar S ⟶ aSb|bSa|SS|∈, where S is the only non-terminal symbol and ∈ is the null string, is ambiguous. (B) SLR is powerful than LALR. (C) An LL(1) parser is a top-down parser. (D) YACC tool is an LALR(1) parser generator.
Last Answer : (B) SLR is powerful than LALR.
Description : The number of strings of length 4 that are generated by the regular expression (0|∈) 1+2* (3|∈), where | is an alternation character, {+, *} are quantification characters, and ∈ is the null string, is: (A) 08 (B) 10 (C) 11 (D) 12
Last Answer : (D) 12