Question
1. Emp e(); e = new Emp();
2. Emp e = new Emp;
3. Emp e; e = new Emp;
4. Emp e = new Emp();
6. Emp e;
struct Emp
{
private String name;
private int age;
private Single sal;
}
a.
1, 3
b.
2, 5
c.
4, 5
d.
1, 2, 4
Posted under C# programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which of the following is the correct way to define a variable of the type struct Emp declared below? 1. Emp e(); e = new Emp(); 2. Emp e = new Emp; 3. Emp e; e = new Emp; 4....
Similar Questions
Discover Related MCQs
Q. Which of the following statements are correct?
1. A struct can contain properties.
2. A struct can contain constructors.
3. A struct can contain protected data members.
4. A struct cannot contain methods.
5. A struct cannot contain constants.
View solution
Q. When would a structure variable get destroyed?
View solution
Q. Which of the following statements is correct?
View solution
Q. Which of the following are true about classes and struct?
1. A class is a reference type, whereas a struct is a value type.
2. Objects are created using new, whereas structure variables can be created either using new or without using new.
3. A structure variable will always be created slower than an object.
4. A structure variable will die when it goes out of scope.
5. An object will die when it goes out of scope.
View solution
Q. The [Serializable()] attribute gets inspected at
View solution
Q. Which of the following are correct ways to specify the targets for a custom attribute?
View solution
Q. Which of the following is correct ways of applying an attribute?
View solution
Q. Which of the following statements are correct about Attributes used in C#.NET?
View solution
Q. Which of the following forms of applying an attribute is correct?
View solution
Q. Which of the following correctly describes the contents of the filename AssemblyInfo.cs?
View solution
Q. It possible to create a custom attribute that can be applied only to specific programming element(s) like ____ .
View solution
Q. Which of the following CANNOT be a target for a custom attribute?
View solution
Q. Once applied which of the following CANNOT inspect the applied attribute?
View solution
Q. Which of the following is the correct way to apply an attribute to an Assembly?
View solution
Q. Attributes can be applied to
1. Method
2. Class
3. Assembly
4. Namespace
5. Enum
View solution
Q. Select the class which is the base class for all arrays in C#?
View solution
Q. Select the interfaces implemented by array class:
View solution
Q. Choose the correct statement about the IComparer interface in C#:
View solution
Q. Choose the correct statement about the IComparer interface in C#:
View solution
Q. What does the following property defined in the array class defines in C#?
public bool IsReadOnly { get; }
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!