Sematec C#1 Quiz

10 Questions | Attempts: 843
Share

SettingsSettingsSettings
Sematec C#1 Quiz - Quiz

این 10 سوال مهم ترین بخش های درس را مورد آزمایش قرار می دهد. اگر نمره پایین تر 70 را کسب کنید، نیاز به مطالعه این درس دارید


Questions and Answers
  • 1. 

    Which of the following is the correct about interfaces in C#?

    • A.

      Interfaces are declared using the interface keyword.

    • B.

      Interface methods are public by default.

    • C.

      Both of the above.

    • D.

      None of the above.

    Correct Answer
    A. Interfaces are declared using the interface keyword.
  • 2. 

    Which of the following defines unboxing correctly?

    • A.

      When a value type is converted to object type, it is called unboxing.

    • B.

      When an object type is converted to a value type, it is called unboxing.

    • C.

      Both of the above.

    • D.

      None of the above.

    Correct Answer
    B. When an object type is converted to a value type, it is called unboxing.
  • 3. 

    Which of the following operator returns the type of a class in C#?

    • A.

      Sizeof

    • B.

      Typeof

    • C.

      &

    • D.

      *

    Correct Answer
    B. Typeof
  • 4. 

    Which of the following is the default access specifier of a class member function?

    • A.

      Private

    • B.

      Public

    • C.

      Protected

    • D.

      Internal

    Correct Answer
    A. Private
  • 5. 

    Which of the following is the correct about class constructor?

    • A.

      A class constructor is a special member function of a class that is executed whenever we create new objects of that class.

    • B.

      A constructor has exactly the same name as that of class and it does not have any return type.

    • C.

      Both of the above.

    • D.

      None of the above.

    Correct Answer
    C. Both of the above.
  • 6. 

    Which of the following access specifier in C# allows a class to expose its member variables and member functions to other functions and objects in the current assembly?

    • A.

      Public

    • B.

      Private

    • C.

      Protected

    • D.

      Internal

    Correct Answer
    D. Internal
  • 7. 

    You are creating a class named Employee. The class exposes a string property named EmployeeType.The following code segment defines the Employee class. (Line numbers are included for reference only.)The EmployeeType property value must be accessed and modified only by code within the Employee class or within a class derived from the Employee class.You need to ensure that the implementation of the EmployeeType property meets the requirements.Which two actions should you perform? (Each correct answer represents part of the complete solution. Choose two.)

    • A.

      Replace line 05 with the following code segment:protected get;

    • B.

      Replace line 06 with the following code segment:private set;

    • C.

      Replace line 03 with the following code segment:public string EmployeeType

    • D.

      Replace line 05 with the following code segment:private get;

    Correct Answer
    A. Replace line 05 with the following code segment:protected get;
  • 8. 

    You are developing an application that includes a class named Order. The application will store a collection of Order objects. The collection must meet the following requirements:* Use strongly typed members.* Process Order objects in first-in-first-out order.* Store values for each Order object.* Use zero-based indices. You need to use a collection type that meets the requirements. Which collection type should you use?

    • A.

      Queue

    • B.

      SortedList

    • C.

      LinkedList

    • D.

      HashTable

    Correct Answer
    A. Queue
  • 9. 

    You are developing an application that includes a class named Order. You implement a method that get count of order from database.You use SqlCommand to write a query to retrieve all order count. Which following method is the best method of SqlComman instance to perform this request?

    • A.

      ExecuteNonQuery()

    • B.

      ExecuteScalar()

    • C.

      ExecuteReader()

    • D.

      ExecuteQuery()

    Correct Answer
    B. ExecuteScalar()
  • 10. 

    Which segment you should use to protected username and password value in connection string?

    • A.

      Integrated Security=SSPI

    • B.

      Encryption = true

    • C.

      Persist Security Info = true

    • D.

      Integrated Security=true

    Correct Answer
    C. Persist Security Info = true

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 26, 2017
    Quiz Created by
    Asgari_sematec2
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.