Self Studies

Computer Science Test - 27

Result Self Studies

Computer Science Test - 27
  • Score

    -

    out of -
  • Rank

    -

    out of -
TIME Taken - -
Self Studies
Weekly Quiz Competition
  • Question 1
    5 / -1

    To prevent infection by a computer virus:

    Solution

    The most reliable way to make sure you are safe is to open an email attachment or click on a link is to scan it with anti-virus software.

     

  • Question 2
    5 / -1

    Consider a tuple tup1 = (10, 15, 25 and 30). Identify the statement that will result in an error

    Solution

    'tup1[2]=20' will make an error.

    Here, the first option 'print(tup1[2])' will display the value at the position.

    Therefore, print(tup1[2])=25. The starting position is 0.

    print(min(tup1)) will display the minimum value in that tuple.

    Here, print(min(tup1))=10

    print(len(tup1)) will give output as the tuple length.

    print(len(tup1)) = 4

    But, tup1[2]=20 means assigning a new value to the position.

    In tuples, values are constant.

    So, tup1[2]=20 will result in an error.

     

  • Question 3
    5 / -1

    Directions For Questions

    Which of the following statements correctly describe stack operations?

    (A) A stack follows the Last-In, First-Out (LIFO) principle.

    (B) The PUSH operation adds an element to the top of the stack.

    (C) The POP operation removes an element from the bottom of the stack.

    (D) A stack can be implemented using lists in Python.

    ...view full instructions

    Choose the correct answer from the options given below:

    Solution

    Statement (A) is correct: A stack follows the Last-In, First-Out (LIFO) principle, meaning the last element added is the first to be removed.

    Statement (B) is correct: The PUSH operation adds an element to the top of the stack.

    Statement (C) is incorrect: The POP operation removes an element from the top, not the bottom, of the stack.

    Statement (D) is correct: A stack can be implemented using Python lists, where append() is used for PUSH, and pop() is used for POP.

    Thus, the correct answer is (1) (A), (B), and (D) only.

     

  • Question 4
    5 / -1

    A text file student.txt is stored in the storage device. Identify the correct option out of the following options to open the file in read mode.

    (i) myfile = open('student.txt','rb')

    (ii) myfile = open('student.txt','w')

    (iii) myfile = open('student.txt','r')

    (iv) myfile = open('student.txt')

    Solution

    There are some codes to handle a file in a programming language.

    myfile=open('student. txt', 'w') is the mode that allows opening a file in write mode.

    myfile=open('student.txt', 'r') is the mode that open file in only read mode.

    myfile= open ('student.txt') is also allowed to open in reading mode.

     

  • Question 5
    5 / -1

    Which module is to be imported for working in binary file?

    Solution

    The pickle module implements binary protocols for serializing and de-serializing a Python object structure.

     

  • Question 6
    5 / -1

    What will be the output of the following program?

    tuple=("Check")*3

    print (tuple)

    Solution

    Here, Check will be treated as a string, not a tuple, as there is no comma after the element.

     

  • Question 7
    5 / -1

    Convert the following infix expression to postfix expression using stack:

    (A+B*(C-D)^E+(F/G)^H-I)

    Solution

     

  • Question 8
    5 / -1

    Solution

    The correct option is B

    A → III, B → I, C → IV, D → II

    Concept:

    Match the following:

    A: Modem → III: The device used for conversion between electric signals and digital bits.

    B: Ethernet card → I: A network adapter is used to set up a wired network.

    C: Repeater → IV: Regenerate the signals.

    D: Switch → II: Connect multiple computers.

     

  • Question 9
    5 / -1

    In python, Which of the following method  is used find weather the queue is empty or not?

    Solution

    The correct answer is option C.

    Concept:

    Queues:

    The queue is an abstract data structure, somewhat similar to Stacks.

    Unlike stacks, a queue is open at both ends. One end is always used to insert data (en queue) and the other is used to remove data (de queue). Queue follows the First-In-First-Out methodology, i.e., the data item stored first will be accessed first.

    Queue follows the principle of First In First Out (FIFO) and Last In Last Out (LILO)

    maxsize:

    The maximum number of items in the queue. 

    put(item): 

    Add something to the queue. Wait until a free spot becomes available if the queue is filled before adding the item. 

    qsize(): 

    Return the number of items in the queue.

    full():

    If there are maxsize items in the queue, return True. 

    get():

    A queue item can be removed and returned. Wait until an item is available if the queue is empty.

    empty():

    Return True if the queue is empty, False otherwise. Here queue is not empty because the still elements are there in the queue. Example:

    Explanation:

    from queue import Queue

    q=Queue(maxsize=10)

    q.put('A')

    q.put('AA')

    q.put('AAA')

    print(q.qsize())

    print(q.full())

    print(q.get())

    print(q.empty())

    Hence the correct answer is empty().

     

  • Question 10
    5 / -1

    Match List-I with List-II:

    Choose the correct answer from the options given below:

    Solution

    (A) DDL → (I) Used to define and modify database structures such as tables, indexes, and constraints (CREATE, ALTER, DROP).

    (B) DML → (III) Includes commands like INSERT, UPDATE, and DELETE, modifying database records.

    (C) DQL → (II) Used to retrieve data using the SELECT statement.

    (D) DCL → (IV) Grants and revokes user access permissions using commands like GRANT and REVOKE.

     

Self Studies
User
Question Analysis
  • Correct -

  • Wrong -

  • Skipped -

My Perfomance
  • Score

    -

    out of -
  • Rank

    -

    out of -
Re-Attempt Weekly Quiz Competition
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now