Basic CS [TCS Placement]: Sample Questions 159 - 160 of 196

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 159

Basic CS

Write in Short

Short Answer▾

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


Difference between System. String and System. String Builder
System. StringSystem. StringBuilder
String is immutableString builder is mutable
Immutable means once we create string object we cannot modifyMutable 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 keywordStringBuilder has append keyword
String belongs to System namespaceStringBulider belongs to System. Text namespace

Question 160


Describe in Detail


List out some reasons for process termination.


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.

Developed by: