TCS Papers: Sample Questions 445 - 446 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 445

» Basic CS » Networks

Short Answer Question▾

Write in Short

What is difference between System. String and System. StringBuilder classes?

Explanation

Difference between system. string and system. string builder

Difference between system. string and system. string builder

System. String

System. StringBuilder

String is immutable

String builder is mutable

Immutable means once we create string object we cannot modify

Mutable means once we create string builder object we can perform any operation like insert, replace or append without creating new instance for every time.

String doesn’t have append keyword

StringBuilder has append keyword

String belongs to System namespace

StringBulider belongs to System. Text namespace

Question number: 446

» Basic CS » Operating System

Essay Question▾

Describe in Detail

List out some reasons for process termination.

Explanation

List out some reasons for process termination are as below:

  1. Normal completion

    • The process completes all task and releases the CPU.

    • The process executes an OS service call to indicate that it has completed running.

  2. Time limit exceeded

    • The process has run longer than the specified total time limit.

    • There are a number of possibilities for the type of time that is measured.

    • These include total elapsed time, amount of time spent executing and in the case of interactive process, and the amount of time since the user last provided any input.

  3. Memory unavailable

    A process requires more memory to execute but the system fails to provide enough memory to the process for its execution, and then the process needs to be terminated.

  4. Bounds violation

    The process tries to access a memory location that it is not allowed to access.

  5. Protection error

    Process wants to use a resource that is not allowed to use by that process. For example; if a process wants to WRITE on a file that is READ ONLY file.

  6. Arithmetic error

    • There is an instruction of a process that is invalid instruction than the process needs to be terminated.

    • For example, if a process wants to divide a number by zero.

  7. Time overrun

    • Waiting time is specified for a process that for how much time a process can wait for a resource.

    • In this time if the process fails to allocate a resource then the process needs to be terminated.

  8. I/O failure

    • When a process attempts to use an I/O device and I/O device is not working fine at the moment.

    • For example, a process that wants to print a file on the printer, but the printer is defective.

  9. Invalid instruction

    The process attempts to execute a nonexistent instruction

  10. Privileged instruction

    Processes try to execute an instruction that is reserved for only OS.

  11. Data misuse

    A piece of data is of the wrong type or is not initialized.

  12. Operator or OS intervention

    In some critical cases, OS take the control of the process and stops the execution of the process. For example, if a deadlock occurs, or deadlock can occur, then OS terminates the process.

  13. Parent termination

    When the parent is not in CPU, child process can’t exist in CPU. So when a parent is terminated, child process also needs to be terminated.

  14. Parent request

    A parent process typically has the authority to terminate any of its offspring.