Is the following piece of code valid? >>> a=(1,2,3,4)
>>> del a
a) No because tuple is immutable b) Yes, first element in the tuple is deleted c) Yes, the entire tuple is deleted

1 Answer

Answer :

c) Yes, the entire tuple is deleted

Related questions

Description : What is the output of the following code? >>> a=(1,2,3,4) >>> del(a[2]) a) Now, a=(1,2,4) b) Now, a=(1,3,4) c) Now a=(3,4) d) Error as tuple is immutable

Last Answer : d) Error as tuple is immutable

Description : What is the output of the following piece of code when executed in Python shell? >>> a=("Check")*3 >>> a a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples c) (‘CheckCheckCheck’) d) Syntax erro

Last Answer : c) (‘CheckCheckCheck’)

Description : The seven elements A, B, C, D, E, F and G are pushed onto a stack in reverse order, i.e., starting from G. The stack is popped five times and each element is inserted into a queue. Two elements are deleted from the queue and pushed ... The popped item is ................... (1) A (2) B (3) F (4) G

Last Answer : Answer: 2

Description : A .................. normal form normalization will be needed where all attributes in a relation tuple are not functionally dependent only on the key attribute. A) First B) Second C) Third D) Fourth

Last Answer : C) Third

Description : In a relational schema, each tuple is divided into fields called A) Relations B) Domains C) Queries D) All of the above

Last Answer : B) Domains

Description : A set of possible data values is called (A) attribute. (B) degree. (C) tuple. (D) domain.

Last Answer : D) domain.

Description : The RDBMS terminology for a row is (A) tuple. (B) relation. (C) attribute. (D) degree.

Last Answer : (A) tuple

Description : A relational database developer refers to a record as (A) a criteria. (B) a relation. (C) a tuple. (D) an attribute.

Last Answer : C) a tuple

Description : If a=(1,2,3,4), a[1:-1] is a) Error, tuple slicing doesn’t exist b) [2,3]. c) (2,3,4) d) (2,3)

Last Answer : d) (2,3)

Description : What is the data type of (1)? a) Tuple b) Integer c) List d) Both tuple and integer

Last Answer : b) Integer

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

Last Answer : b) (1, 2, 3)

Description : In a relational database model, NULL values can be used for all but which one of the following? (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL. (B) To ... D) To fill a column in a tuple when that column does not really exist for that particular tuple.

Last Answer : (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL.

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 : If you are to use [Control-c] as the interrupt key instead of [Del], then you will have to use A. tty ^c B. stty intr \^c C. stty echoe D. stty echo \^a E. None of the above

Last Answer : B. stty intr \^c

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 : Consider a code with five valid code words of length ten : 0000000000, 0000011111, 1111100000, 1110000011, 1111111111 Hamming distance of the code is (A) 5 (B) 10 (C) 8 (D) 9

Last Answer : Answer: Marks to all

Description : Which of the following statements is FALSE about weak entity set ? (A) Weak entities can be deleted automatically when their strong entity is deleted. (B) Weak entity set avoids the data ... weak entity set are not partitioned according to their relationship with tuples in a strong entity set.

Last Answer : (D) Tuples in a weak entity set are not partitioned according to their relationship with tuples in a strong entity set.

Description : What is the output of the following piece of code? a={1:"A",2:"B",3:"C"} print(a.get(1,4)) a) 1 b) A c) 4

Last Answer : b) A

Description : What is the output of the following piece of code? >>> a=(0,1,2,3,4) >>> b=slice(0,2) >>> a[b] a) Invalid syntax for slicing b) [0,2]. c) (0,1) d) (0,2)

Last Answer : c) (0,1)

Description : Which can be used to delete all the rows if a table? A) Delete * from table_name B) Delete from table_name C) Delete table_name D) all rows cannot be deleted at a time.

Last Answer : A) Delete * from table_name

Description : The Software Maturity Index (SMI) is defined as SMI = [Mf - (Fa + Fc + Fd)] / Mf Where Mf = the number of modules in the current release. Fa = the number of modules in the current release that have ... (A) SMI approaches 1 (B) SMI approaches 0 (C) SMI approaches -1 (D) None of the above

Last Answer : (A) SMI approaches 1 

Description : Can a view be updated/inserted/deleted? If Yes under what conditions ?

Last Answer : A View can be updated/deleted/inserted if it has only one base table if the view is based on columns from one or more tables then insert, update and delete is not possible.

Description : Suppose there are four processes in execution with 12 instances of a Resource R in a system. The maximum need of each process and current allocation are given below: With reference to current allocation, is system safe? If so, ... B) Yes, P1 P2 P3 P4 (C) Yes, P4 P3 P1 P2 (D) Yes, P2 P1 P3 P4

Last Answer : (C) Yes, P4 P3 P1 P2

Description : Consider a system with seven processes A through G and six resources R through W. Resource ownership is as follows: process A holds R and wants T process B holds nothing but wants T process C holds nothing but wants S process D holds U ... No (B) Yes, A, B, C (C) Yes, D, E, G (D) Yes, A, B, F

Last Answer : (C) Yes, D, E, G

Description : Which of the following control expressions are valid for an if statement? A) An integer expression B) A Boolean expression C) Either A or B D) Neither A nor B

