Previous Year Paper

UGC NET Paper 2: Computer Science 26th Nov 2021 (Previous Year Paper)

Held in 2021

100 questions120 minutes
With answers
Free

Paper last updated:

Practise under exam conditions

Take this paper as a timed mock test. Review your answers after you submit.

Attempt timed test

Questions & answers

Read the paper at your pace. Open an explanation when you need it.

Computer Science (100 questions)

Question 1

Match List I with List II

List IList II
(Software Process Model)(Description)
A.Waterfall ModelI.Software can be developed incrementally
B.Evolutionary ModelII.Requirement compromises are inevitable
C.Component‐based Software EngineeringIII.Explicit recognition of risk
D.Spiral DevelopmentIV.Inflexible partitioning of the project into stages
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (d)D.

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

Why this answer is correct

The correct answer is option 4. 

Solution :

List IList II
(Software Process Model)(Description)
A.Waterfall ModelIV.Inflexible partitioning of the project into stages
B.Evolutionary ModelI.Software can be developed incrementally
C.Component‐based Software EngineeringII.Requirement compromises are inevitable
D.Spiral DevelopmentIII.Explicit recognition of risk

 

  • The waterfall model is best suited if requirements are easily understandable & defined.
  • The spiral model is similar to the incremental development for a system, with more emphasis placed on risk analysis. The spiral model has four phases: Planning, Design, Construct, and Evaluation.

Question 2

In the context of Software Configuration Management (SCM), what kind of files should be committed to your source control repository?

A. Code files

B. Documentation files

C. Output files

D. Automatically generated files that are required for your system to be used

Choose the correct answer from the options given below:

  1. AOption (a)

    A and B only

  2. BOption (b)

    B and C only

  3. COption (c)

    C and D only

  4. DOption (d)

    D and A only

View answer & explanation

Correct answer

Answer: (a)A.

A and B only

Why this answer is correct

A. Code files: These include the source code files that make up the software system. It is necessary to include the entire codebase in the repository so that the entire system can be rebuilt and deployed if necessary so it need to be committed.

B. Documentation files: These include documentation that describes how the system is designed, how it works, and how to use it. This documentation should be stored in the repository so that it can be easily accessed and understood by developers and other stakeholders so it need to be committed.

D. Automatically generated files that are required for your system to be used : Some files that are automatically generated during the build process, such as binary files or executables, are also necessary for the system to be used. These files should also be committed to the repository, so that the entire system can be built and deployed from the repository.

C. Output files, like files generated during runtime, are not needed to be committed to the repository as they can be regenerated by the system.

Question 3

Identify the correct order of the following five levels of Capability Maturity Model (from lower to higher) to measure the maturity of an organisation's software process.

A. Defined

B. Optimizing

C. Initial

D. Managed

E. Repeatable

Choose the correct answer from the options given below

  1. AOption (a)

    C, A, E, D, B

  2. BOption (b)

    C, E, A, B, D

  3. COption (c)

    C, B, D, E, A

  4. DOption (d)

    C, E, A, D, B

View answer & explanation

Correct answer

Answer: (d)D.

C, E, A, D, B

Why this answer is correct

Points to Note :

Capability Maturity Model (CMM) is the strategy for improving the software process irrespective of the actual life cycle model used. It has 5 different level. Each level and its basis features are listed below :

  • Initial (Maturity level 1) - Adhoc
  • Repeatable (Maturity level 2) - Basic Project Management
  • Define(Maturity level 3) - Process Definition
  • Managed (Maturity Level 4 ) - Process Measurement
  • Optimizing (Maturity level 5) - Continuous process Improvement

Therefore the order of CMM from lower to higher is : Initial (C) - Repeatable (E) - Define (A) - Managed (D) - Optimizing (B)

Question 4

Given below are two statements, one is labelled as Assertion A and the other is labelled as Reason R

Assertion A : Software developers donot do exhaustive software testing in practice.

Reason R : Even for small inputs, exhaustive testing is too computationally intensive (e.g., takes too long) to run all the tests.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both A and R are true and R is the correct explanation of A

  2. BOption (b)

    Both A and R are true but R is NOT the correct explanation of A

  3. COption (c)

    A is true but R is false

  4. DOption (d)

    A is false but R is true

View answer & explanation

Correct answer

Answer: (a)A.

Both A and R are true and R is the correct explanation of A

Why this answer is correct

The correct answer is option 1.

Concept:

  • It is a Technique used in software development that tests all the possible combinations of a data set.
  • Exhaustive Testing means complete testing,when all the testers in your team are exhausted and when all the planned tests haven been executed.
  • Exhaustive process is a testing process and it cannot be done by the developers.
  • In any project Exhaustive Testing is impossible and it is a part of Quality Assurance Testing.
  • The developers writing the code and they think that their code is perfect until and unless Test Engineers find the defects.
  • The Total number of possible combinations is too big, and it is not computationally feasible to test all of them.

The Correct Answer is Both A and R are true and R is the Correct explanation of A

Question 5

Given below are two statements

Statement I : Cleanroom software process model incorporates the statistical quality certification of code increments as they accumulate into a system.

Statement II : Cleanroom software engineering follows the classic analysis, design, code, test, and debug cycle to software development and focussing on defect removal rather than defect prevention.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (c)C.

Statement I is true but Statement II is false

Why this answer is correct

The correct answer is option 3.

Explanation: 

 In Clean room approach of software engineering the development of software is based on five key strategies : 

  1. Formal specification
  2. Incremental development
  3. Structured programming
  4. Static verification
  5. Statistical testing of the system.

Software Development process of cleanroom software development strategy try to produce software with certifiable level of reliability. It focuses on defect prevention, rather than defect removal .

Read the following and answer the questions :

Consider a machine with 16 GB main memory and 32‐bits virtual address space, with page size as 4KB. Frame size and page size is same for the given machine.

Question 6

The number of bits reserved for the frame offset is ______

  1. AOption (a)

    22

  2. BOption (b)

    14

  3. COption (c)

    32

  4. DOption (d)

    8

View answer & explanation

Correct answer

Answer: (a)A.

22

Why this answer is correct

The correct answer is 22.

Key Points

  • According to the question, the total size of the main memory is 16 GB. The size of the virtual address space is 32 bits. The page size is 4KB. It is also given that the frame size and page size are the same for the given machine.
  • Converting all the units into bits. So, 16 GB= (24 x 210 x 210 x 210 x 23) bits = 237 bits.
  • 4KB= (22 x 210 x 23) bits = 215 bits.
  • So, the number of bits reserved for the frame offset is **= (237/ 215) = 222 **which is 22 units.

Thus the correct answer is 22.

Additional Information

  • In an operating system, the page is referred to as a continuous memory block with a fixed memory size. But it is virtual memory. The page is the smallest data set unit in the virtual memory.
  • The frame in the operating system is referred to as a fixed length of the physical block. The frame is often found on the RAM block.

Question 7

Find number of pages required for the given virtual address space

  1. AOption (a)

    210

  2. BOption (b)

    220

  3. COption (c)

    230

  4. DOption (d)

    212

View answer & explanation

Correct answer

Answer: (b)B.

220

Why this answer is correct

The correct answer is 220.

Key Points

  • According to the question, the total size of the main memory is 16 GB. The size of the virtual address space is 32 bits. The page size is 4KB. It is also given that the frame size and page size are the same for the given machine.
  • So, the virtual memory size is = 232 Bytes.
  • frame size = page size= 4KB= (22 x 210) Bytes = 212 Bytes.
  • So, the number of pages required for the given virtual address space is = (232/ 212) = 220.
  • Frame size = Page size = 220.

Thus the correct answer is 220.

Additional Information

  • The page is referred to as a continuous memory block with a fixed memory size in an operating system. But it is virtual memory. The page is the smallest data set unit in the virtual memory.
  • The frame in the operating system is referred to as a fixed length of the physical block. The frame is often found on the RAM block.

Question 8

What is the minimum number of bits needed for the physical address?

  1. AOption (a)

    28

  2. BOption (b)

    34

  3. COption (c)

    24

  4. DOption (d)

    12

View answer & explanation

Correct answer

Answer: (b)B.

34

Why this answer is correct

The correct answer is 34.

Key Points

  • According to the question, the total size of the main memory is 16 GB. The size of the virtual address space is 32 bits. The page size is 4KB. It is also given that the frame size and page size are the same for the given machine.
  • Converting all the units into Bytes. So, the main memory size is = (24 x 210 x 210 x 210 )Bytes = 234 Bytes.​

Thus the correct answer is 34.

Additional Information

  • The page is referred to as a continuous memory block with a fixed memory size in an operating system. But it is virtual memory. The page is the smallest data set unit in the virtual memory.
  • The frame in the operating system is referred to as a fixed length of the physical block. The frame is often found on the RAM block.

Question 9

What is the size of page table for handling the given virtual address space, given that each page table entry is of size 2 bytes?

  1. AOption (a)

    2MB

  2. BOption (b)

    2KB

  3. COption (c)

    32MB

  4. DOption (d)

    12KB

View answer & explanation

Correct answer

Answer: (a)A.

2MB

Why this answer is correct

The correct answer is 2 MB.

Key Points

  • According to the question, the total size of the main memory is 16 GB. The size of the virtual address space is 32 bits. The page size is 4KB. It is also given that the frame size and page size are the same for the given machine. It is also given that each page table entry is of size 2 bytes.
  • Converting all the units into bits. So, the physical memory size is = 234 Bytes.
  • frame size = page size= 4KB= (22 x 210) Bytes = 212 Bytes.
  • So, the number of pages = (232/ 212) Bytes = 220 Bytes.
  • So, the size of the page table =  number of pages x page table entry = 220 x 2 Bytes = 220 x 16bits ≈ 2MB.

Thus the correct answer is 2 MB.

Additional Information

  • The page is referred to as a continuous memory block with a fixed memory size in an operating system. But it is virtual memory. The page is the smallest data set unit in the virtual memory.
  • The frame in the operating system is referred to as a fixed length of the physical block. The frame is often found on the RAM block.

Question 10

If a process of size 34KB is to be executed on this machine, then what will be the size of internal fragmentation for this process?

  1. AOption (a)

    4KB

  2. BOption (b)

    Zero

  3. COption (c)

    1KB

  4. DOption (d)

    2KB

View answer & explanation

Correct answer

Answer: (d)D.

2KB

Why this answer is correct

The correct answer is 2 KB.

Key Points

  • According to the question, the total size of the main memory is 16 GB. The size of the virtual address space is 32 bits. The page size is 4KB. It is also given that the process size is 34 KB.
  • So, the internal fragmentation can be calculated by dividing the process size by page size. If there is no reminder then there is no internal fragmentation. But if there is a remainder, then the remainder is known as internal fragmentation.
  • So, the internal fragmentation is =  34KB/ 4KB. After the division, the result is 8 and the remainder is 2. So, the internal fragmentation is 2KB.

Thus the correct answer is 2KB.

Additional Information

  • Internal fragmentation happens when the partition of the memory divides into a fixed memory size.
  • The page is referred to as a continuous memory block with a fixed memory size in an operating system. But it is virtual memory. The page is the smallest data set unit in the virtual memory.
  • The frame in the operating system is referred to as a fixed length of the physical block. The frame is often found on the RAM block.

Question 11

Match List I with List II

List IList II
A.Odd FunctionI.NAND gate
B.Universal GateII.XOR gate
C.2421 codeIII.Amplification
D.BufferIV.Self‐Complementing
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (b)B.

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

Why this answer is correct

Key Points

  • NAND & NOR gates are called universal gates. Because we can implement any Boolean function, which is in sum of products form by using NAND gates alone. Similarly, we can implement any Boolean function, which is in product of sums form by using NOR gates alone.
  • The output of Ex-OR gate is ‘1’, when odd number of ones present at the inputs. Hence, the output of Ex-OR gate is also called as an odd function.
  • 2421 is a self-complementing code. Self-complementing codes provide the 9’s complement of a decimal number, just by interchanging 1’s and 0’s in its equivalent 2421 representation.
  • A buffer, is a basic logic gate that passes its input, unchanged, to its output. Its behavior is the opposite of a NOT gate. The main purpose of a buffer is to regenerate the input, usually using a strong high and a strong low.

Question 12

Which of the following is not an example of pseudo‐instruction?

  1. AOption (a)

    ORG

  2. BOption (b)

    DEC

  3. COption (c)

    END

  4. DOption (d)

    HLT

View answer & explanation

Correct answer

Answer: (d)D.

HLT

Why this answer is correct

The correct answer is HLT.

Key Points

  • ​A pseudo-instruction is an instruction in assembly language that is not directly translated into a single machine code instruction but is instead used by the assembler to perform tasks such as setting memory addresses or marking the end of a program.
  • ORG (origin) sets the starting address for the program or data.
  • DEC (declare) is used to define constants or allocate storage.
  • END marks the end of the source code.

However, HLT (halt) is an actual machine instruction used to stop the execution of the processor. Therefore, HLT is not a pseudo-instruction.

Thus, the correct answer is 4) HLT.

Additional Information

  • A pseudo-op is associated with nursing instruction in the assembly program.
  • A pseudo-operation usually referred to as a pseudo-op, is associated in Nursing instruction with the assembly program that doesn't generate any computer code. The assembly program resolves pseudo-ops throughout the assembly, in contrast to machine directions, that area unit is resolved solely at runtime. Pseudo-ops area units are typically referred to as assembly program directions, assembly program operators, or assembly program directives.
  • In general, pseudo-ops offer the assembly program data concerning knowledge alignment, block and section definition, and base register assignment. The assembly program conjointly supports pseudo-ops that offer the assembly program data concerning floating purpose constants and symbolic programme data (dbx).

Question 13

The characteristics of the combinational circuits are :

A. Output at any time is function of inputs at that time

B. Contains memory elements

C. Do not have feedback paths

D. Clock is used to trigger the circuits to obtain outputs

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    B and C only

  3. COption (c)

    A and C only

  4. DOption (d)

    B and D only

View answer & explanation

Correct answer

Answer: (c)C.

A and C only

Why this answer is correct

Key Points

 The combinational circuit is a circuit in which we combine the different gates in the circuit, for example, encoder, decoder, multiplexer and demultiplexer.

Some of the characteristics of combinational circuits are following −

  • The output of a combinational circuit at any instant of time depends only on the levels present at input terminals.
  • The combinational circuit does not use any memory. The previous state of input does not have any effect on the present state of the circuit.
  • They do not have any feedback arrangement.
  • A combinational circuit can have an n number of inputs and m number of outputs.

Question 14

Given below are two statements

Statement I : CISC computers have a large of number of addressing modes.

Statement II : In RISC machines memory access is limited to load and store instructions.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (a)A.

Both Statement I and Statement II are true

Why this answer is correct

CISC computers have a large of number of addressing modes:

CISC processor have instructions that occupy more than one memory word.

A single instruction has several low-level instructions. Each instruction requires more than one clock cycle.

CISC instructions have complex and large number of addressing modes and complex instructions This makes decoding of instruction complex.

​Statement I is TRUE.

In RISC machines, memory access is limited to load and store instructions:

The small set of instructions of a typical RISC processor consists mostly of register-to-register operations, with only simple load and store operations.

Hence, in RISC machines, memory access is limited to such instructions only (load and store).

Statement II is TRUE.

Question 15

Which of the following statement is true?

A. Control memory is part of the hardwired control unit.

B. Program control instructions are used to alter the sequential flow of the program.

C. The register indirect addressing mode for accessing memory operand is similar to displacement addressing mode.

D. CPU utilization is not affected by the introduction of Interrupts.

  1. AOption (a)

    A

  2. BOption (b)

    B

  3. COption (c)

    C

  4. DOption (d)

    D

View answer & explanation

Correct answer

Answer: (b)B.

B

Why this answer is correct

