IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Functions and Subroutines - General Questions (2)

  • Home
  • Computer Science & Engineering
  • C# Programming Questions and Answers
  • Functions and Subroutines - General Questions
9. 

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
object[] o = new object[] {"1", 4.0, "India", 'B'};
fun (o);
}
static void fun (params object[] obj)
{
for (int i = 0; i < obj.Length-1; i++)
Console.Write(obj[i] + " ");
}
}
}

A. 1 4.0 India B
B. 1 4.0 India
C. 1 4 India
D. 1 India B

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

10. 

How many values is a function capable of returning?

 

A. 1
B. 0
C. Depends upon how many params arguments does it use.
D. Any number of values.
E. Depends upon how many ref arguments does it use.

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

11. 

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

1 Function definitions cannot be nested.

2 Functions can be called recursively.

3 If we do not return a value from a function then a value -1 gets returned.

4 To return the control from middle of a function exit function should be used.

5 Function calls can be nested.

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

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

12. 

If a function fun() is to receive an int, a Single & a double and it is to return a decimal then which of the following is the correct way of defining this function?

A. decimal static fun(int i, Single j, double k) { ... }
B. decimal fun(int i, Single j, double k) { ... }
C. static decimal fun(int i, Single j, double k) { ... }
D. static decimal fun(int i, Single j, double k) decimal { ... }
E. static fun(int i, Single j, double k) { ... return decimal; }

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

13. 

If a procedure fun() is to receive an int, a Single & a double and it is to return a decimal then which of the following is the correct way of defining this procedure?

 

A. fun(int i, Single j, double k) decimal { ... }
B. static decimal fun(int i, Single j, double k) { ... }
C. fun(int i, Single j, double k) { ... return decimal; }
D. static decimal fun(int i, Single j, double k) decimal { ... }
E. A procedure can never return a value.

Answer: Option E

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

14. 

Which of the following statements are correct?

1 C# allows a function to have arguments with default values.

2 C# allows a function to have variable number of arguments.

3 Omitting the return value type in method definition results into an exception.

4 Redefining a method parameter in the method's body causes an exception.

5 params is used to specify the syntax for a function with variable number of arguments.

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

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

15. 

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i = 10;
double d = 34.340;
fun(i);
fun(d);
}
static void fun(double d)
{
Console.WriteLine(d + " ");
}
}
}

A. 10.000000 34.340000
B. 10 34
C. 10 34.340
D. 10 34.34

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

16. 

Which of the following will be the correct output for the C#.NET program given below?

namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[] args)
{
int a = 5;
int s = 0, c = 0;
Proc(a, ref s, ref c);
Console.WriteLine(s + " " + c);
}
static void Proc(int x, ref int ss, ref int cc)
{
ss = x * x;
cc = x * x * x;
}
}
}

A. 0 0
B. 25 25
C. 125 125
D. 25 125
E. None of the above

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

  • 1
  • 2
  • 3

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2026 IndiaBIX. All Rights Reserved.

Report