Last Answer : B) A Boolean expression

Description : Which of the following control expressions are valid for an if statement? A) An integer expression B) A Boolean expression C) Either A or B D) Neither A nor B

Last Answer : B) A Boolean expression

Description : Which of the following control expressions are valid for an if statement? A) an integer expression B) a Boolean expression C) either A or B D) Neither A nor B

Last Answer : B) a Boolean expression

Description : ……………….. contains information that defines valid values that are stored in a column or data type. A) View B) Rule C) Index D) Default

Last Answer : C) Index

Description : One aspect that has to be dealt with by the integrity subsystem is to ensure that only valid values can be assigned to each data items. This is referred to as A) Data Security B) Domain access C) Data Control

Last Answer : C) Data Control

Description : Which of the following is a valid SQL type? (A) CHARACTER (B) NUMERIC (C) FLOAT (D) All of the above

Last Answer : (D) All of the above

Description : Which of the following is not valid with reference to Message Passing Interface (MPI)? (A) MPI can run on any hardware platform (B) The programming model is a distributed memory model. (C) All ... implicit. (D) MPI - Comm - Size returns the total number of MPI processes in specified communication.

Last Answer : (C) All parallelism is implicit.

Description : Which of the following arguments are not valid? (a) If Gora gets the job and works hard, then he will be promoted. If Gora gets promotion, then he will be happy. He will not be happy, therefore, either he will not get the job or he ... and (c) (B) (b) and (c) (C) (a), (b) and (c) (D) (a) and (b)

Last Answer : Answer: B Explanation: (a) P: Gora gets the job  Q: Gora works hard  R: Gora gets promotion  S: Gora will be happy The argument can bet written as  (P˄Q)→R  R→S  ¬S ... also be written as: ((P˅Q)˄¬P)→Q where P, and Q are propositions expressed in some formal system.

Description : Which of the following statements is true? (1) The sentence S is a logical consequence of S1,..., Sn if and only if S1˄S2˄........˄Sn→S is satisfiable. (2) The sentence S is a logical consequence of ... S is a logical consequence of S1,..., Sn if and only if S1˄S2˄........˄Sn˄S is inconsistent.

Last Answer : The sentence S is a logical consequence of S1,..., Sn if and only if S1˄S2˄........˄Sn→S is valid.

Description : Which of the following is true about the static member variable in C++. i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted. ii) It is visible only within ... , ii-True B) ii-False, ii-True C) i-True, ii-False D) i-False, iii-False

Last Answer : B) ii-False, ii-True

Description : Which of the following condition is true for an object used as a function argument. i) A copy of the entire objects is passed to the function. ii) Only the address of the object is transferred to the function. A) Only i B) Only ii C) Both i and ii D) None of them

Last Answer : C) Both i and ii

Description : A logical schema A) is the entire database B) is a standard way of organizing information into accessible parts. C) Describes how data is actually stored on disk. D) All of the above

Last Answer : B) is a standard way of organizing information into accessible parts.

Description : Software safety is a ................... activity that focuses on the identification and assessment of potential hazards that may affect software negatively and cause an entire ... monitoring and management (B) Software quality assurance (C) Software cost estimation (D) Defect removal efficiency

Last Answer : (B) Software quality assurance

Description : The “part-whole”, or “a-part-of”, relationship in which objects representing the components of something associated with an object representing the entire assembly is called as (A) Association (B) Aggregation (C) Encapsulation (D) Generalisation

Last Answer : (B) Aggregation

Description : Software safety is quality assurance activity that focuses on hazards that (A) affect the reliability of a software component (B) may cause an entire system to fail. (C) may result from user input errors. (D) prevent profitable marketing of the final product

Last Answer : (B) may cause an entire system to fail.

Description : What does the term immutable mean?

Last Answer : The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

Description : Strings are immutable, what does this mean?

Last Answer : Any changes to that string are in fact copies. 

Description : What does the term immutable mean?

Last Answer : The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory. 

Description : Does Declaring an object "final" makes it immutable ?

Last Answer : Ans. Only declaring primitive types as final makes them immutable. Making objects final means that the object handler cannot be used to target some other object but the object is still mutable.

Description : How to implement an immutable class ?

Last Answer : Ans. We can make a class immutable by 1. Making all methods and variables as private. 2. Setting variables within constructor. Public Class ImmutableClass{ private int member; ImmutableClass(int var){ member= ... (5); Now all members being private , you can't change the state of the object.

Description : What is an immutable class ?

Last Answer : Ans. Class using which only immutable (objects that cannot be changed after initialization) objects can be created.

Description : What is an Immutable Object ?

Last Answer : Ans. Object that can't be changed after instantiation.

Description : Why is String immutable in Java ?

Last Answer : Ans. 1. String Pool When a string is created and if the string already exists in the pool, the reference of the existing string will be returned, instead of creating a new object. If ... opening files, etc. Making it mutable might possess threats due to interception by the other code segment.

Description : Which of these about a set is not true? a) Mutable data type b) Allows duplicate values c) Data type with unordered values d) Immutable data type

Last Answer : Answer: d Explanation: A set is a mutable data type with non-duplicate, unordered values, providing the usual mathematical set operations.