Control memory is part of the hardwired control unit: 

FALSE. Control memory is not a part of Control Unit.

Program control instructions are used to alter the sequential flow of the program: 

TRUE. Program control instructions modify or change the flow of a program. It is the instruction that alters the value of the program counter, due to which the execution of the program changes.

The register indirect addressing mode for accessing memory operand is similar to displacement addressing mode: 

FALSE. In Register Indirect Addressing Mode, any selected register would include the address of an operand instead of the operand itself but this is not the case with Displacement Addressing Mode.

CPU utilisation is not affected by the introduction of Interrupts: 

FALSE. CPU utilisation is affected by the introduction of interrupts because as soon as the interrupt occurs, CPU remains idle until and unless the interrupt is resolved or the next process comes for CPU utilisation.

Question 16

Which of the following statement is False?

  1. AOption (a)

    Packet switching leads to better utilization of bandwidth resources than circuit switching.

  2. BOption (b)

    Packet switching results in less variation in the delay than circuit switching.

  3. COption (c)

    Packet switching sender and receiver can use any bit rate, format or framing method unlike circuit switching.

  4. DOption (d)

    Packet switching can lead to reordering unlike circuit switching.

View answer & explanation

Correct answer

Answer: (b)B.

Packet switching results in less variation in the delay than circuit switching.

Why this answer is correct

The correct answer is option (2)

  • Circuit switching has 3 phase: connection establishment, Data transfer and tear down, while packet switching has only one phase data transfer based on routing,
  • Circuit switching has less variation in packets than packet switching.
  • Circuit switching send packet in order, while packet switching send out of order, so reordering needs in packet switching.
  • In packet switching no resource reservation needed while circuit switching has resource reservation so packet switching leads to better utilization of resources i.e. bandwidth.
  • In circuit switching no packet processing needed at intermediate path routers while in packet switching needed. So, packet switching require more packet processing time than circuit switching.

Additional InformationHere the figure for packet switching and circuit switching:

Question 17

The Octal equivalent of hexadecimal (D.C)16 is :

  1. AOption (a)

    (15.6)8

  2. BOption (b)

    (61.6)8

  3. COption (c)

    (15.3)8

  4. DOption (d)

    (61.3)8

View answer & explanation

Correct answer

Answer: (a)A.

(15.6)8

Why this answer is correct

The correct option is (1)

Concept:-

In the number system, we know hexadecimal is base 16 and octal is base-8 

Calculation:

To convert hexadecimal D.C to octal,

First, convert D.C16 into decimal

= D16 

= D × 160 + C × 16-1

= 13.7510

Now, we have to convert 13.7510 to octal

13/8 = 1 with remainder 5

1/8 = 0 with remainder 1

13 = 15 ----(1)

For converting decimal fraction 0.75 to octal number,

0.75 × 8 = 6 + 0

0.75 = 0.6 ---(2)

∴ 13.7510 = 15.68 ------ [ from (1) and (2)

Hence, hexadecimal number D.C converted to octal is equals: 15.6

Question 18

A digital computer has a common bus system for 8 registers 16 bits each. How many multiplexers are required to implement common bus? What size of multiplexers is required?

  1. AOption (a)

    16, 8 × 1

  2. BOption (b)

    8, 16 × 1

  3. COption (c)

    8, 8 × 1

  4. DOption (d)

    16, 16 × 1

View answer & explanation

Correct answer

Answer: (a)A.

16, 8 × 1

Why this answer is correct

<br>

Key PointsThe number of multiplexers required to construct the bus is equal to n,

where n is the number of bits in each register.

The size of each multiplexer must be k : 1

since it multiplexes k data lines, where k is the number of registers.

Therefore

If there are 8 registers of 16 bits each, then we need 16 multiplexers, each of which is an 8: 1 multiplexer to create the 16-bit data bus.

Additional Information 

  • Since a computer has many registers, paths must be provided to transfer information from one register to another
  • An efficient scheme for transferring information between registers in a multiple-register configuration is a common bus system. A bus structure consists of a set of common lines, one for each bit of a register, through which binary information is transferred one at a time.
  • Control signals determine which register is selected by the bus during each particular register transfer.
  • Bus systems can be designed using multiplexers and tri-state buffers.

 

Bus System for four 4-bit registers:

Question 19

Given below are two statements

Statement I : Telnet, Ftp, Http are application layer protocol

Statement II : The Iridium project was planned to launch 66 low orbit satellites.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (a)A.

Both Statement I and Statement II are true

Why this answer is correct

Telnet: 

Teletype Network. It is an application layer protocol that enables one computer to connect to local computer. It is a used as a standard TCP/IP protocol for virtual terminal service. It provides bi-directional text-oriented communication in the network.

FTP: 

File Transfer Protocol. It is a standard communication protocol present in application layer that is used for the transfer computer files from a server to a client on a computer network. It is built on a client-server model architecture using separate control and data connections between the client and the server.

HTTP: 

Hyper Text Transfer Protocol. It is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. It is used to load pages using hyperlinks.

Statement I is TRUE.

Iridium Project: 

The Iridium satellite constellation provides L band voice and data information coverage to satellite phones, pagers and integrated transceivers over the entire surface of Earth. Iridium Communications owns and operates the constellation, additionally selling equipment and access to its services. In this project, 66 low orbit satellites were planned to launch.

Statement II is TRUE.

Question 20

Arrange the following in the increasing order of complexity.

A. I/O Module

B. I/O processor

C. I/O Channel

D. DMA

Choose the correct answer from the options given below

  1. AOption (a)

    D, C, B, A

  2. BOption (b)

    C, D, A, B

  3. COption (c)

    A, B, C, D

  4. DOption (d)

    A, D, C, B

View answer & explanation

Correct answer

Answer: (d)D.

A, D, C, B

Why this answer is correct

The correct answer is A, D, C, B

Key Points

  • ​A. I/O Module: The simplest component. It manages basic input/output operations and communication between the CPU and peripherals.
  • D. DMA (Direct Memory Access): DMA allows data to be transferred directly between memory and peripherals without involving the CPU, making it more efficient than an I/O module but still simpler than an I/O channel or processor.
  • C. I/O Channel: A more complex mechanism that manages communication between memory and I/O devices. It is a more advanced solution than DMA because it controls multiple I/O operations and has its own dedicated path.
  • B. I/O Processor: The most complex, as it acts as a separate processor dedicated to handling all I/O tasks, independently managing I/O devices and reducing the CPU's workload.

Thus, the increasing order of complexity is: A (I/O Module) < D (DMA) < C (I/O Channel) < B (I/O Processor).

Additional Information

  • The DMA mode of information transfer reduces CPU’s overhead in handling I/O operations. It additionally permits correspondence in CPU and I/O operations. Such correspondence is critical to avoid wastage of valuable CPU time whereas handling I/O devices whose speeds area unit abundant slower as compared to CPU.
  • The construct of DMA operation is extended to alleviate the CPU away from obtaining involved in the execution of I/O operations. this provides rise to the event of special-purpose processors referred to as Input-Output Processors (IOP) or IO channels.

Question 21

The cache coherence problem can be solved

A. by having multiport memory

B. allow only nonshared data to be stored in cache

C. using a snoopy cache controller

D. uisng memory interleaving

Choose the correct answer from the options given below :

  1. AOption (a)

    A and C only

  2. BOption (b)

    B and C only

  3. COption (c)

    D and C only

  4. DOption (d)

    B and D only

View answer & explanation

Correct answer

Answer: (b)B.

B and C only

Why this answer is correct

Explanation:

B. Allow only nonshared data to be stored in cache

  • Explanation: One way to prevent cache coherence issues is to only allow nonshared data to be cached. In multiprocessor systems, coherence problems arise when multiple processors modify the same data stored in their local caches. By only caching nonshared (private) data, you eliminate the possibility of multiple processors modifying the same cached data, thus avoiding coherence problems entirely. While this method limits caching for shared data, it is an effective solution for avoiding cache coherence issues.

C. Using a snoopy cache controller

  • Explanation: A snoopy cache controller is one of the most common and efficient ways to handle the cache coherence problem in shared memory multiprocessor systems. In this approach, caches "snoop" on the bus, monitoring memory transactions initiated by other processors. If a cache sees that another processor is trying to read or write to an address it has cached, it takes appropriate action (like updating or invalidating its cache entry) to ensure coherence. This approach is widely used in practice, especially with MESI (Modified, Exclusive, Shared, Invalid) cache coherence protocols.

Why A and D are not correct:

  • A. Multiport memory: While multiport memory allows multiple processors to access memory simultaneously, it doesn't directly solve the cache coherence problem. It helps with memory access but doesn't coordinate or ensure that cached copies across processors remain consistent.
  • D. Memory interleaving: Memory interleaving improves memory access speed by splitting memory into sections that can be accessed simultaneously. However, it does not address cache coherence, as it is a technique for optimizing memory access rather than ensuring data consistency between caches.

Conclusion:

  • B (allowing only nonshared data to be cached) avoids the coherence problem by restricting the types of data that can be cached.
  • C (snoopy cache controller) actively monitors and ensures that shared data in caches remains consistent, solving the coherence problem efficiently.

Therefore, B and C are correct solutions, and the correct answer is: 2) B and C only.

Question 22

The reverse Polish notation of the following infix expression [A*{B+C*(D+E)}] / {F*(G+H)} is __________.

  1. AOption (a)

    ABCDE+*+FGH+/

  2. BOption (b)

    ABCDE*++FGH+/

  3. COption (c)

    ABCDE+*+FGH+/

  4. DOption (d)

    ABCDE+**+FGH+*/

View answer & explanation

Correct answer

Answer: (a)A.

ABCDE+*+FGH+/

Why this answer is correct

The correct answer is ABCDE+*+FGH+/.

Key Points

  • The  Reverse Polish Notation (RPN) is also referred to as a postfix notation where the operands are followed by the operators.
  • The Reverse Polish Notation (RPN) follows BODMAS mathematical notations.
  • The Reverse Polish Notation (RPN) keeps rotating until all the operators reached their destinations.
  • Here the given notation is [A{B+C*(D+E)}] / {F*(G+H)}*.
  • After the first shift, the notation will be [A{B+CDE+}] / {FGH+}. Because according to the BODMAS rule, the **degree of multiplication ()** is higher than the addition (+). So, multiplication will perform first and both the multiplication operators shift to the right of the operand.
  • After the second shift the notation will be [A{B+CDE+*}] / FGH+**.
  • After the third shift the notation will be [A{BCDE+*+}] / FGH+**.
  • After the fourth shift the notation will be ABCDE++* / FGH+**.
  • After the fifth shift the notation will be ABCDE++* FGH+/. Because now only the division (/) operator is left.  So, the division operator shifts to the right of the operand.

Thus the correct answer is ABCDE++* FGH+/.

Additional Information

  • Reverse Polish notation (RPN), additionally called reverse Łukasiewicz notation, Polish postfix notation, is a mathematical notation wherein operators observe their operands, in the assessment of Polish notation (PN), wherein operators precede their operands. It does now no longer want any parentheses so long as every operator has a set variety of operands. The description "Polish" refers back to the nationality of truth seeker Jan Łukasiewicz who invented Polish notation in the year 1924.

Question 23

Match List I with List II

List IList II
A.Data Link LayerI.True end‐to‐end layer
B.Network LayerII.Token Management
C.Transport LayerIII.Produce billing information
D.Session LayerIV.Piggybacking
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (a)A.

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

Why this answer is correct

The correct answer is option (1)

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

Key Points

  • Piggybacking is a technique for attaching acknowledgment to a data packet that is being sent out. When a data frame is received in two-way communication, the receiver pauses before sending the control frame back to the sender.
  • The receiver waits for the next data packet to arrive from its network layer. This outgoing data frame is then linked to the delayed acknowledgment. Piggybacking is a technique for temporarily delaying acknowledgment so that it can be attached to the next outgoing data frame.
  • The network layer allows variable-length network packets to be transferred from a source to a target host through one or more networks.
  • The transport layer provides a complete end-to-end communication solution. The transport layer is used by TCP/IP to efficiently regulate communications between two hosts.
  • The Session Layer acts as a dialogue controller, allowing computers to communicate in either half-duplex or full-duplex mode. This layer is also in charge of token management, which prevents two users from accessing or performing the same essential operation at the same time.

Question 24

The address of class B host is to be split into subnets with 6‐bit subnet number. What is the maximum number of the subnets and the maximum number of hosts in each subnet?

  1. AOption (a)

    62 subnets and 262142 hosts

  2. BOption (b)

    64 subnets and 1024 hosts

  3. COption (c)

    64 subnets and hosts 262142

  4. DOption (d)

    62 subnets and 1022 hosts

View answer & explanation

Correct answer

Answer: (d)D.

62 subnets and 1022 hosts

Why this answer is correct

Maximum number of subnets,

= 26 - 2 = 62

  • Note that 2 is subtracted from 26=642 ^ 6 = 64
  • As per the RFC 950 specification, it reserves the subnet values consisting of all zeros and all ones, hence, reducing the number of available subnets by two.
  • Similarly, number of hosts =210−2=1022= 2 ^ \text{10} - 2 = 1022

Question 25

In Ethernet when Manchester coding is used, the bit rate is _________.

  1. AOption (a)

    Half the baud rate

  2. BOption (b)

    twice the baud rate

  3. COption (c)

    Thrice the baud rate

  4. DOption (d)

    Same as the baud rate

View answer & explanation

Correct answer

Answer: (a)A.

Half the baud rate

Why this answer is correct

In Manchester encoding bit rate is half the baud rate

CONCEPT: 

To transfer data (which is in form of bits) from one computer to another via various physical channels (Coaxial cables, Optical cables,.. ) 

Different encoding techniques are used in data communication at the physical layer.

Manchester encoding is a synchronous clock encoding technique to encode the clock and data of a synchronous bitstream.

A logic 0 is indicated by a 0 to 1 transition at the center of the bit and a logic 1 by 1 to 0 transition.Bit Rate: It is the number of bits that get transmitted in a second (a bit consists of 0's and 1's).

Baud Rate: It is the number of signal unit transmissions in a second (that represents those bits)

Bit rate is related to the speed of the transmission of the digital bit, while baud rate is related to the speed of change of symbols.

Relation between bit rate and baud rate:

 Baud Rate=Bit Rate×c×\text {Baud Rate} = \text {Bit Rate} \times c \times1r1 \over r 

where c = Case factor usually = 1 and r = data element per signal element

In Manchester coding, a data bit is encoded in two signal elements so r = \text {r = }(1 \over 2\). 

Since half of the bit duration level is up, and for half of the bit duration, it is down so two signal elements per data element, resulting in half the baud rate.

Question 26

In electronic mail, which of the following protocols allows the transfer of multimedia?

  1. AOption (a)

    IMAP

  2. BOption (b)

    SMTP

  3. COption (c)

    POP3

  4. DOption (d)

    MIME

View answer & explanation

Correct answer

Answer: (d)D.

MIME

Why this answer is correct

IMAP: 

  • Internet Message Access Protocol. It is an application layer protocol which is used to receive the emails from the mail server.
  • Messages can be accessed across multiple devices and the mail content can be read partially before it is downloaded into the system.

SMTP: 

  • Simple Mail Transfer Protocol. It is an application layer protocol where the client who wants to send the mail opens a TCP connection to the SMTP server and then sends the mail across the connection.
  • This protocol makes the server to be in an always-on listening mode.
  • As soon as it listens for a TCP connection from any client, the SMTP process initiates a connection through port 25.
  • After successfully establishing a TCP connection the client process sends the mail instantly.

POP3: 

  • Post Office Protocol. It is a simple protocol that only allows downloading messages from your Inbox to your local computer.
  • In POP3 the mail can only be accessed from a single device at a time.

