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)

1 Answer

Answer :

a) list1.add(5)

Related questions

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 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”)

Last Answer : d) list1.removeOne(“hello”)

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 of the following commands will create a list? a) list1 = list() b) list1 = []. c) list1 = list([1, 2, 3]) d) all of the mentioned

Last Answer : d) all of the mentioned

Description : What will be the output? >>>my_tuple = (1, 2, 3, 4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple) a) 1 b) 2 c) 5 d) Error

Last Answer : c) 5

Description : What is the output of the following? x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x) a) [‘AB’, ‘CD’]. b) [‘ab’, ‘cd’, ‘AB’, ‘CD’]. c) [‘ab’, ‘cd’]. d) none of the mentioned

Last Answer : d) none of the mentioned

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 [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 : 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 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 [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 statement is not correct with reference to cron daemon in UNIX O.S? (A) The cron daemon is the standard tool for running commands on a predetermined schedule. (B) It starts ... command lines and the times at which they invoked. (D) Crontab for individual users are not stored.

Last Answer : (D) Crontab for individual users are not stored.

Description : Python : Append to Numpy array Vs append to list -Web-Development

Last Answer : answer:

Description : Python: how to append all elements of a list to another list -Web-Development

Last Answer : answer:

Description : What property says that multiplying a sum by a number is the same as multiplying each addend by the number and then adding the product?

Last Answer : Distributive property

Description : What property says that multiplying a sum by a number is the same as multiplying each addend by the number and then adding the product?

Last Answer : Distributive property

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 : Write the command using Insert() function to add a new column in the last place(3rd place) named “Salary” from the list Sal=[10000,15000,20000] -Technology

Last Answer : EMP.insert(loc=3,column=”Salary”,value=Sal)

Description : Shouldn't we have a "complete/append" function in the context menu?

Last Answer : Are you talking about on Fluther or where? I ‘m not sure what you mean.

Description : The output generated by the LINUX command : $ seq 1 2 10 will be (A) 1 2 10 (B) 1 2 3 4 5 6 7 8 9 10 (C) 1 3 5 7 9 (D) 1 5 10

Last Answer : (C) 1 3 5 7 9

Description : For using a specific database …………… command is used. A) use database B) databasename use C) Both A &B D) None of them

Last Answer : A) use database

Description : Which command is used to display a file contents in octal form? A. cd B. od C. of D. oct E. None of the above

Last Answer : B. od

Description : Which command is used to count just the number of characters in a file? A. wc - 1 B. wc -c C. wc -w D. wc -r E. None of the above

Last Answer : B. wc -c

Description : Which symbol is used to separate more than one command in the same command line? A. $ B. # C. : D. ;

Last Answer : D. ;

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 : The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is A. tee B. tr C. sort D. grep E. None of the above

Last Answer : A. tee

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 of the following is not a communication command. A. write B. mesg C. mail D. grep E. None of the above

Last Answer : D. grep

Description : The Octal number to be given alogn with chmod command to make a file readable, writable and executable to the owner, readable and executable to group and others is: A. 000 B. 755 C. 744 D. 555 E. None of the above

Last Answer : B. 755

Description : Which of the following files will displayed by this command cat *ch* A. patch B. catch C. .ch D. All of the above E. None of the above

Last Answer : D. All of the above

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 sends the word count of the file infile to the newfile. A. wc infile >newfile B. wc newfile C. wc infile - newfile D. wc infile | newfile E. None of the above

Last Answer : A. wc infile >newfile

Description : Which command is used to extract specific columns from the file? A. cat B. cut C. grep D. paste E. None of the above

Last Answer : B. cut

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 : 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 : Which command is used to display the top of the file? A. cat B. head C. more D. grep E. None of the above

Last Answer : B. head

Description : Which command is used to sort the lines of data in a file in reverse order A. sort B. sh C. st D. sort -r E. None of the above

Last Answer : D. sort -r

Description : Which symbol will be used with grep command to match the pattern pat at the beginning of a line? A. ^pat B. $pat C. pat$ D. pat^ E. None of the above

Last Answer : A. ^pat

Description : The command javac A) Converts a java program into binary code B) Converts a java program into bytecode C) Converts a java program into machine language D) None of the above.

Last Answer : B) Converts a java program into bytecode

Description : The command javac is used to A) debug a java program B) compile a java program C) interpret a java program D) execute a java program

Last Answer : B) compile a java program

Description : The type(s) of auto executing macros, in Microsoft word is/are A) Auto execute B) Auto macro C) Command macro D) All of the above

Last Answer : D) All of the above

Description : To delete a database ................... command is used A) delete database database_name B) Delete database_name C) drop database database_name D) drop database_name

Last Answer : C) drop database database_name

Description : The mv command changes (A) the inode (B) the inode-number (C) the directory entry (D) both the directory entry and the inode

Last Answer : (C) the directory entry