php mcq questions with answers


                                

Which of the following CANNOT occur multiple number of times in a program?

A.namespace
B.Entrypoint
C.Class
D.Function
E.Subroutine
                                

If a function fun() is to sometimes receive an int and sometimes a double then which of the following is the correct way of defining this function?

A.static void fun(object i) { ... }
B.static void fun(int i) { ... }
C.static void fun(double i, int j) { ... }
D.static void fun(int i, double j) { ... }
E.static void fun(int i, double j, ) { ... }
                                

Which of the following statements are correct about subroutines used in C#.NET?

  1. If we do not return a value from a subroutine then a value -1 gets returned.
  2. Subroutine definitions cannot be nested.
  3. Subroutine can be called recursively.
  4. To return the control from middle of a subroutine exit subroutine should be used.
  5. Subroutine calls can be nested.

A.1, 2, 3
B.2, 3, 5
C.3, 5
D.3, 4
E.None of these
                                

A function can be used in an expression, whereas a subroutine cannot be.

A.True
B.False
                                

Which of the following statements is correct about the C#.NET code snippet given below?

class Student s1, s2; // Here 'Student' is a user-defined class.
s1 = new Student(); 
s2 = new Student();

A.Contents of s1 and s2 will be exactly same.
B.The two objects will get created on the stack.
C.Contents of the two objects created will be exactly same.
D.The two objects will always be created in adjacent memory locations.
E.We should use delete() to delete the two objects from memory.