MIME: 

  • Multipurpose Internet Mail Extension. It is a kind of add-on or a supplementary protocol that allows non-ASCII data to be sent through SMTP.
  • It allows the users to exchange different kinds of data files on the Internet: audio, video, images, application programs as well.
  • It is just a standard which allows the protocols to transfer multimedia mails.

Question 27

A message is encrypted using public key cryptography to send a message from sender to receiver. Which one of the following statements is True?

  1. AOption (a)

    Sender encrypts using receiver’s public key

  2. BOption (b)

    Sender encrypts using his own public key

  3. COption (c)

    Receiver decrypts using sender’s public key

  4. DOption (d)

    Receiver decrypts using his own public key

View answer & explanation

Correct answer

Answer: (a)A.

Sender encrypts using receiver’s public key

Why this answer is correct

In public key cryptography, both sender and receiver generate a pair of keys - Public key and Private key.

Public keys are known globally.

  • Anything that is encrypted using public key of A can be decrypted only using private key of A.
  • Anything that is encrypted using private key of A can be decrypted only using public key of A.
  • Anything that is encrypted using public key of B can be decrypted only using private key of B.
  • Anything that is encrypted using private key of B can be decrypted only using public key of B.

Hence, Sender encrypts using receiver's public key.

Question 28

Which of the following statements are true?

A. Frequency division multiplexing technique can be handled by digital circuits.

B. Time division multiplexing technique can be handled by analog circuits

C. Wavelength division multiplexing technique is used with optical fiber for combining two signals.

D. Frequency division multiplexing technique can be applied when the bandwidth of a link is greater than the bandwidth of the signals to be transmitted.

Choose the correct answer from the options given below :

  1. AOption (a)

    B and D only

  2. BOption (b)

    C and D only

  3. COption (c)

    A and D only

  4. DOption (d)

    B and A only

View answer & explanation

Correct answer

Answer: (b)B.

C and D only

Why this answer is correct

Key Points

 Frequency-division multiplexing:

In telecommunications, frequency-division multiplexing (FDM) is a technique by which the total bandwidth available in a communication medium is divided into a series of non-overlapping frequency bands, each of which is used to carry a separate signal. 

For example, the coaxial cable used by cable television systems has a bandwidth of about 1000 MHz, but the passband of each television channel is only 6 MHz wide, so there is room for many channels on the cable.

Time-division multiplexing:

Time-division multiplexing (TDM) is a method of transmitting and receiving independent signals over a common signal path by means of synchronized switches at each end of the transmission line so that each signal appears on the line only a fraction of time in an alternating pattern.

This method transmits two or more digital signals or analog signals over a common channel.

It can be used when the bit rate of the transmission medium exceeds that of the signal to be transmitted.

Wavelength-division multiplexing:

In WDM, the optical signals from different sources or (transponders) are combined by a multiplexer, which is essentially an optical combiner.

They are combined so that their wavelengths are different.

The combined signal is transmitted via a single optical fiber strand. At the receiving end, a demultiplexer splits the incoming beam into its components and each of the beams is sent to the corresponding receivers.

WDM allows communication in both directions in the fiber cable.

Question 29

Which of the following statements are true?

A. X.25 is connection‐oriented network

B. X.25 doesn’t support switched virtual circuits.

C. Frame relay service provides acknowledgements.

D. Frame relay service provides detection of transmission errors.

Choose the correct answer from the options given below :

  1. AOption (a)

    A and D only

  2. BOption (b)

    B and D only

  3. COption (c)

    C and D only

  4. DOption (d)

    B and C only

View answer & explanation

Correct answer

Answer: (a)A.

A and D only

Why this answer is correct

A - X.25 is connection‐oriented network: True

  • X.25 is an International Telecommunications Union - T standard protocol suite for packet-switched data communication in wide area networks.
  • It usually allows various logical channels to make use of same physical line and hence, it is a connection-oriented network.

B - X.25 doesn’t support switched virtual circuits: False

  • X.25 is an International Telecommunications Union - T standard protocol suite for packet-switched data communication in wide area networks.
  • It supports switched virtual circuits and permanent circuits.​

C - Frame relay service provides acknowledgements: False

  • Frame Relay is a packet switching technology that fragments packets into transmission units called frames and send it at high-speed through a digital network.
  • It establishes an exclusive connection during the transmission period called virtual connection. In frame relay network, there are no acknowledgements sent from the switches back to the sender.

D - Frame relay service provides detection of transmission errors: True

  • Frame Relay is a packet switching technology that fragments packets into transmission units called frames and send it at high-speed through a digital network.
  • The frame relay network will detect errors with the frame's FCS, discarding any frames found to be in error.

Question 30

Let G(x) be the generator polynomial used for CRC checking. The condition that should be satisfied by the G(x) to catch all errors consisting of an odd number of inverted bits is :

  1. AOption (a)

    (x + 1) is factor of G(x)

  2. BOption (b)

    (x ‐ 1) is factor of G(x)

  3. COption (c)

    (x2 + 1) is factor of G(x)

  4. DOption (d)

    (1 ‐ x2) is factor of G(x)

View answer & explanation

Correct answer

Answer: (a)A.

(x + 1) is factor of G(x)

Why this answer is correct

Cyclic Redundancy Check (CRC). It is one of the widely used parity bit based error detection scheme. It is a special number is appended to a block of data in order to detect any changes introduced during storage (or transmission). The CRC is recalculated on retrieval / reception and compared to the value originally transmitted, which can reveal certain types of error.

CRC presentation is based on -

  • Polynomial Division
  • Arithmetic over the field of integers mod 2 - Here, the arithmetic over the field of integers mod 2 is arithmetic on single bit binary numbers with all overflows ignored.

For all the errors to be found in an odd number of inverted bits, the condition should be that (x + 1) is a factor of G(x).

Question 31

Suppose a B+ tree is used for indexing a database file. Consider the following information :

size of the search key field = 10 bytes, block size = 1024 bytes, size of the record pointer = 9 bytes, size of the block pointer = 8 bytes.

Let K be the order of internal node and L be the order of leaf node of B+ tree, then (K, L) = ______.

  1. AOption (a)

    (57, 53)

  2. BOption (b)

    (50, 52)

  3. COption (c)

    (60, 64)

  4. DOption (d)

    (34, 31)

View answer & explanation

Correct answer

Answer: (a)A.

(57, 53)

Why this answer is correct

Order of Internal Node Calculation:

Key size = 10 bytes (given)

Child / Blobk pointer = 8 bytes (given)

NOTE: record pointer is not needed in non-leafy nodes.

We assume the order of internal node of B+ tree to be ‘K’.

  • Block size = (K – 1) * key size + K * 8
  • 1024 >= (K – 1) * 10 + K * 8
  • 1024 >= 10 * K – 10 + 8 * K
  • K <= (1024 + 10) / 18
  • K <= 1034 / 18
  • K <= 57.44
  • K = 57

Order of Leaf Node Calculation:

Key size = 10 Bytes (given)

Block Pointer = 8 Bytes (given)

Record Pointer = 9 Bytes (given)

Disk Block Size = 1024 Bytes (given)

We assume the order of leaf node of B+ tree to be 'L'.

  • ​Block size >= Block Pointer + L * (Key Field + Record Pointer)
  • 1024 >= 8 + L * (10 + 9)
  • 1024 >= 8 + L * (19)
  • L <= (1024 - 8) / 19
  • L <= 1016 / 19
  • L <= 53.47
  • L = 53

Question 32

Given a relation scheme R(x, y, z, w) with functional dependencies set F = {x → y, z → w}. All attributes take single and atomic values only.

A. Relation R is in First Normal FORM

B. Relation R is in Second Normal FORM

C. Primary key of R is xz

Choose the correct answer from the options given below :

  1. AOption (a)

    C only

  2. BOption (b)

    B and C only

  3. COption (c)

    A and C only

  4. DOption (d)

    B only

View answer & explanation

Correct answer

Answer: (c)C.

A and C only

Why this answer is correct

First Normal Form (1NF): If a relation contains a composite or multi-valued attribute, it violates the first normal form, or the relation is in first normal form if it does not contain any composite or multi-valued attribute. A relation is in first normal form if every attribute in that relation is singled valued attribute.

  • Relation R is in 1NF because it is given that for each attribute, R will have single and atomic values only.

Second Normal Form (2NF): It applies to relations with composite keys, that is, relations with a primary key composed of two or more attributes. A relation with a single-attribute primary key is automatically in at least 2NF. A relation that is not in 2NF may suffer from the update anomalies.

  • Relation R may or may not be 2NF.

Primary Key: It is the column or columns that contain values that uniquely identify each row in a table.

  • ​Since R has F = {x → y, z → w}, it shows that if x and z are taken together, they will uniquely identify each row in the relation R.

Question 33

Which of the following is used to create a database schema?

  1. AOption (a)

    DML

  2. BOption (b)

    DDL

  3. COption (c)

    HTML

  4. DOption (d)

    XML

View answer & explanation

Correct answer

Answer: (b)B.

DDL

Why this answer is correct

The correct answer is option (2)

Concept:-

DDL (Data Definition Language) statements are used for creating and defining the Database Schema. For example, CREATE, ALTER, DROP statements.

Key Points

  • A database schema is a skeleton structure that represents the database's logical view. A database schema can be created using SQL instructions. DDL, DML, DCL, and TCL are the four subgroups of SQL commands.
  • DML (Data Manipulation Language) statements are used for managing data within the database. For example, SELECT, UPDATE, INSERT statements.
  • The schema is the database's overarching description. Schema refers to the fundamental structure of how data will be stored in a database. Logical Schema, Physical Schema, and View Schema are the three sorts of schemes.

Additional InformationHTML:- HTML (Hypertext Markup Language) is the coding that organizes a web page's structure and content. Content could be organized using paragraphs, a list of bulleted points, or graphics and data tables, for example.

XML:- XML (Extensible Markup Language) is a markup language that is similar to HTML but does not have any predefined tags. Instead, we create our own tags that are tailored to our specific requirements. This is an effective method of storing data in a format that can be searched, stored, and shared.

Question 34

Match List I with List II

List IList II
System callsDescription
A.fork()I.Sends a signal from one process to another process
B.exec()II.Indicates termination of the current process
C.kill()III.Loads the specified program in the memory
D.exit()IV.Creates a child process
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (b)B.

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

Why this answer is correct

The correct answer is A ‐ IV, B ‐ III, C ‐ I, D ‐ II.

Key Points

  • fork(): The fork() is responsible for generating a new process or a child process in the system. Whatever program counter and registers are used by the parent process, the same program counter and registers are used by the child process.
  • exec(): The exec() is mainly used for replacing the running process and loading the memory with the new process.
  • kill(): The kill() system call is used for sending a signal from one process to another process.
  • exit(): The exit() system call is used for terminating the current process.

Thus the correct answer is A ‐ IV, B ‐ III, C ‐ I, D ‐ II​**.**

Additional Information

  • To interact with the operating system, the system call programmes are used. The system calls are used for providing services of operating systems such as creating process and managing it, managing the main memory. It is also used for accessing and managing files.
  • There are five different kinds of system calls. These are process control, file management, device management, controlling information and building communication.

Question 35

Consider the following 3 processes with the length of the CPU burst time given in milliseconds :

ProcessArrival TimeBurst Time
P108
P214
P329
<br>

What is the average waiting time for these processes if they are scheduled using preemptive shortest job first scheduling algorithm?

  1. AOption (a)

    5.6

  2. BOption (b)

    2.66

  3. COption (c)

    4.66

  4. DOption (d)

    6

View answer & explanation

Correct answer

Answer: (c)C.

4.66

Why this answer is correct

The correct answer is 4.66.

Key Points

  • From the given chart, let's prepare the Gantt chart.

  • From the above Gantt Chart, let's prepare the Turn Around Time i.e., Completion Time - Arrival Time.

  • Turn-around time of P1 is = 12-0= 12.

  • Turn-around time of P2 is = 5-1= 4.

  • Turn-around time of P3 is = 21-2= 19.

  • Let's calculate the waiting time for each process i.e., Waiting Time = Turn Around time - Burst Time.

  • Waiting time of P1 is = 12-8= 4.

  • Waiting time of P2 is = 4-4= 0.

  • Waiting time of P3 is = 19-9= 10.

  • So the average waiting time is = (4+0+10)/3 = 4.66.

Thus the correct answer is 4.66.

Additional Information

  • Turn Around Time(TAT): The Turn Around Time can be estimated by calculating the difference between the arrival time and the submitting time in the process.
  • Waiting Time(WT): When a process is in a ready state and waiting for accessing the CPU, then the process is in a waiting state.
  • Burst Time: When the CPU needs some time for executing a process, then it is known as burst time.

Question 36

A company is consuming parts in the manufacturing of other products. Each of the part is either manufactured within the company or purchased from the external suppliers or both. For each part, partnumber, partname is maintained. Attribute batchnumber is maintained if the consumed part is manufactured in the company. If part is purchased from external supplier, then supplier name is maintained. Which of the following constraints need to be considered when modelling class/subclass concepts in ERD for the given problem.

  1. AOption (a)

    Total specialization and overlapping constraints

  2. BOption (b)

    Disjoint constraint only

  3. COption (c)

    Partial participation

  4. DOption (d)

    Partial participation and disjoint constraints

View answer & explanation

Correct answer

Answer: (a)A.

Total specialization and overlapping constraints

Why this answer is correct

Disjoint Constraint: It requires that higher level entity set belongs to only one lower-level entity set. Let there be an account entity can be either a savings account or a current account, but cannot be both. Therefore, account is higher level entity and saving account and current account are lower level entities.

Partial Participation: It is not based on Generalisation / Specialisation. It allows the flexibility that the entity in the entity set may or may not participate in the relationship. Let there be an employee entity that manages department entity. Here, 'manages' is a relationship between employee and department. But not every employee manages department, only manager manages department. Hence, participation of employee entity is partial.

Overlapping Constraints: Here, the same higher level entity may belong to more than one lower-level entity set. Let there be a person entity that may belong to both customer entity and employee entity, hence, it is an overlapping constraint.

Total Specialisation: Each higher-level entity must belong to a lower-level entity set. Let us consider a college where an employee must be either teaching faculty, non-teaching faculty or both. Here, employee entity must belong to Lower level entity.

  • Considering the above constraints, Total Specialisation and Overlapping Constraints must be considered when modelling class / subclass concepts in ERD for the above problem.

Question 37

A transaction may be in one of the following states during its execution life cycle in concurrent execution environment.

A. FAILED

B. TERMINATED

C. PARTIALLY COMMITTED

D. COMMITTED

E. ACTIVE

Given a transaction in active state during its execution, find its next transitioned state from the options given below :

  1. AOption (a)

    A only

  2. BOption (b)

    Either A or C only

  3. COption (c)

    C only 

  4. DOption (d)

    D only 

View answer & explanation

Correct answer

Answer: (b)B.

Either A or C only

Why this answer is correct

Considering the above diagram, if a transaction is in active state, it will either go in:

  • Partially Committed - In case of completion of current transaction.
  • Failed - In case of interruption.

Question 38

In a file allocation system, the following allocation schemes are used :

A. Contiguous

B. Indexed

C. Linked allocation

Which of the allocation scheme(s) given above will not suffer from external fragmentation? Choose the correct answer from the options given below :

  1. AOption (a)

    A only

  2. BOption (b)

    B and C only

  3. COption (c)

    A and B only

  4. DOption (d)

    C only

View answer & explanation

Correct answer

Answer: (b)B.

B and C only

Why this answer is correct

The correct option is (2)

Concept:-

Internal fragmentation happens when a process is given more memory than it needs and only a little amount of space is left unused. When memory blocks are present but non-contiguous, external fragmentation occurs, and the impending memory request cannot be filled.

