php mcq questions with answers


                                

Which of the following statements is correct about an Exception?

A.It occurs during compilation.
B.It occurs during linking.
C.It occurs at run-time.
D.It occurs during Just-In-Time compilation.
E.It occurs during loading of the program.
                                

In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?

A.Compiler
B.CLR
C.Linker
D.Loader
E.Operating system
                                

Which of the following statements are correct about exception handling in C#.NET?

  1. If an exception occurs then the program terminates abruptly without getting any chance to recover from the exception.
  2. No matter whether an exception occurs or not, the statements in the finally clause (if present) will get executed.
  3. A program can contain multiple finally clauses.
  4. A finally clause is written outside the try block.
  5. finally clause is used to perform clean up operations like closing the network/database connections.

A.1 only
B.2 only
C.2 and 5 only
D.3 and 4 only
E.None of the above
                                

Which of the following statements are correct about exception handling in C#.NET?

  1. If our program does not catch an exception then the .NET CLR catches it.
  2. It is possible to create user-defined exceptions.
  3. All types of exceptions can be caught using the Exception class.
  4. CLRExceptions is the base class for all exception classes.
  5. For every try block there must be a corresponding finally block.

A.1 and 2 only
B.1, 2 and 3 only
C.4 and 5 only
D.All of the above
E.None of the above
                                

Which of the following is the Object Oriented way of handling run-time errors?

A.OnError
B.HERESULT
C.Exceptions
D.Error codes
E.Setjump and Longjump