php mcq questions with answers
Which of the following statements are correct?
- The conditional operator (?:) returns one of two values depending on the value of a Boolean expression.
- The as operator in C#.NET is used to perform conversions between compatible reference types.
- The &* operator is also used to declare pointer types and to dereference pointers.
- The -> operator combines pointer dereferencing and member access.
- In addition to being used to specify the order of operations in an expression, brackets [ ] are used to specify casts or type conversions.
A.1, 2, 4B.2, 3, 5C.3, 4, 5D.1, 3, 5E.None of these
Which of the following statements are correct?
- An argument passed to a ref parameter need not be initialized first.
- Variables passed as out arguments need to be initialized prior to being passed.
- Argument that uses params keyword must be the last argument of variable argument list of a method.
- Pass by reference eliminates the overhead of copying large data items.
- To use a ref parameter only the calling method must explicitly use the ref keyword.
A.1, 2B.2, 3C.3, 4D.4, 5E.None of these
A function returns a value, whereas a subroutine cannot return a value.
A.TrueB.False
Which of the following statements are correct about functions and subroutines used in C#.NET?
- A function cannot be called from a subroutine.
- The ref keyword causes arguments to be passed by reference.
- While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control passes back to the calling method.
- A subroutine cannot be called from a function.
- Functions and subroutines can be called recursively.
A.1, 2, 4B.2, 3, 5C.3, 5D.4, 5E.None of these
Which of the following statements are correct?
- C# allows a function to have arguments with default values.
- C# allows a function to have variable number of arguments.
- Omitting the return value type in method definition results into an exception.
- Redefining a method parameter in the method's body causes an exception.
- params is used to specify the syntax for a function with variable number of arguments.
A.1, 3, 5B.3, 4, 5C.2, 5D.4, 5E.None of these