Key Points

  • External fragmentation is not a concern with linked and indexed allocation, whereas external fragmentation was a problem with contiguous allocation.
  • When it comes to allocating disc space, there are a variety of options. We must choose the optimal file allocation mechanism because it will have a direct impact on system performance and efficiency. The allocation approach allows us to access files as well as use the drive.
  • One of the most popular allocation methods is contiguous allocation. Contiguous allocation refers to allocating a block in such a way that all of the blocks on the hard disc receive the same physical block.
  • Another technique for file allocation is the indexed allocation approach. We have an additional block in the index allocation procedure, which is known as the index block.
  • The disadvantages of the contiguous allocation approach are overcome by the linked list allocation method. Each file is considered as a linked list of disc blocks in this file allocation approach.

Question 39

Given memory access time as p nanoseconds and additional q nanoseconds for handling the page fault. What is the effective memory access time if a page fault occurs once for every 100 instructions?

  1. AOption (a)

    p + q100\frac {q}{100}

  2. BOption (b)

    p+q100\frac {p + q} {100}

  3. COption (c)

    p + q

  4. DOption (d)

    p100\frac {p}{100} + q

View answer & explanation

Correct answer

Answer: (a)A.

p + q100\frac {q}{100}

Why this answer is correct

Memory Access Time = P nanoseconds

Page Fault Service Time = q nanoseconds

One page fault occurs for every 100 instructions

Formula: Effective Memory Access Time (EMAT) - Page fault rate * Page fault service time + (1 - Page fault rate) * Memory Access time

Calculation:

page fault rate = 1/100 (since, 1 page fault occurs for every 100 instructions}

EMAT = 1/100 * 9 + (1-1/100)* P

= q/100 + p - P/ 100

= p + q / 100, where (p / 100) is negligible

Question 40

Given below are three statements related to interrupt handling mechanism

A. Interrupt handler routine is not stored at a fixed address in the memory.

B. CPU hardware has a dedicated wire called the interrupt request line used for handling interrupts

C. Interrupt vector contains the memory addresses for speciaized interrupt handlers.

In the context of above statements, choose the correct answer from the options given below :

  1. AOption (a)

    A is TRUE only

  2. BOption (b)

    Both B and C are TRUE only

  3. COption (c)

    Both A and B are TRUE only

  4. DOption (d)

    Both A, C are TRUE only

View answer & explanation

Correct answer

Answer: (b)B.

Both B and C are TRUE only

Why this answer is correct

Interrupt handler routine is not stored at a fixed address in the memory: FALSE

For every interrupt, there must be interrupt handler. When an interrupt occurs, the microcontroller runs the interrupt service routine. For every interrupt, there is a fixed location in memory that holds the address of its interrupt service routine

CPU hardware has a dedicated wire called the interrupt request line used for handling interrupts: TRUE

The CPU hardware has a wire called the interrupt request line which is sensed by CPU after executing every instruction. When the CPU detects that a controller has asserted a signal on the interrupt request line, the CPU performs a state save and jumps to the interrupt handler routine at a fixed address in memory.

Interrupt vector contains the memory addresses for specialised interrupt handlers: TRUE

An interrupt vector is the memory location of an interrupt handler, which prioritizes interrupts and saves them in a queue if more than one interrupt is waiting to be handled.

Next five questions are based on the following passage.

Consider a domain consisting of three Boolean variables Toothache, Cavity, and Catch. The full joint distribution is a 2 × 2 × 2 table as shown in the figure below.

toothache¬toothache
catch¬catchcatch¬catch
cavity0.1080.0120.0720.008
¬cavity0.0160.0640.1440.576

Question 41

The marginal probability of cavity P(cavity) is ________.

  1. AOption (a)

    0.200

  2. BOption (b)

    0.216

  3. COption (c)

    0.120

  4. DOption (d)

    0.080

View answer & explanation

Correct answer

Answer: (a)A.

0.200

Why this answer is correct

The correct answer is option 1.

 Solution :

  P(cavity )= 0.108+0.012+0.072+0.08 = 0.200       

  Note : P(cavity) means the probability value where cavity is found irrespective of any other value.

Question 42

The probability of a cavity, given evidence of a toothache, P(cavity | toothache) is _________.

  1. AOption (a)

    0.400

  2. BOption (b)

    0.600

  3. COption (c)

    0.280

  4. DOption (d)

    0.216

View answer & explanation

Correct answer

Answer: (b)B.

0.600

Why this answer is correct

The correct answer is option 2.

Solution :

 therefore ,  

 P(cavity | toothache) = (0.108+0.012 ) / (0.108 +0.012 +0.016 +0.064 ) = 0.600

Question 43

The probability of a toothache, given evidence of a cavity, P(toothache | cavity) is ________.

  1. AOption (a)

    0.400

  2. BOption (b)

    0.600

  3. COption (c)

    0.280

  4. DOption (d)

    0.216

View answer & explanation

Correct answer

Answer: (b)B.

0.600

Why this answer is correct

The correct answer is option 2.

Solution :

 

 therefore ,  

P(toothache| cavity) = (0.108+0.012 ) / (0.108 +0.012 +0.072 + 0.008 ) = 0.600

Question 44

P(cavity V toothache) is ________.

  1. AOption (a)

    0.200

  2. BOption (b)

    0.120

  3. COption (c)

    0.280

  4. DOption (d)

    0.600

View answer & explanation

Correct answer

Answer: (c)C.

0.280

Why this answer is correct

The correct answer is option 3.

Solution :

 

P(cavity V toothache)  = P (cavity ) OR P ( toothache )  = ( 0.108 +0.012 +0.072 +0.008 +0.016 +0.064 ) = 0.28

Question 45

The probability for Cavity, given that either Toothache or Catch is true, P(Cavity | toothache V catch) is _______.

  1. AOption (a)

    0.6000

  2. BOption (b)

    0.5384

  3. COption (c)

    0.8000

  4. DOption (d)

    0.4615

View answer & explanation

Correct answer

Answer: (d)D.

0.4615

Why this answer is correct

The correct answer is option 4.

Solution :

 

    P( toothache V catch ) = (0.108 +0.012 +0.072 +0.016 +0.064 +0.144 ) = 0.416

      P ( (cavity ) ^ (toothache V catch ) )   =  ( 0.108 +0.012 +0.072 ) = 0.192 

     P (cavity | toothache V catch)  = 0.192 / 0.416 = 0.4615

Question 46

Consider following two statements :

Statement I : Relational database schema represents the logical design of the database.

Statement II : Current snapshot of a relation only provides the degree of the relation.

In the context to the above statements, choose the correct option from the options given below :

  1. AOption (a)

    Statement I is TRUE but Statement II is FALSE

  2. BOption (b)

    Statement I is FALSE but Statement II is TRUE

  3. COption (c)

    Both Statement I and Statement II are FALSE

  4. DOption (d)

    Both Statement I and Statement II are TRUE

View answer & explanation

Correct answer

Answer: (a)A.

Statement I is TRUE but Statement II is FALSE

Why this answer is correct

Relational database schema represents the logical design of the database: TRUE

A relational database schema is a set of table definitions, constraints, and derivation rules. A table scheme is a named set of attributes that draw their values from domains. Each column, or column set, spanned by a minimal uniqueness constraint is a candidate key.

Current snapshot of a relation only provides the degree of the relation: FALSE

Current snapshot of a relation provides the degree of the relation as well as the source of the database because of which, the size of the database increases as the changes are made to the source database.

Question 47

Consider the sentence below.

There is a country that borders both India and Pakistan.

Which of the following logical expressions express the above sentence correctly when the predicate Country(x) represents that x is a country and Borders(x, y) represents that the countries x and y share the border?

  1. AOption (a)

    ∃c Country(c) ∧ Border (c, India) ∧ Border (c, Pakistan)

  2. BOption (b)

    ∃c Country(c) ⇒ [Border (c, India) ∧ Border (c, Pakistan)]

  3. COption (c)

    [∃c Country(c)] ⇒ [Border (c, India) ∧ Border (c, Pakistan)]

  4. DOption (d)

    ∃c Border (Country(c), India ∧ Pakistan)

View answer & explanation

Correct answer

Answer: (a)A.

∃c Country(c) ∧ Border (c, India) ∧ Border (c, Pakistan)

Why this answer is correct

∃c Country(c) ∧ Border (c, India) ∧ Border (c, Pakistan): CORRECT

Explanation:

  1. Country(c) = All the countries
  2. Border(c, India) = For every c, select those c which shares border with India
  3. Border(c, Pakistan) = For every c, select those c which shares border with Pakistan
  4. ∧ - Do and operation for all the above three statements - All the 'c' will be selected which is a country and it shares a border with India and Pakistan each.

∃c Country(c) ⇒ [Border (c, India) ∧ Border (c, Pakistan)]: INCORRECT

Explanation:

  • ​Border(c, India) = For every c, select those c which shares border with India
  • Border(c, Pakistan) = For every c, select those c which shares border with Pakistan
  • Make a list of all the common 'c' found after AND operation between the above two.
  • Country(c) = All the countries
  • NOTE: '⇒' symbol is defined as 'implies'. That means, every country will share the border with India and Pakistan which is not necessarily true.

[∃c Country(c)] ⇒ [Border (c, India) ∧ Border (c, Pakistan)]: INCORRECT

Explanation:

  • Border(c, India) = For every c, select those c which shares border with India
  • Border(c, Pakistan) = For every c, select those c which shares border with Pakistan
  • Make a list of all the common 'c' found after AND operation between the above two.
  • Country(c) = All the countries
  • Make a list of all the countries 'c'.
  • NOTE: '⇒' symbol is defined as 'implies'. That means, every country will share the border with India and Pakistan which is not necessarily true.

∃c Border (Country(c), India ∧ Pakistan): INCORRECT

Explanation:

  • Border (Country(c), India ∧ Pakistan) is not correct statement.
  • Border(x, y) means x and y share a border, where x and y are countries but here, India ∧ Pakistan is given in place of 'y' which is semantically wrong.

Question 48

Which of the DBMS component ensures that concurrent execution of multiple operations on the database results into a consistent database state?

  1. AOption (a)

    Logs

  2. BOption (b)

    Buffer manager

  3. COption (c)

    File manager

  4. DOption (d)

    Transaction processing system

View answer & explanation

Correct answer

Answer: (d)D.

Transaction processing system

Why this answer is correct

The correct answer is option 4.

Explanation :

The transaction log or Logs are special DBMS table that contains a information about all the database transactions executed by the DBMS. These logs plays an important role to maintain the database consistency as well as integrity.

Buffer Manager is responsible for allocating disk space used by heap files, access methods and relational operators used to read, write, allocate or de allocate pages. 

File Manager is responsible for structuring the files and managing the file spaces. File manager works along with device manager to perform his responsibility.

Transaction processing system is a logical system that performs the transactions performed by DBMS. By transaction we refer a set of logical work which should be performed at a time. These plays an important role to maintain the database consistency as well as integrity.

Every transaction must have the following properties (ACID property):

  • Atomicity
  • Consistency
  • Isolation
  • Durability

Question 49

Given a fixed‐length record file that is ordered on the key field. The file needs B disk blocks to store R number of records. Find the average access time needed to access any record of the given file using binary search.

  1. AOption (a)

    B / 2

  2. BOption (b)

    B + R

  3. COption (c)

    B

  4. DOption (d)

    log2 B

View answer & explanation

Correct answer

Answer: (d)D.

log2 B

Why this answer is correct

To determine the average access time using binary search in a fixedlength record file ordered by the key field, we need to understand how binary search works on disk blocks.

In a binary search, the search space is halved after each comparison.

The total number of blocks is B.

Binary search will typically require log⁡2B\log_2 B comparisons to locate the correct block.

Thus, the average access time is proportional to the number of comparisons made to find a record in the file, which is approximately log⁡2B\log_2 B disk accesses.

Therefore, the correct answer is: 4) log⁡2B\log_2 B.

Question 50

Given the following STUDENT‐COURSE scheme : STUDENT (Rollno, Name, courseno) COURSE (courseno, coursename, capacity), where Rollno is the primary key of relation STUDENT and courseno is the primary key of relation COURSE. Attribute coursename of COURSE takes unique values only. Which of the following query(ies) will find total number of students enrolled in each course, along with its coursename.

A. SELECT coursename, count(*) 'total' from STUDENT natural join COURSE group by coursename;

B. SELECT C.coursename, count(*) 'total' from STUDENT S, COURSE C where S.courseno = C.courseno group by coursename;

C. SELECT coursename, count(*) 'total' from COURSE C where courseno in (SELECT courseno from STUDENT);

  1. AOption (a)

    A and B only

  2. BOption (b)

    C only

  3. COption (c)

    A only

  4. DOption (d)

    B only

View answer & explanation

Correct answer

Answer: (a)A.

A and B only

Why this answer is correct

SELECT coursename, count(*) 'total' from STUDENT natural join COURSE group by coursename;

  1. The above statement will first do a natural join between STUDENT and COURSE on the basis of common courseno.
  2. Then it will group the result by coursename.
  3. Finally, it will display the result - coursename and count(). count() will count the number of rows having a particular coursename.
  4. Finally, in the result, while displaying, count(*) column heading will become "total".

SELECT C.coursename, count(*) 'total' from STUDENT S, COURSE C where S.courseno = C.courseno group by coursename;

  1. The above statement will first find the STUDENT S and COURSE C where courseno between them is same.
  2. It will then group the result by coursename.
  3. Finally, it will display the result - for every coursename C, it will display coursename C and the number of rows having the coursename as C.
  4. Then, count(*) will be displayed as "total".

SELECT coursename, count(*) 'total' from COURSE C where courseno in (SELECT courseno from STUDENT);

It will give wrong result because, the inner query will have duplicate courseno in its final result and hence, using that, outer query will also generate incorrect number of rows.

Question 51

Given the following STUDENT‐COURSE scheme : STUDENT (Rollno, Name, Courseno) COURSE (Courseno, Coursename, Capacity), where Rollno is the primary key of relation STUDENT and Courseno is the primary key of relation COURSE. Attribute Coursename of COURSE takes unique values only. The number of records in COURSE and STUDENT tables are 3 and 5 respectively. Following relational algebra query is executed : R = STUDENT × COURSE

Match List I with List II in context to the above problem statement.

List IList II
A.Degree of table RI.15
B.Cardinality of table RII.NIL
C.Foreign key of relation STUDENTIII.6
D.Foreign key of relation COURSEIV.Courseno
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (a)A.

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

Why this answer is correct

Degree: The degree of relationship means the number of entities associated with a relationship in a relational model, that is, the number of columns in the final resultant table R = STUDENT x COURSE.

Formula: Sum of number of columns in all the tables. Hence, 3 + 3 = 6

Cardinality: It represents the number of times an entity of an entity set participates in a relationship set, that is, the number of tuples or rows in a relationship table R = STUDENT x COURSE.

Formula: Product of number of records in all the tables. Hence, 3 * 5 = 15

Foreign Key: A foreign key is a set of attributes in a table that refers to the primary key of another table. The foreign key links these two tables.

  • Foreign key for relation STUDENT - Courseno, present as foreign key in STUDENT and primary key in COURSE.
  • Foreign key for relation COURSE - NIL, no columns from relation COURSE is a primary key for STUDENT.

Question 52

Which of the following is logically equivalent?

A. ¬p → (q → r) and q → (p ∨ r)

B. (p → q) → r and p → (q → r)

C. (p → q) → (r → s) and (p → r) → (q → s)

Choose the correct answer from the options given below :

  1. AOption (a)

    A only

  2. BOption (b)

    A and B only

  3. COption (c)

    B and C only

  4. DOption (d)

    A and C only

View answer & explanation

Correct answer

Answer: (a)A.

A only

Why this answer is correct

A. ¬p → (q → r) and q → (p ∨ r)

For the above, we can make a truth table and compare them:

pqr¬pq → r¬p → (q → r)p v rq → (p v r)
FALSEFALSEFALSETRUETRUETRUEFALSETRUE
FALSEFALSETRUETRUETRUETRUETRUETRUE
FALSETRUEFALSETRUEFALSEFALSEFALSEFALSE
FALSETRUETRUETRUETRUETRUETRUETRUE
TRUEFALSEFALSEFALSETRUETRUETRUETRUE
TRUEFALSETRUEFALSETRUETRUETRUETRUE
TRUETRUEFALSEFALSEFALSETRUETRUETRUE
TRUETRUETRUEFALSETRUETRUETRUETRUE
  • We can see that both are equal, hence, they are equivalent.

 

B. (p → q) → r and p → (q → r)

For the above, we can make a truth table and compare them:

pqrp → q(p → q) → rq → rp → (q → r)
FALSEFALSEFALSETRUEFALSETRUETRUE
FALSEFALSETRUETRUETRUETRUETRUE
FALSETRUEFALSETRUEFALSEFALSETRUE
FALSETRUETRUETRUETRUETRUETRUE
TRUEFALSEFALSEFALSETRUETRUETRUE
TRUEFALSETRUEFALSETRUETRUETRUE
TRUETRUEFALSETRUEFALSEFALSEFALSE
TRUETRUETRUETRUETRUETRUETRUE
  • We can see that both are not equal, hence, they are not equivalent.

 

C. (p → q) → (r → s) and (p → r) → (q → s)

For the above, we can make a truth table and compare them:

pqrsp → qr → s(p → q)→(r → s)p → rq → s(p → r)→(q → s)
TRUEFALSEFALSEFALSEFALSETRUETRUEFALSETRUETRUE
TRUEFALSEFALSETRUEFALSETRUETRUEFALSETRUETRUE
TRUEFALSETRUEFALSEFALSEFALSETRUETRUETRUETRUE
TRUEFALSETRUETRUEFALSETRUETRUETRUETRUETRUE
TRUETRUEFALSEFALSETRUETRUETRUEFALSEFALSETRUE
TRUETRUEFALSETRUETRUETRUETRUEFALSETRUETRUE
TRUETRUETRUEFALSETRUEFALSEFALSETRUEFALSEFALSE
TRUETRUETRUETRUETRUETRUETRUETRUETRUETRUE
FALSEFALSEFALSEFALSETRUETRUETRUETRUETRUETRUE
FALSEFALSEFALSETRUETRUETRUETRUETRUETRUETRUE
FALSEFALSETRUEFALSETRUEFALSEFALSETRUETRUETRUE
FALSEFALSETRUETRUETRUETRUETRUETRUETRUETRUE
FALSETRUEFALSEFALSETRUETRUETRUETRUEFALSEFALSE
FALSETRUEFALSETRUETRUETRUETRUETRUETRUETRUE
FALSETRUETRUEFALSETRUEFALSEFALSETRUEFALSEFALSE
FALSETRUETRUETRUETRUETRUETRUETRUETRUETRUE
  • We can see that both are not equal, hence, they are not equivalent.

Question 53

Which of these statements about the floor and ceiling functions are correct?

Statement I : ⌊2x⌋=⌊x⌋+⌊x+(1/2)⌋\left\lfloor {2x} \right\rfloor = \left\lfloor x \right\rfloor + \left\lfloor {x + (1/2)} \right\rfloor  for all real number x

Statement II : ⌈x+y⌉=⌈x⌉+⌈y⌉\left\lceil {x + y} \right\rceil = \left\lceil x \right\rceil + \left\lceil y \right\rceil  for all real numbers x and y

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (c)C.

Statement I is true but Statement II is false

Why this answer is correct

Given:

Statement 1:

⌊2x⌋=⌊x⌋+⌊x+(1/2)⌋\left\lfloor {2x} \right\rfloor = \left\lfloor x \right\rfloor + \left\lfloor {x + (1/2)} \right\rfloor

Real number: All Positive numbers except zero.

suppose x = 1,2,3----

Take x = 1

⌊2×1⌋=⌊1⌋+⌊1+(1/2)⌋\left\lfloor {2\times 1} \right\rfloor = \left\lfloor 1 \right\rfloor + \left\lfloor {1 + (1/2)} \right\rfloor

⌊2⌋=⌊1⌋+⌊(3/2)⌋\left\lfloor {2} \right\rfloor = \left\lfloor 1 \right\rfloor + \left\lfloor { (3/2)} \right\rfloor

⌊2⌋=⌊1⌋+⌊1.5⌋\left\lfloor {2} \right\rfloor = \left\lfloor 1 \right\rfloor + \left\lfloor { 1.5} \right\rfloor

2 = 1 + 1

2 = 2

Statement 2:

⌈x+y⌉=⌈x⌉+⌈y⌉\left\lceil {x + y} \right\rceil = \left\lceil x \right\rceil + \left\lceil y \right\rceil

suppose x =  1.2 and  y = 8.6

⌈1.2+8.6⌉=⌈1.2⌉+⌈8.6⌉\left\lceil {1.2 + 8.6} \right\rceil = \left\lceil 1.2 \right\rceil + \left\lceil 8.6 \right\rceil

⌈9.8⌉=⌈1.2⌉+⌈8.6⌉\left\lceil {9.8} \right\rceil = \left\lceil 1.2 \right\rceil + \left\lceil 8.6 \right\rceil

10 = 2 + 9

10 =! 11

It shows  the Above Statements is false for x,y belongs to Real numbers.

The Correct Option is 1

Question 54

For which value of n is Wheel graph Wn regular?

  1. AOption (a)

    2

  2. BOption (b)

    3

  3. COption (c)

    4

  4. DOption (d)

    5

View answer & explanation

Correct answer

Answer: (b)B.

3

Why this answer is correct

Wheel Graph: Wn is a wheel graph. A wheel graph is a graph formed by connecting a single universal vertex to all vertices of a cycle.

Following are the examples of wheel graph:

  • We can see in the above diagrams that the polygon is connected to a vertex at the centre resulting in a wheel like formation.
  • It is regular for n = 3 or degree = 3.

Question 55

Let (X, ) be a semigroup. Furthermore, for every a and b in X, if a ≠ b, then ab ≠ b*a.

Based on the defined seimigroup, choose the correct equalities from the options given below:

A. For every a in X, a*a = a

B. For every a, b in X, a*b *a= a

C. For every a, b, c in X, a*b c= ac

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    B and C only

  4. DOption (d)

    A, B and C

View answer & explanation

Correct answer

Answer: (d)D.

A, B and C

Why this answer is correct

  1. "For every a in X, a*a = a" - TRUE

Proof - Let a*a = b.

=> (a * a) * a = b * a

=> Since (A, *) is a semigroup, * is closed and associative.

=> So, (a * a) * a = a * (a * a)

=> a * b = b * a, which is possible only if a = b.

=> Hence, a * a = a.
2. For every a, b in X, aba= a - TRUE

Proof - Let (a * b) * a = c

=> ((a * b) * a) * a = c * a

=> (a * b) * (a * a) = c * a

=> (a * b) * a = c * a

=> c * a = a ----- (1)

Similarly, a * (a + b + a) = a * c

=> a * (a * (b * a)) = a * c

=> (a * a) * (b * a) = a * c

=> a * (b * a) = a * c

=> (a * b) * a = a * c

=> c = a * c ----- (2)

From (1) and (2), we can get c * a = a * c => c = a.
3. For every a, b, c in X, abc= a*c - TRUE

Proof - Let (a * b) * c = d

=> (a * b) * c * c = d * c

=> a * b * c = d * c

=> d * c = d.

Similarly, a * (a * b * c) = a * d

=> a * a * (b * c) = a * d

=> a * (b * c) = a * d

=> a * d = d.

Thus, d * c = a * d = d.

=> Now, c * d * c = c * a * d = c * d

=> c = c * a * d = c * d

and d * c * a = a * d * a = d * a

=> d * c * a = a = d * a

Hence, a * c = (d * a) * (c * d)

=> d * (a * c) * d = d.

Therefore, a * b * c = a * c.

Question 56

Let us assume a person climbing the stairs can take one stair or two stairs at a time. How many ways can this person climb a flight of eight stairs?

  1. AOption (a)

    21

  2. BOption (b)

    24

  3. COption (c)

    31

  4. DOption (d)

    34

View answer & explanation

Correct answer

Answer: (d)D.

34

Why this answer is correct

Let us consider 1 as one step and 2 as two step. Consider the following conditions to reach the flight with 1 or 2.

  • 1, 1, 1, 1, 1, 1, 1, 1 - This can be done in 8C0 ways = 1.
  • 1, 1, 1, 1, 1, 1, 2 - This can be done in 7C1 ways = 7.
  • 1, 1, 1, 1, 2, 2 - This can be done in 6C2 ways = 15.
  • 1, 1, 2, 2, 2 - This can be done in 5C3 ways = 10.
  • 2, 2, 2, 2 - This can be done in 4C0 ways = 1

Total number of ways = 1 + 7 + 15 + 10 + 1 = 34

Question 57

Which of the following Graphs is(are) planar?

A. 

B. 

C.

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    B and C only

  3. COption (c)

    A only

  4. DOption (d)

    B only

View answer & explanation

Correct answer

Answer: (a)A.

A and B only

Why this answer is correct

The correct answer is option 1.

Explanation: 

Figure A can be redraw as:                                                                               

      Figure B can be redraw as :

 

 But, Figure C cant not be  redraw in such a way that no edge intersect each other.

 Therefore ,Figure A and B both are planar graph.

Important Points A graph is said to be planar if it can be drawn in such a way that no edges intersect each other, only intersect at the end points.

Question 58

Match List I with List II

List IList II
IdentityName
A.x + x = xI.Identity Law
B.x + 0 = xII.Absorption Law
C.x + 1 = 1III.Idempotent law
D.x + xy = xIV.Domination Law
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (c)C.

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

Why this answer is correct

Key Points

 

Identity Law:

A term OR‘ed with a “0” or AND‘ed with a “1” will always equal that term

  • A + 0 = A   A variable OR’ed with 0 is always equal to the variable
  • A . 1 = A    A variable AND’ed with 1 is always equal to the variable

Idempotent Law:

An input that is AND‘ed or OR´ed with itself is equal to that input

  • A + A = A    A variable OR’ed with itself is always equal to the variable
  • A . A = A    A variable AND’ed with itself is always equal to the variable

Absorptive Law :

This law enables a reduction in a complicated expression to a simpler one by absorbing like terms.

  • A + (A.B) = (A.1) + (A.B) = A(1 + B) = A  (OR Absorption Law)
  • A(A + B) = (A + 0).(A + B) = A + (0.B) = A  (AND Absorption Law)

Domination Law:

  • A+1=1 (OR Domination Law)
  • A⋅0=0 (AND Domination Law)

Question 59

Consider the following linear optimization problem :

Maximize Z = 6x + 5y

Subject to 2x ‐ 3y <= 5

x + 3y <= 11

4x + y <=15

and x>= 0, y >= 0.

The optimal solution of the problem is :

  1. AOption (a)

    15

  2. BOption (b)

    25

  3. COption (c)

    31.72

  4. DOption (d)

    41.44

View answer & explanation

Correct answer

Answer: (c)C.

31.72

Why this answer is correct

  • From 2x - 3y <= 5, if we put x = 0, then y = -(5/3) and if we put y = 0, then x = 5/2. Hence, we get (0, -1.67) and (2.5, 0).

Note - (We will reject (0, -1.67) as here y < 0).

  • From x + 3y <= 11, if we put x = 0, then y = 11/3 and if we put y = 0, then x = 11. Hence, we get (0, 3.67) and (11, 0).

Note - (Point (11, 0) will be rejected because it is outside the shaded region in the below graph).

  • From 4x + y <= 15, if we put x = 0, then y = 15 and if we put y = 0, then x = 15/4. Hence, we get (0, 15) and (3.75, 0).
  • Now, we will plot the graph using these points.
<br>
  • Our Maximum value lies in the shaded region ABCDE.
  • A, B and C are corner points whereas D and E are intersection points. We need to find the intersection points.
  • To find point D, we will use 4x + y <= 15 and x + 3y <= 11. We will multiply x + 3y <= 11 by 4 and subtract it from 4x + y <= 15. We will get y = 29/11. We will put this y in 4x + y <= 15 and get x = 34/11. Hence, point D = (34/11, 29/11) = (3.09, 2.63).
  • Similarly, for point E, we need 4x + y <= 15 and 2x - 3y <= 5. We will get x = 25/7 and y = 5/7. Hence, point E = (25/7, 5/7) = (3.57, 0.71)
  • Now, we will put all the values of point A, B, C, D and E in z = 6x + 5y and get the value of z:
  • A(0, 3.67) = 18.35
  • B(0, 0) = 0
  • C(2.5, 0) = 15
  • D(3.09, 2.63) = 31.69
  • E(3.57, 0.71) = 24.97
  • We can see that point D(3.09, 2.63) has the maximum value. Hence, 31.69 ~ 31.72 is the answer.

Question 60

How many ways are there to assign 5 different jobs to 4 different employees if every employee is assigned at least 1 job?

  1. AOption (a)

    1024

  2. BOption (b)

    625

  3. COption (c)

    240

  4. DOption (d)

    20

View answer & explanation

Correct answer

Answer: (c)C.

240

Why this answer is correct

The correct answer is option 3.

 Solution :

We ha 5 different jobs  and we have 4 employees, let they are  E1,E2,E3,E4.

Every employee is assigned at least 1 job.

Therefore the combinations can be like the following :

 

For Case 1,Number of ways : 5C2 * 3C1 * 2C1 * 1C1 =1032*1 = 60ways

For Case 2,Number of ways : 5C1 * 4C2 * 2C1 * 1C1 =562*1= 60ways

For Case 3,Number of ways : 5C1 * 4C1 * 3C2 * 1C1 =543*1 = 60ways

For Case 4,Number of ways : 5C1 * 4C1 * 3C1 * 2C2 =543*1 = 60ways

Total number of possible ways is = (60+60+60+60)=240

Question 61

Which of the following languages are not regular?

A. L = {(01)n 0k | n > k, k >= 0}

B. L = {cn bk an + k | n >= 0, k >= 0}

C. L = {0n 1k | n ≠ k}

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    B and C only

  4. DOption (d)

    A, B and C

View answer & explanation

Correct answer

Answer: (d)D.

A, B and C

Why this answer is correct

  1. L = {(01)n 0k | n > k, k >= 0} - NOT Regular

=> The above language is not regular because it has to maintain two variables "n" and "k". This is not possible in a regular language.
2. L = {cn bk an + k | n >= 0, k >= 0} - NOT Regular

=> Here also, we need to keep track of two variables, "n" and "k" because number of times "a" will occur, depends on n+k.
3. L = {0n 1k | n ≠ k} - NOT Regular

=> The same problem goes here as well, the number of times 1s will appear, depends on the number of times 0s will appear because the their number of occurrences should not match.

Question 62

A company stores products in a warehouse. Storage bins in this warehouse are specified by their aisle, location in the aisle, and self. There are 50 aisles, 85 horizontal locations in each aisle, and 5 shelves throughout the warehouse. What is the least number of products the company can have so that at least two products must be stored in the same bin?

  1. AOption (a)

    251

  2. BOption (b)

    426

  3. COption (c)

    4251

  4. DOption (d)

    21251

View answer & explanation

Correct answer

Answer: (d)D.

21251

Why this answer is correct

The correct  answer is option 4.

Solution :

In the warehouse , No. of aisles = 50

Horizontal locations in each aisle = 85

No. of shelves =5

Therefore, total number of bins =  50 *  85 * 5 = 21250

According to the pigeonhole principle, if there are N+1 pigeon then there must be N pigeonholes, such that at least  two pigeons are in same pigeonholes.

Here, N = 21250,therefore number of products = 21250+1 =21251 so that at least two products are in the same bin.

Question 63

Any string of terminals that can be generated by the following context free grammar (where S is start nonterminal symbol)

S → XY

X → 0X | 1X | 0

Y → Y0 | Y1 | 0

  1. AOption (a)

    has at least one 1

  2. BOption (b)

    should end with 0

  3. COption (c)

    has no consecutive 0’s or 1’s

  4. DOption (d)

    has at least two 0’s

View answer & explanation

Correct answer

Answer: (d)D.

has at least two 0’s

Why this answer is correct

The correct answer is option 4.

Explanation :

Given grammar is :  

S → XY

X → 0X | 1X | 0

Y → Y0 | Y1 | 0

Now, we are trying to generate the minimum string generated from the grammar :

         

 We have given options :

  • has at least one 1 - not possible.
  • should end with 0 - possible
  • has no consecutive 0’s or 1’s - not possible
  • has at least two 0’s - possible

[ by option elimination option 1 and 3 are not possible ]

Now, we can generate the string 001 from the grammar .

   

Therefore ,we can say the grammar not always generate strings that ends with 0,it may ends with 1 also.

Thus, the grammar generates the strings that has at least two 0's.

Question 64

Let

L1 = {0n 1n 0m | n >= 1, m >= 1}

L2 = {0n 1m 0m | n >= 1, m >= 1}

L3 = {0n 1n 0n | n >= 1}

Which of the following are correct statements?

A. L3 = L1 ∩ L2

B. L1 and L2 are context free languages but L3 is not a context free language

C. L1 and L2 are not context free languages but L3 is a context free language

D. L1 is a subset of L3

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    A and D only

  4. DOption (d)

    A only

View answer & explanation

Correct answer

Answer: (a)A.

A and B only

Why this answer is correct

  • L3 = L1 ∩ L2

TRUE. L1 and L2 will have only those strings in common which will have equal number of 0s then equal number of 1s and then equal number of 0s. This is exactly what L3 is saying, equal number of 0s then 1s and then 0s.

  • L1 and L2 are context free languages but L3 is not a context free language.

TRUE. It is saying in L1 that the number of 0s present before 1 should be equal to the total number of 1s,which is possible with one stack. L2 is saying that the number of 1s present before 0 should be equal to the total number of 0s,which is possible with one stack. And L3 is saying that the number of 0s and then 1s and then 0s should be equal, which is not possible using one stack.

  • L1 and L2 are not context free languages but L3 is a context free language.

FALSE. L1 and L2 are context free languages and L2 is not context free language. It is saying in L1 that the number of 0s present before 1 should be equal to the total number of 1s. L2 is saying that the number of 1s present before 0 should be equal to the total number of 0s. And L3 is saying that the number of 0s and then 1s and then 0s should be equal, which is not possible using one stack.

  • L1 is a subset of L3.

FALSE. Reverse is true. L3 is the subset of L1. L1 is a larger set having all the elements of L3, not the vice versa.

Question 65

Given below are two statements

Statement I : The family of context free languages is closed under homomorphism

Statement II : The family of context free languages is closed under reversal

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (a)A.

Both Statement I and Statement II are true

Why this answer is correct

  1. The family of context free languages is closed under homomorphism: TRUE

Example: Let L = {anbn | n >= 1}, h(a) = 01 and h(b) = 111.

=> CFL for L: A --> aAb | ab

=> CFG for h(L): A --> 01A111 | 01111

Hence, h(L) is context free language.
2. The family of context free languages is closed under reversal: TRUE

Example: Let L = {anbn | n >= 1} is context free language.

=> CFG of L: S --> aSb | ab

=> By reversing the right hand side of every production, the reversal grammar can be obtained.

=> CFG of LR: S --> bSa | ba

=> LR = {bnan | n >= 1} is context free language.

=> Hence, context free languages are closed under reversal operation.

Question 66

What is the minimum number of states required to the finite automaton equivalent to the transition diagram given below?

  1. AOption (a)

    3

  2. BOption (b)

    4

  3. COption (c)

    5

  4. DOption (d)

    6

View answer & explanation

Correct answer

Answer: (c)C.

5

Why this answer is correct

Step 1: {a, b, e, f, g, h} {d} {c}

Step 2: {a, e, f, g} {b, h} {c}

Step 3: {a, e} {f} {g} {b, h} {c}

d have no incoming edges so we have discard them.

 

In the above steps we can see that the minimised finite automata we get have the 5 number of the states.

So we can say that the correct option is the option 3).

Question 67

In software testing, beta testing is the testing performed by _______.

  1. AOption (a)

    potential customers at the developer's location

  2. BOption (b)

    potential customers at their own locations

  3. COption (c)

    product developers at the customer's location

  4. DOption (d)

    product developers at their own locations

View answer & explanation

Correct answer

Answer: (b)B.

potential customers at their own locations

Why this answer is correct

The correct answer is option 2.

Concept:

Software testing:

The method of analyzing and validating that a software product or application accomplishes what it is designed to do is known as software testing. The advantages of testing include the prevention of bugs, the reduction of development expenses, and the improvement of performance.

Beta testing:

Beta testing is one of the final stages in our software development lifecycle (SDLC) before a product goes online. Beta testing, also known as user testing or customer validation, seeks to guarantee that end users are pleased with a software product before making it widely available.

  • Beta testing is the testing performed by potential customers at their own locations or performed by the end-user of the product.
  • Clients or End Users who are not employees of the company undertake beta testing.
  • Black Box Testing is commonly used in beta testing.
  • Beta testing focuses on the product's quality as well as gathering user feedback and ensuring that the product is ready for real-world use.
  • Apple is a wonderful example since they use their beta program to preview new iOS features. Many of these features make it into the next version, while others do not, and others may be pushed back to a future minor release.

Hence the correct answer is potential customers at their own locations.

Question 68

The V components in MVC are responsible for :

  1. AOption (a)

    User interface.

  2. BOption (b)

    Security of the system.

  3. COption (c)

    Business logic and domain objects.

  4. DOption (d)

    Translating between user interface actions/events and operations on the domain objects.

View answer & explanation

Correct answer

Answer: (a)A.

User interface.

Why this answer is correct

The correct answer is option 1.

 Note:

 MVC(Model View Controller) is an architecture pattern that separates the application structure into three different layers - the model ,the View and the Controller.

 

The Model: This component works on the logic based the data used by the users.

The View : This component used to work on the UI(User Interface) logic of the application.

The Controller : This component works as an interface between the Model and the View .This component process the business logic and the incoming requests, manipulate the data using the model component and send the final result to the view .

Question 69

In software engineering, what kind of notation do formal methods predominantly use?

  1. AOption (a)

    textual

  2. BOption (b)

    diagrammatic

  3. COption (c)

    mathematical

  4. DOption (d)

    computer code

View answer & explanation

Correct answer

Answer: (c)C.

mathematical

Why this answer is correct

The correct answer is option 3.

Explanation:

In Software Engineering Formal methods predominantly use Mathematical notations.

Question 70

If every requirement stated in the Software Requirement Specification (SRS) has only one interpretation, then SRS is said to be

  1. AOption (a)

    correct

  2. BOption (b)

    consistent

  3. COption (c)

    unambiguous

  4. DOption (d)

    verifiable

View answer & explanation

Correct answer

Answer: (c)C.

unambiguous

Why this answer is correct

If every requirement stated in the Software Requirement Specification (SRS) has only one interpretation, then SRS is said to be Unambiguous.

Therefore the correct answer is option 3.

Points to note: 

SRS (Software Requirement Specification) is written by either customer or developer. It Serves as a contract between customer and developer.

  Following are the characteristics of a good SRS :

  • Correct :- Every requirement stated therein the SRS is one that software shall meet.
  • Unambiguous :- Every requirement stated therein the SRS has only one interpretation.
  • Complete
  • Consistent :- Subset of individual requirements described in SRS should not conflict.
  • Verifiable :- Requirements must be verified.
  • Modifiable :- Requirements specified in the document are changeable.
  • Traceable :- Further enhancements are possible.

Question 71

A system has 99.99% uptime and has a mean-time-between-failure of 1 day. How fast does the system has to repair itself in order to reach this availability goal?

  1. AOption (a)

    9 Seconds

  2. BOption (b)

    10 Seconds

  3. COption (c)

    11 Seconds

  4. DOption (d)

    12 Seconds

View answer & explanation

Correct answer

Answer: (a)A.

9 Seconds

Why this answer is correct

The correct answer is option 1.

The availability of a system is defined as the proportion of time that the system is operational, and it is calculated as:

Availability = Uptime / (Uptime + Downtime)

Where Uptime is the amount of time that the system is operational, and Downtime is the amount of time that the system is not operational.

Given that the system has 99.99% uptime and a mean-time-between-failure of 1 day, we can calculate the Downtime as:

Downtime = MTBF * (1 - Availability)

Where MTBF is the mean-time-between-failure.

So, we can calculate the downtime as:

Downtime = 1 day * (1 - 0.9999) = 0.0001 days = 8.64 seconds

To reach the availability goal, the system must repair itself within 9 seconds after a failure, this means that the system has to be repaired in less than 3.6 seconds.

Question 72

What is the transformation matrix M that transforms a square in the xy-plane defined by (1, 1)T, (-1, 1)T, (-1, -1)T and (1, -1)T to a parallelogram whose corresponding vertices are (2, 1)T, (0, 1)T, (-2, -1)T and (0, -1)T?

  1. AOption (a)

    M = \(\left[\begin{array}{*{20}{c}} 1&1&0\ 0&1&0\ 0&0&1 \end{array}\right]\)

  2. BOption (b)

    M = \(\left[\begin{array}{*{20}{c}} 1&0&0\ 1&1&0\ 0&0&1 \end{array}\right]\)

  3. COption (c)

    M = \(\left[\begin{array}{*{20}{c}} 1&1&1\ 0&1&0\ 0&0&1 \end{array}\right]\)

  4. DOption (d)

    M = \(\left[\begin{array}{*{20}{c}} 1&1&0\ 1&1&0\ 0&0&1 \end{array}\right]\)

View answer & explanation

Correct answer

Answer: (a)A.

M = \(\left[\begin{array}{*{20}{c}} 1&1&0\ 0&1&0\ 0&0&1 \end{array}\right]\)

Why this answer is correct

We get the desired answer of parallelogram with are (2, 1)T, (0, 1)T, (-2, -1)T and (0, -1)T by multiplying the coordinate of square in the xy-plane defined by (1, 1)T, (-1, 1)T, (-1, -1)T and (1, -1)T with option 1 matrix as shown in figure below. So we can say that it is the correct option 1).

Question 73

Suppose a Bezier curve P(t) is defined by the following four control points in the xy-plane : P0 = (-2, 0); P1 = (-2, 4); P2 = (2, 4); and P3 = (2, 0). Then which of the following statements are correct?

A. Bezier curve P(t) has degree 3.

B. P(12)\left(\frac 1 2 \right)  = (0, 3).

C. Bezier curve P(t) may extend outside the convex hull of its control points.

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    B and C only

  4. DOption (d)

    A, B, and C

View answer & explanation

Correct answer

Answer: (a)A.

A and B only

Why this answer is correct

A is correct because Bezier curve P(t) is defined by four control points, which means it is a degree 3 Bezier curve.

B is correct using the Casteljau’s algorithm below are the steps to compute the P(12)\left(\frac 1 2 \right)  to get the answer (0,3).

C is incorrect as discussed in below figure.

Question 74

Given below are two statements

Statement I : The maximum number of sides that a triangle might have when clipped to a rectangular viewport is 6.

Statement II : In 3D graphics, the perspective transformation is nonlinear in z.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true.

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (d)D.

Statement I is false but Statement II is true

Why this answer is correct

The correct answer is option 4.

Concept:

Statement I: The maximum number of sides that a triangle might have when clipped to a rectangular viewport is 6.

False, The maximum number of sides that a triangle might have when clipped to a rectangular viewport is 7. Here is an example of the above statement.

Statement II: In 3D graphics, the perspective transformation is nonlinear in z.

True, In 3D graphics, A linear projection in which three-dimensional objects are projected on a picture plane is called perspective projection or perspective transformation. As a result, faraway items look smaller than objects closer to the viewer. Perspective transformation is a non-linear transformation and the perspective transformation is nonlinear in z.

Hence the correct answer is Statement I is false but Statement II is true.

Question 75

A double‐ended queue (dequeue) supports adding and removing items from both the ends of the queue. The operations supported by dequeue are AddFront(adding item to front of the queue), AddRear(adding item to the rear of the queue), RemoveFront(removing item from the front of the queue), and RemoveRear(removing item from the rear of the queue). You are given only stacks to implement this data structure. You can implement only push and pop operations. What’s the time complexity of performing AddFront() and AddRear() assuming m is the size of the stack and n is the number of elements?

  1. AOption (a)

    O(m) and O(n)

  2. BOption (b)

    O(1) and O(n)

  3. COption (c)

    O(n) and O(1)

  4. DOption (d)

    O(n) and O(m)

View answer & explanation

Correct answer

Answer: (b)B.

O(1) and O(n)

Why this answer is correct

The correct answer is option 2.

Explanation:

Operations of Dequeue :

  • AddFront : adding item to front of the queue.
  • AddRear : adding item to the rear of the queue.
  • RemoveFront : removing item from the front of the queue.
  • RemoveRear : removing item from the rear of the queue.

Stack has two operations : PUSH - to insert data into stack. POP - to delete an element from stack. It supports LIFO(Last In First Out) .

AddFront() is same as PUSH operation, therefore , the time complexity is O(1).

To perform AddRear() operation, using stack  we need two operations , PUSH(POP()) all the elements of the stack. Therefore, the time complexity is O(n).

Question 76

The postfix form of the expression (A + B) * (C * D ‐ E) * F / G is _______.

  1. AOption (a)

    A B + C D * E - F G / * *

  2. BOption (b)

    A B + C D * E - F * * G /

  3. COption (c)

    A B + C D * E - * F * G /

  4. DOption (d)

    A B + C D E * - * F * G /

View answer & explanation

Correct answer

Answer: (c)C.

A B + C D * E - * F * G /

Why this answer is correct

Correct answer is A B + C D * E - * F * G /

Concept:

Precedence Order (highest to lowest) and Associativity (left to right)

() has highest precedence

  • and / has same precedence
  • and – has same precedence

(* and /) and higher precedence than (+, -)

Explanation: 

(A + B) * (C * D ‐ E) * F / G 

A B + * (C * D ‐ E) * F / G 

A B + * (**C D *** ‐ E) * F / G 

A B + * C D * E - * F / G 

A B + C D * E -  * * F / G 

A B + C D * E -  * F * / G

A B + C D * E -  * F * G /

Additional Information: 

You can underline the partially completed postfix conversion to keep track of conversion, and avoid silly mistakes and confusion.

Question 77

Two balanced binary trees are given with m and n elements, respectively. They can be merged into a balanced binary search tree in ______ time.

  1. AOption (a)

    O(m*n)

  2. BOption (b)

    O(m + n)

  3. COption (c)

    O(m*log n)

  4. DOption (d)

    O(m*log(m + n))

View answer & explanation

Correct answer

Answer: (b)B.

O(m + n)

Why this answer is correct

The correct answer is: Option 2) O(m + n)

Key Points

Given: Two balanced Binary Search Trees (BSTs), one with m nodes and the other with n nodes.

Objective: Merge them into a new balanced Binary Search Tree.

Approach:

  1. Step 1: Perform in-order traversal of both BSTs.

This will give two sorted arrays of size m and n, respectively.

Time complexity for in-order traversal of both trees = O(m + n) 2. Step 2: Merge the two sorted arrays.

This is similar to merging in merge sort.

Time complexity = O(m + n) 3. Step 3: Construct a balanced BST from the merged sorted array.

This can be done using a divide-and-conquer approach (similar to building BST from sorted array).

Time complexity = O(m + n)

Total Time Complexity: O(m + n) + O(m + n) + O(m + n) = O(m + n)

Conclusion:

Merging two balanced BSTs into one balanced BST can be done in linear time with respect to the total number of nodes.

✅ Final Answer: Option 2) O(m + n)

Question 78

A data structure is required for storing a set of integers such that each of the following operations can be done in O(log n) time, where n is the number of elements in the set.

A. Deletion of the smallest element

B. Insertion of an element if it is not already present in the set

Which of the following data structures can be used for this purpose?

  1. AOption (a)

    A heap can be used but not a balanced binary search tree.

  2. BOption (b)

    A balanced binary search tree can be used but not a heap.

  3. COption (c)

    Both balanced binary search tree and heap can be used.

  4. DOption (d)

    Neither balanced binary search tree nor heap can be used.

View answer & explanation

Correct answer

Answer: (b)B.

A balanced binary search tree can be used but not a heap.

Why this answer is correct

The correct answer is option 2.

Explanation :

Balanced Binary Search Tree : A Balanced binary search tree is a binary search tree in which the difference between the height of left sub tree and the right sub tree is not more than 1. 

Now ,to perform deletion of the smallest element ,the complexity is : O(log n)

 To insert an element in balanced BST ,if it is not present in the set, we need to search the element first .To search the element the time complexity is O(log n) . To insert an element in balanced BST the complexity is O(log n).

Heap : Heap is a special case of balanced binary tree data structure where the root key is compared with its children and it has utmost two children. If we arrange Max Heap then   key( a ) >= key (b),where node b is the child of node a. If we arrange Min Heap then key (a) <= key (b) ,where node b is the child of node a.

Now,  ,to perform deletion of the smallest element ,the complexity is : O(log n)

To insert an element in Heap ,if it is not present in the set, we need to search the element first .To search the element the time complexity is O(n) . To insert an element in balanced BST the complexity is O(log n).

Question 79

Consider the following graph.

Among the following sequences

I. a b e g h f

II. a b f e h g

III. a b f h g e

IV. a f g h b e

Which are depth first traversals of the above graph?

  1. AOption (a)

    I, II, and IV only

  2. BOption (b)

    I and IV only

  3. COption (c)

    II, III, and IV only

  4. DOption (d)

    I, III, and IV only

View answer & explanation

Correct answer

Answer: (d)D.

I, III, and IV only

Why this answer is correct

The correct answer is option 4.

Explanation:

Depth First Search (DFS) is graph traversal algorithm uses stack data structure.

Option I : a b e g h f  : visit a; insert connected node of a, b;  insert connected node of b, e ;  insert connected node of e, g ;  insert connected node of g, h ; insert connected node of h, f .

Option II : a b f e h g : visit a; insert connected node of a, b; insert connected node of b, f ; Next to insert the connected node of f, which is either g or h; but e is not possible.

Option III : a b f h g e : visit a; insert connected node of a, b;  insert connected node of b, f ;  insert connected node of f, h ;  insert connected node of h, g ; insert connected node of g, e .

Option IV : a f g h b e: visit a; insert connected node of a, f;  insert connected node of f, g ;  insert connected node of g, h ;  insert connected node of h, b ; insert connected node of b, e .

Question 80

Consider the following recursive function F() in Java that takes an integer value and returns a string value :

public static String F(int N) {

if ( N <= 0) return "-";

return F(N - 3) + N + F(N - 2) + N;

}

The value of F(5) is :

  1. AOption (a)

    -2-25-3-135

  2. BOption (b)

    -2-25-1-3-135

  3. COption (c)

    -1-145-2-245

  4. DOption (d)

    -2-25-3-1-135

View answer & explanation

Correct answer

Answer: (d)D.

-2-25-3-1-135

Why this answer is correct

The correct answer is option 4.

Concept:

The given java program that takes an integer value and returns a string value :

public static String F(int N)

{

if ( N <= 0) return "-";

return F(N - 3) + N + F(N - 2) + N;

}

The value of F(5) is :

it calls a return statement sub-functions  F(2) + 5 + F(3) + 5;

Hence the correct answer is -2-25-3-1-135.

Question 81

Suppose you have eight 'black and white' images taken with a 1‐megapixel camera and one '8‐color' image taken by an 8‐megapixel camera. How much hard disk space in total do you need to store these images on your computer?

  1. AOption (a)

    1 GB

  2. BOption (b)

    4 MB

  3. COption (c)

    16 MB

  4. DOption (d)

    3 GB

View answer & explanation

Correct answer

Answer: (b)B.

4 MB

Why this answer is correct

To calculate the total hard disk space required, let's break it down:

1. Black and white images:

  • Each image is 1-megapixel.
  • Black and white images use 1 bit per pixel (since only two colors: black or white).
  • 1 megabyte (MB) is 1,048,576 bytes, and 1 byte is 8 bits.

So for each black-and-white image:

  • 1-megapixel = 1,000,000 pixels.
  • Each pixel requires 1 bit, so each image uses 1,000,000 bits.
  • Converting bits to bytes: 1,000,0008\frac{1,000,000}{8} = 125,000 bytes = 125 KB.

For 8 black-and-white images:

  • 125 KB × 8 = 1,000 KB = 1 MB.

2. 8-color image:

  • The image is 8-megapixel.
  • 8 colors means 3 bits per pixel (since 2^3 = 8).
  • 8 megapixels = 8,000,000 pixels.

So for the 8-color image:

  • 8 megapixels × 3 bits per pixel = 24,000,000 bits.
  • Converting bits to bytes: 24,000,0008\frac{24,000,000}{8} = 3,000,000 bytes = 3 MB.

Total hard disk space:

  • Space for 8 black-and-white images: 1 MB.
  • Space for one 8-color image: 3 MB.

Total = 1 MB + 3 MB = 4 MB.

Therefore, the correct answer is: 2) 4 MB.

Question 82

Match List I with List II

List IList II
Production RulesGrammar
A.S → XY X → 0 Y → 1I.Greibach Normal Form
B.S → aS| bSS |cII.Context Sensitive Grammar
C.S → AB A → 0A | 1A | 0 B → 0AIII.Chomsky Normal Form
D.S → aAbc Ab → bA Ac → Bbcc bB → Bb aB → aa | aaAIV.S-Grammar
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (c)C.

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

Why this answer is correct

The correct answer is option 3.

Solution :

List IList II
Production RulesGrammar
A.S → XY X → 0 Y → 1IIIChomsky Normal Form
B.S → aS| bSS |cIVS-Grammar
C.S → AB A → 0A | 1A | 0 B → 0AIGreibach Normal Form
D.S → aAbc Ab → bA Ac → Bbcc bB → Bb aB → aa | aaAIIContext Sensitive Grammar

 

Important Points 

A context free grammar (CFG) is in Greibach Normal Form (GNF) if all production rules satisfy one of the following conditions:

  • A non-terminal generating a terminal (e.g.; X->x)
  • A non-terminal generating a terminal followed by any number of non-terminals (e.g.; X->xX1X2…XN)

 

A context free grammar (CFG) is in Chomsky Normal Form (CNF) if all production rules satisfy one of the following conditions:

  • A non-terminal generating a terminal (e.g.; X->x)
  • A non-terminal generating two non-terminals (e.g.; X->YZ)
  • Start symbol generating ε. (e.g.; S-> ε)

Note : Left side of the given table contains the standard form of the grammar.

Question 83

Given below are two statements

Statement I : LL(1) and LR are examples of Bottom‐up parsers.

Statement II : Recursive descent parser and SLR are examples of Top‐down parsers

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (b)B.

Both Statement I and Statement II are false

Why this answer is correct

The correct answer is option 2,that is both statements are false.

 Explanation:

 

 

  • LL(1) parser is a Top down parser .
  • LR is Bottom Up parser or Shift Reduce Parser.
  • Recursive Decent parser is Top down parser.
  • SLR  is Bottom up parser or Shift Reduce Parser.

Question 84

Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3 and f4?

A. f1(n) = 2n

B. f2(n) = n3/2

C. f3(n) = n log n

D. f4(n) = nlog n

Choose the correct answer from the options given below

  1. AOption (a)

    C, B, D, A 

  2. BOption (b)

    C, B, A, D

  3. COption (c)

    B, C, A, D

  4. DOption (d)

    B, C, D, A

View answer & explanation

Correct answer

Answer: (a)A.

C, B, D, A 

Why this answer is correct

The correct answer is option 1.

Explanation: 

Here are some common Big O notations from the smallest to the largest complexity:

  • O(1): Constant-time complexity. The running time is independent of the input size, it always takes the same time to compute.
  • O(log n): Logarithmic time complexity. The running time grows logarithmically in proportion to the input size.
  • O(n): Linear time complexity. The running time grows linearly with the size of the input.
  • O(n log n): Log-linear or Linearithmic time complexity. Running time grows linearly and in the order of the logarithm of the size of the input.
  • O(n^2): Quadratic time complexity. The running time is proportional to the square of the size of the input data.
  • O(n^3): Cubic time complexity. The running time is proportional to the cube of the size of the input data.
  • O(2^n): Exponential time complexity. The resources needed for algorithm execution double with each addition to the input data set.
  • O(n!): Factorial time complexity. The running time grows in proportion to the factorial of the input size. This is typical of algorithms that solve problems by generating all possible combinations.

So when you say "all types of asymptotic complexity increasing order", we could be talking about a set of functions like:

  • f1(n) = 1 (O(1))
  • f2(n) = log n (O(log n))
  • f3(n) = n (O(n))
  • f4(n) = n log n (O(n log n))
  • f5(n) = n^2 (O(n^2))
  • f6(n) = n^3 (O(n^3))
  • f7(n) = 2^n (O(2^n))
  • f8(n) = n! (O(n!))

So, according to above explanation:

  • f1(n) = 2n
  • f2(n) = n3/2
  • f3(n) = n log n
  • f4(n) = nlog n

The functions in ascending order: n log n  <  n3/2 < nlog n   <   2n

Question 85

The order of a leaf node in a B+ tree is the maximum number of (value, data record pointer) pairs it can hold. Given that the block size is 1K bytes, data record pointer is 7 bytes long, the value field is 9 bytes long and a block pointer is 6 bytes long, what is the order of the leaf node?

  1. AOption (a)

    63

  2. BOption (b)

    64

  3. COption (c)

    67

  4. DOption (d)

    68

View answer & explanation

Correct answer

Answer: (a)A.

63

Why this answer is correct

The correct answer is option 1.

Solution :

Given data,

Block size = 1 K bytes = 1024 bytes

Data Record pointer (r) = 7 bytes

Value field (v) = 9 bytes

Block pointer (p) = 6 bytes 

 Let ,the order of leaf node of B+ tree = m 

Now, for B+ tree ,

r * m + v * m + p <= 1024

or,  7m + 9m + 6  <= 1024

or,16m + 6 <= 1024

or, 16m <= 1018

or, m <= 63

Question 86

Which agent deals with the happy and unhappy state?

  1. AOption (a)

    Utility‐based agent

  2. BOption (b)

    Model‐based agent

  3. COption (c)

    Goal‐based Agent

  4. DOption (d)

    Learning Agent

View answer & explanation

Correct answer

Answer: (a)A.

Utility‐based agent

Why this answer is correct

The correct answer is option 1.

Artificial Intelligence system is the composed of agent and its environment. Agent takes input from its Environment through sensor and sends its reaction to environment through actuator.

 

Simple Reflex agent : take decisions on the basis of the current environment and ignore the history.

Model-based reflex agent : work partially in the observable environment, and track the situation.

Goal-based agents :  needs to know its goal that describes advisable situations.

Utility-based agents : acts based not only goal but also the best possible way to achieve it.

Learning Agents : learn from its past experiences, or it has learning capabilities.

Question 87

What does the following function f() in 'C' return?

int f(unsigned int N) {unsigned int counter = 0; while (N > 0) {counter += N & 1;

N = N >> 1;} return counter == 1;}

  1. AOption (a)

    1 if N is odd, otherwise 0

  2. BOption (b)

    1 if N is a power of 2, otherwise 0

  3. COption (c)

    1 if the binary representation of N is all 1's, otherwise 0

  4. DOption (d)

    1 if the binary representation of N has any 1's, otherwise 0

View answer & explanation

Correct answer

Answer: (b)B.

1 if N is a power of 2, otherwise 0

Why this answer is correct

The correct answer is option 2.

Concept:

The given c function is,

int f(unsigned int N)

{

unsigned int counter = 0;

while (N > 0)

{

counter += N & 1;

N = N >> 1;

}

return counter == 1;

}

Explanation:

When N=1: 

If the function N=1 then,

counter=0,

Iteration 1:

The while-loops enters and the expression  counter += N & 1;

counter = 0+1 & 1;

counter =1

The expression is N = 1 >> 1;

N=0

 >> is right shift operator so N become 0 and the next iteration the condition becomes false.

The while loop will execute and it returns 1 as output.

Here 1==1 is true hence it prints the 1 as output.

When N=2:

If the function  N=2 then,

counter=0,

iteration 1:

The while-loops enters and the expression  counter += N & 1;

counter = 0+2 & 1;

counter =0+0

counter =0

The expression is N = 2 >> 1;

N=1

 >> is right shift operator so N become 1 and the next iteration the condition becomes true.

Iteration 2:

The while-loops enters and the expression  counter += N & 1;

counter = 0+1 & 1;

counter =0+1

counter =1

The expression is N = 1 >> 1;

N=0

 >> is right shift operator so N become 0 and the next iteration the condition becomes false.

counter == 1;

Here 1==1 is true hence it prints the 1 as output.

The while loop will execute and it returns 1 as output.

When N=3:

If the function  N=3 then,

counter=0,

Iteration 1:

The while-loops enters and the expression  counter += N & 1;

counter = 0+3& 1;

counter =0+1

counter =1

The expression is N = 3 >> 1;

N=1

 >> is right shift operator so N become 1 and the next iteration the condition becomes true.

teration 2:

The while-loops enters and the expression  counter += N & 1;

counter = 1+1 & 1;

counter =1+1

counter =2

The expression is N = 1 >> 1;

N=0

 >> is the right shift operator so N becomes 0 and the next iteration the condition becomes false.

The while loop will execute and it returns 0 as output.

Here 2==1 is False hence it prints the 0 as output.

When N=4 then it prints the 1 as output.

When N=5 then it prints the 0 as output.

When N=6 then it prints the 0 as output.

When N=7 then it prints the 0 as output.

When N=8 then it prints the 1 as output.

Hence the correct answer is 1 if N is a power of 2, otherwise 0.

Question 88

Match List I with List II

List IList II
(Programming Paradigm)(Characteristic)
A.ImperativeI.Declarative, clausal representation, theorem proving
B.Object‐orientedII.Side‐effect free, declarative, expression evaluation
C.LogicIII.Imperative, abstract data type
D.FunctionalIV.Command‐based, procedural
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (a)A.

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

Why this answer is correct

The correct answer is option 1.

Concept:

Imperative programming:

Imperative programming is a software development paradigm where functions are implicitly coded in every step required to solve a problem. These programs are made by giving commands & follows definite procedures & sequences.

Object‐oriented Programming:

Object-oriented programming (OOP) is a programming model that organizes software design around data, rather than functions and logic. An object is a data field that has distinct attributes and behavior. It is imperative statement-based & has abstract (general) data types.

Logic Programming:

Logic is also declarative but involves theorem proving. Any program written in a logic programming language is a logical set of sentences expressing facts and rules about a problem domain. 

Functional programming:

Functional programming is a programming paradigm that attempts to bind everything in the style of pure mathematical functions. It's a declarative programming style. Functional Programming is declarative in nature, involves expression evaluation, & side effects free.

Hence the correct answer is A-IV, B ‐III, C ‐I, D ‐II.

Question 89

Which of the statements given below are correct?

The midpoint (or Bresenham) algorithm for rasterizing lines is optimized relative to DDA algorithm in that

A. it avoids round‐off operations.

B. it is incremental.

C. it uses only integer arithmetic.

D. all straight lines can be displayed as straight (exact).

Choose the correct answer from the options given below:

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    A, B, C, and D

  4. DOption (d)

    A, B, and C only

View answer & explanation

Correct answer

Answer: (d)D.

A, B, and C only

Why this answer is correct

The correct answer is option 4.

Concept:

Bresenham's Line Algorithm:

Bresenham's Line Algorithm is an efficient and precise raster line-generating algorithm, scan converts lines using only incremental integer calculations that can be adapted to display circles and other curves.

It is a line drawing algorithm that determines the points of an n-dimensional raster that should be selected in order to form a close approximation to a straight line between two points.

Following are its characteristics:

  • It avoids round-off operations.
  • It is incremental.
  • It uses only integer arithmetic.
  • It avoids the generation of duplicate points.
  • It can be implemented using hardware because it does not use multiplication and division.
  • It is faster compared to DDA because it does not involve floating-point calculations like DDA Algorithm.

Hence the correct answer is A, B, and C only.

Question 90

Which of the following concepts can be used to identify loops?

A. Depth first ordering

B. Dominators

C. Reducible graphs

Choose the correct answer from the options given below :

  1. AOption (a)

    A and B only

  2. BOption (b)

    A and C only

  3. COption (c)

    B and C only

  4. DOption (d)

    A, B and C

View answer & explanation

Correct answer

Answer: (d)D.

A, B and C

Why this answer is correct

The Correct answer is option 4.

Explanation:

 Depth first ordering :  Depth First Search (DFS) is graph traversing or searching algorithm using stack.

 Dominators : A node u is said to dominate another node v, wrt source node S, if all the paths from S to v in the graph must pass through node u.

Question 91

Given below are two statements

Statement I : In an undirected graph, number of odd degree vertices is even.

Statement II : In an undirected graph, sum of degrees of all vertices is even.

In light of the above statements, choose the correct answer from the options given below.

  1. AOption (a)

    Both Statement I and Statement II are true.

  2. BOption (b)

    Both Statement I and Statement II are false.

  3. COption (c)

    Statement I is true but Statement II is false.

  4. DOption (d)

    Statement I is false but Statement II is true.

View answer & explanation

Correct answer

Answer: (a)A.

Both Statement I and Statement II are true.

Why this answer is correct

The correct answer is option 1.

Explanation :

In an undirected graph, number of odd degree vertices is even as per handshaking lemma.

In an undirected graph, sum of degrees of all vertices is even, as sum of degree of the vertices = 2 * number of edges .

Question 92

Consider the given tree below. Calculate the value at the root of the tree using alpha‐beta pruning algorithm.

  1. AOption (a)

    3

  2. BOption (b)

    5

  3. COption (c)

    6

  4. DOption (d)

    9

View answer & explanation

Correct answer

Answer: (b)B.

5

Why this answer is correct

Calculation: 

Let α = -∞ and β = +∞. At MAX, we will use α and at MIN, we will use β.

  • The initial call starts from A. The value of  α = -∞ and β = +∞. These values are passed down to subsequent nodes in the tree. At A the maximizer must choose MAX of B and C, so A calls B first.
  • At B it the minimizer must choose min of D and E and hence calls D first.
  • At D, it looks at its left child which is a leaf node. This node returns a value of 3. Now at D the value of alpha is α = MAX(-∞, 3) = 3.
  • To decide whether it's worth looking at its right node or not, it checks the condition  β<=α. This is false since β = +∞ and α = 3. So it continues the search.
  • D now looks at its right child which returns a value of 5.At D, α = MAX(3, 5) which is 5. Now the value of node D is 5
  • D returns a value of 5 to B. At B, β = MIN( +∞, 5) which is 5. The minimizer is now guaranteed a value of 5 or lesser. B now calls E to see if he can get a lower value than 5.
  • At E the values of alpha and beta is not -∞ and +∞ but instead -∞ and 5 respectively, because the value of  β was changed at B and that is what B passed down to E.
  • Now E looks at its left child which is 6. At E,α = MAX(-∞, 6) which is 6. Here the condition becomes true. beta is 5 and alpha is 6. So β<=α is true. Hence it breaks and E returns 6 to B.
  • Note how it did not matter what the value of E‘s right child is. It could have been +∞ or -∞ , it still wouldn’t matter, we never even had to look at it because the minimizer was guaranteed a value of 5 or lesser. So as soon as the maximizer saw the 6 he knew the minimizer would never come this way because he can get a 5 on the left side of B. This way we didn’t have to look at that 9 and hence saved computation time.
  • E returns a value of 6 to B. At B, β = MIN( 5, 6) which is 5. The value of node B is also 5.
  • B returns 5 to A. At A, α = MAX(-∞, 5) which is 5. Now the maximizer is guaranteed a value of 5 or greater. A now calls C to see if it can get a higher value than 5.
  • At C, α = 5 and β = +∞. C calls F
  • At F, α = 5 and β = +∞. F looks at its left child which is a 1. α  = MAX( 5, 1) which is still 5.
  • F looks at its right child which is a 2. Hence the best value of this node is 2. α still remains 5
  • F returns a value of 2 to C. At C,  β = MIN(+∞, 2). The condition β <= α  becomes true as β = 2 and α= 5. So, it breaks, and it does not even have to compute the entire sub-tree of G.
  • The intuition behind this break-off is that, at C the minimizer was guaranteed a value of 2 or lesser. But the maximizer was already guaranteed a value of 5 if he chooses B.
  • C now returns a value of 2 to A. Therefore, the best value at A is MAX (5, 2) which is a 5.

Hence the optimal value that the maximizer can get is 5.

Question 93

Which of the statements given below is/are correct?

It is always important and useful to include an 'alt' attribute on 'img' tag in HTML because

A. users who cannot see the image due to vision impairment can have a textual description of the image (which can be spoken aloud by a screenreader).

B. If the image fails to load (slow connection, broken path, etc.) then alt text is displayed instead.

C. SEO (Search Engine Optimization) benefits.

Choose the correct answer from the options given below :

  1. AOption (a)

    A only

  2. BOption (b)

    B and C only

  3. COption (c)

    C only

  4. DOption (d)

    A, B, and C

View answer & explanation

Correct answer

Answer: (d)D.

A, B, and C

Why this answer is correct

The correct answer is option 4.

Explanation:

It is always important and useful to include an 'alt' attribute on 'img' tag in HTML because

  • users who cannot see the image due to vision impairment can have a textual description of the image (which can be spoken aloud by a screen reader).
  • If the image fails to load (slow connection, broken path, etc.) then alt text is displayed instead.
  • SEO (Search Engine Optimization) benefits.

Question 94

Find the regular expression for the language accepted by the automata given below.

  1. AOption (a)

    (aa</sup> (a + b) ab)<sup>

  2. BOption (b)

    (a + b) ab (ab + bb + aa</sup> (a + b) ab)<sup>

  3. COption (c)

    a</sup> ab (ab + bb + aa<sup> (a + b) ab)*

  4. DOption (d)

    a</sup> (a + b) ab (ab + bb + aa<sup> (a + b) ab)*

View answer & explanation

Correct answer

Answer: (b)B.

(a + b) ab (ab + bb + aa</sup> (a + b) ab)<sup>

Why this answer is correct

Note: This question is dropped by NTA.

Question 95

What language is accepted by the pushdown automation

M = ({q0, q1, q2}, {a, b}, {a, b, z}, δ, q0, z, {q2})

with δ(q0, a, a) = {(q0, aa)}; δ(q0, b, a) = {(q0, ba)}

δ(q0, a, b) = {(q0, ab)}; δ(q0, b, b)  = {(q0, bb)}

δ(q0, a, z) = {(q0, az)}; δ(q0, b, z) = {(q0, bz)}

δ(q0, λ, b) = {(q1, b)}; δ(q0, λ, a) = {(q1, a)}

δ(q1, a, a) = {(q1, λ)}; δ(q1, b, b) = {(q1, λ)}

δ(q1, λ, z) = {(q2, z)}?

  1. AOption (a)

    L = {w | na(w) = nb(w), w Є {a, b}+}}

  2. BOption (b)

    L = {w | na(w) <= nb(w), w Є {a, b}+}}

  3. COption (c)

    L = {w | nb(w) <= na(w), w Є {a, b}+}}

  4. DOption (d)

    L = {wwR | w Є {a, b}+}

View answer & explanation

Correct answer

Answer: (d)D.

L = {wwR | w Є {a, b}+}

Why this answer is correct

The language accepted by the pushdown automation M is the set of all strings that can be generated by the transitions defined in the transition function δ, starting from the initial state q0, and eventually reaching the accepting state q2. The input alphabet for the language is {a, b}. The stack alphabet for the language is {a, b, z}.

The language accepted by the M is L = {wwR | w Є {a, b}+} and the transition diagram is given below.

Question 96

In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Here, n and m are number of vertices and edges, respectively. Match each algorithm with its time complexity.

List IList II
Standard graph algorithmsTime complexities
A.Bellman‐Ford algorithmI.O(m*log n)
B.Kruskal’s algorithmII.O(n3)
C.Floyd‐Warshall algorithmIII.O(n*m)
D.Topological sortingIV.O(n + m)

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (a)A.

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

Why this answer is correct

Solution :

Bellman‐Ford algorithm ( Finds shortest paths from a single source node to all of the other nodes in a weighted digraph ) : O(mn) ,where, n  is no of edges , m is no of nodes.

**Kruskal’s algorithm (**Using Greedy approach it find the minimum cost spanning tree ) - O(m*log n)

Floyd‐Warshall algorithm (Find shortest paths in a directed weighted graph with positive or negative edge weights ) - O(n3)

Topological sorting (Find linear  ordering of vertices for Directed Acyclic Graph (DAG) ) - O(n + m)

Therefore ,option 1 is correct.

Question 97

A hash function h defined as h(key) = key mod 7, with linear probing, is used to insert the keys 44, 45, 79, 55, 91, 18, 63 into a table indexed from 0 to 6. What will be the location of key 18?

  1. AOption (a)

    3

  2. BOption (b)

    4

  3. COption (c)

    5

  4. DOption (d)

    6

View answer & explanation

Correct answer

Answer: (c)C.

5

Why this answer is correct

Concept:

In case of linear probing (a collision resolution technique) if the location is available in hash table then it will be placed there, but if it is already occupied then it will be placed in next available position.

Here, key=18 will get hash value 4, therefore, it should be placed in position 4 in the hash table, but it is already occupied by key=7.Now, the next available place is 5.Thus, key=18 is placed in position 5.

Question 98

Given below are two statements

Statement I : Breadth‐First Search is optimal when all the step costs are equal whereas uniform‐cost search is optimal with any step‐cost.

Statement II : When all the step costs are same uniform‐cost search expends more nodes at depth d than the Breadth‐First Search.

In light of the above statements, choose the correct answer from the options given below

  1. AOption (a)

    Both Statement I and Statement II are true

  2. BOption (b)

    Both Statement I and Statement II are false

  3. COption (c)

    Statement I is true but Statement II is false

  4. DOption (d)

    Statement I is false but Statement II is true

View answer & explanation

Correct answer

Answer: (a)A.

Both Statement I and Statement II are true

Why this answer is correct

Breadth-First Search: It is a graph traversal algorithm that starts traversing the graph from the root node and explores all the neighbouring nodes. Further, it selects the nearest node and explores all the unexplored nodes. While using BFS for traversal, any node in the graph can be considered as the root node.

  • Breadth-first search is optimal when all step costs are equal, because it always expands the shallowest unexpanded node.

Uniform-Cost Search: It is an uninformed search algorithm that uses the lowest cumulative cost to find a path from the source to the destination. In this algorithm, nodes are first expanded, starting from the root, according to the minimum cumulative cost and then the uniform-cost search is implemented using a Priority Queue.

  • Uniform cost searches always expands the node with the lowest total path cost from the initial node. Hence, it is always optimal.
  1. Statement I is TRUE.
  2. Statement II is TRUE because at depth d, when we implement breadth first search with same cost at all nodes, it will have to search lesser nodes but uniform cost search will always check for the lowest cumulative cost, hence, will expend more nodes than BFS.

Question 99

Which among the following statement(s) is(are) FALSE?

A. Greedy best‐first search is not optimal but is often efficient.

B. A* is complete and optimal provided h(n) is admissible or consistent.

C. Recursive best‐first search is efficient in terms of time complexity but poor in terms of space complexity.

D. h(n) = 0 is an admissible heuristic for the 8‐puzzle.

  1. AOption (a)

    A only

  2. BOption (b)

    A and D only

  3. COption (c)

    C only

  4. DOption (d)

    C and D only

View answer & explanation

Correct answer

Answer: (c)C.

C only

Why this answer is correct

Greedy best‐first search is not optimal but is often efficient: TRUE

Greedy best-first search tries to expand the node that is closest to the goal, that is, minimal h(n), on the grounds that this is likely to lead to a solution quickly. Hence, it is considered efficient but neither optimal nor complete.

A is complete and optimal provided h(n) is admissible or consistent:* TRUE

Provided heuristic meets some basic conditions, A* is both complete and optimal. A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, that is, it is optimistic.

Recursive best‐first search is efficient in terms of time complexity but poor in terms of space complexity: FALSE

This statement is false because the inverse is true: Recursive best‐first search is not particularly efficient in terms of time complexity but is relatively good in terms of space complexity.

h(n) = 0 is an admissible heuristic for the 8‐puzzle: TRUE

h(n) = 0 is an admissible heuristic for the 8‐puzzle because h(n)=0 NEVER over-estimates the remaining optimal distance to a goal node. Non-admissible heuristic may overestimate the cost of reaching the goal.

Question 100

Match List I with List II

List IList II
(Programming Term)(Meaning)
A.JNDII.Runtime support for running Java programs
B.RMIII.The API in support of naming and directory services
C.JDKIII.The methods provided by the Java development kit and runtime support for calling remote methods
D.JREIV.The compiler and class libraries to develop Java applications
<br>

Choose the correct answer from the options given below :

  1. AOption (a)

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

  2. BOption (b)

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

  3. COption (c)

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

  4. DOption (d)

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

View answer & explanation

Correct answer

Answer: (a)A.

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

Why this answer is correct

The correct answer is option 1.

Concept:

Java Naming and Directory Interface:

The Java Naming and Directory Interface (JNDI) is an application programming interface (API) that provides naming and directory functionality to applications written using the Java programming language. It is defined to be independent of any specific directory service implementation.

Remote Method Invocation:

RMI is an abbreviation for Remote Method Invocation. It is a technique that enables an object in one system (JVM) to access/invoke an object in another JVM. The methods provided by the Java development kit and runtime support for calling remote methods. RMI is used to create distributed applications; it allows Java programs to communicate remotely. It is included in java.rmi package. 

Java Development Kit:

JDK in Java is an abbreviation for Java Development Kit. It is a bundle of software development tools and supporting libraries combined with the Java Runtime Environment (JRE) and Java Virtual Machine (JVM).

Java runtime environment :

A Java runtime environment (JRE) is a set of components to create and run a Java application. A JRE is part of a Java development kit (JDK). A JRE is made up of a Java virtual machine (JVM), Java class libraries, and the Java class loader. It is runtime support for running Java programs.

Hence the correct answer is A-II, B ‐ III, C ‐ IV, D ‐ I.

100 questions in the full paper