Fresher Drive @ 27 September - C#, SQL

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Alokanibha
A
Alokanibha
Community Contributor
Quizzes Created: 4 | Total Attempts: 387
Questions: 25 | Attempts: 90

SettingsSettingsSettings
Fresher Drive @ 27 September - C#, SQL - Quiz


Questions and Answers
  • 1. 

    Default namespace in dotnet?

    • A.

      System

    • B.

      Math

    • C.

      Object

    • D.

      Text

    Correct Answer
    C. Object
    Explanation
    The correct answer is "Object". In .NET, the "Object" class is the base class for all other classes. It provides a set of common methods and properties that are inherited by all other classes, making it a default namespace in dotnet. This means that any class created in .NET automatically inherits from the Object class, allowing them to access its methods and properties.

    Rate this question:

  • 2. 

    Access modifier for destructor?

    • A.

      Private

    • B.

      Public

    • C.

      Any

    • D.

      None

    Correct Answer
    D. None
    Explanation
    The access modifier for a destructor is always "None". This is because destructors are automatically called when an object goes out of scope or is explicitly deleted, and they cannot be called directly by the user. Therefore, there is no need to specify an access modifier for a destructor.

    Rate this question:

  • 3. 

    Int is a?

    • A.

      Class

    • B.

      Datatype

    • C.

      Both

    • D.

      None of these

    Correct Answer
    C. Both
    Explanation
    The correct answer is "Both" because "int" can refer to both a class and a datatype in programming. In some programming languages, "int" is a class that represents integer values and provides methods and properties for working with them. In other languages, "int" is a datatype that represents integer values and is used to declare variables of that type. Therefore, "int" can be considered as both a class and a datatype depending on the programming language being used.

    Rate this question:

  • 4. 

    Signature of function contains?

    • A.

      Parameters of functions

    • B.

      Name of function

    • C.

      Parameters & name of function

    • D.

      Return type, parameters & name of function

    Correct Answer
    C. Parameters & name of function
    Explanation
    The signature of a function refers to the combination of the function's name and its parameters. It is used to uniquely identify the function and distinguish it from other functions with the same name but different parameters. The return type is not included in the function signature, as two functions with the same name and parameters but different return types are not allowed in many programming languages. Therefore, the correct answer is "Parameters & name of function".

    Rate this question:

  • 5. 

    Using which we can define the function in child class of same signature of function in parent class?

    • A.

      Using Virutal

    • B.

      Using New

    • C.

      Using Abstract

    • D.

      Using Override

    Correct Answer
    B. Using New
    Explanation
    Using the "new" keyword allows us to define a function in the child class with the same signature as a function in the parent class. This means that the child class has its own implementation of the function, completely independent of the parent class. It does not override the function in the parent class, but rather hides it. This can be useful when we want to provide a different behavior for the function in the child class without modifying the parent class's implementation.

    Rate this question:

  • 6. 

    Is there any class in C# which on which v can use inheritance?

    • A.

      System.Delegate

    • B.

      System.Math

    • C.

      System.Array

    • D.

      System.ValueType

    Correct Answer
    B. System.Math
    Explanation
    In C#, inheritance is a mechanism that allows a class to inherit properties and methods from another class. The System.Math class in C# is a static class that provides mathematical functions and constants. Since it is a class, it can be used as a base class for inheritance. Therefore, System.Math is a valid answer for the question.

    Rate this question:

  • 7. 

    What will be the O/P of following program?const int i=j+4;    const int j=k-1;    const int k=2;    public static void main()    {       System.Console.Println("{0}{1}{2}",i,j,k);    }

    • A.

      4 1 2

    • B.

      5 1 2

    • C.

      4 -1 2

    • D.

      3 1 2

    Correct Answer
    B. 5 1 2
  • 8. 

    Which modifier cant be used with class name?

    • A.

      Internal

    • B.

      Public

    • C.

      Protected

    • D.

      All

    Correct Answer
    C. Protected
    Explanation
    Protected is a modifier that can be used with class names. It provides access to the class members within the same package or subclass. Therefore, the correct answer is All, as all the other modifiers (Internal, Public, and Protected) can be used with class names.

    Rate this question:

  • 9. 

    Can we call destructor arbitrarily?

    • A.

      Yes

    • B.

      No

    Correct Answer
    B. No
    Explanation
    A destructor is a special member function in a class that is automatically called when an object is destroyed. It cannot be called arbitrarily because its invocation is controlled by the system when an object goes out of scope or is explicitly deleted. Therefore, the correct answer is "No."

    Rate this question:

  • 10. 

    Which access modifier destructor can have?

    • A.

      Private

    • B.

      Public

    • C.

      Protected

    • D.

      None

    Correct Answer
    D. None
    Explanation
    The destructor in C++ cannot have any access modifier. It is always implicitly set to be public and cannot be made private or protected. The destructor is responsible for cleaning up resources and memory allocated by an object when it is destroyed. It is automatically called when the object goes out of scope or is explicitly deleted. Therefore, there is no need to specify an access modifier for the destructor as it is always accessible.

    Rate this question:

  • 11. 

    Destructor can be parameterized.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A destructor in C++ is a special member function of a class that is automatically called when an object of that class goes out of scope or is explicitly deleted. Destructors do not take any parameters and cannot be overloaded with different parameter lists. Therefore, the statement "Destructor can be parameterized" is incorrect.

    Rate this question:

  • 12. 

    O/P of program belowpublic class zzz    {      static int i;      static bool j;      public static void Main()      {         System.Console.WritleLine(zzz.i+ " " +zzz.j);      }    }

    • A.

      Null Null

    • B.

      -1 false

    • C.

      1 true

    • D.

      0 false

    Correct Answer
    D. 0 false
    Explanation
    The program is declaring two static variables, "i" and "j". Since these variables are not assigned any values, their default values are used. In C#, the default value for an integer is 0, and the default value for a boolean is false. Therefore, when the program prints the values of "i" and "j", it will output "0 false".

    Rate this question:

  • 13. 

    O/P of program belowpublic class zzz    {      static int i=j+10;      static int j=i+1;      public static void Main()      {         System.Console.WritleLine(zzz.i+ " " +zzz.j);      }    }

    • A.

      Null Null

    • B.

      10 1

    • C.

      10 11

    • D.

      None

    Correct Answer
    C. 10 11
    Explanation
    The program initializes the variables i and j with specific values. The value of i is set to the value of j plus 10, which means i will be 10. Then, the value of j is set to the value of i plus 1, which means j will be 11. Finally, the program prints the values of i and j, which are 10 and 11 respectively.

    Rate this question:

  • 14. 

    Which one is truei) A class inhertits everything from its base class except the constructors and destructors.ii) A derived class can inherit all the members of base class but cant subtract or remove members of base class.iii) A derived class can hide members of the base class by creating functions of same name. The original member in base class remains unchanged and uneffected by whatever is happening in derived class, it remains unchanged in the base class, its simply not visible in derived class.

    • A.

      None

    • B.

      All

    • C.

      I & II

    • D.

      II & III

    Correct Answer
    B. All
    Explanation
    The given statement is true because all three statements are correct. Inheritance in a class does exclude constructors and destructors from the base class, but it inherits all other members. A derived class can inherit all members of the base class and cannot subtract or remove any members. Lastly, a derived class can hide members of the base class by creating functions with the same name, but the original member in the base class remains unchanged and unaffected. Therefore, all three statements are true.

    Rate this question:

  • 15. 

    Can we use * (asterisk) sign in c#?

    • A.

      Yes

    • B.

      No

    Correct Answer
    A. Yes
    Explanation
    Yes, we can use the * (asterisk) sign in C#. It is commonly used as the multiplication operator to perform arithmetic operations on numeric values. Additionally, it can also be used as a pointer type modifier in unsafe code blocks to declare pointer variables.

    Rate this question:

  • 16. 

    Does the View occupy memory space?

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The view does not occupy memory space. Views in databases are virtual tables that are generated based on the result of a query. They do not store any data themselves but rather provide a way to access and manipulate data from one or more underlying tables. When a view is queried, the database engine dynamically retrieves the required data from the underlying tables, without storing it separately in memory. Therefore, the statement "False" is correct.

    Rate this question:

  • 17. 

    Can u drop a table if it has a view?

    • A.

      Yes

    • B.

      No

    Correct Answer
    A. Yes
    Explanation
    Yes, a table can be dropped even if it has a view. Dropping a table will also drop any associated views, as well as any other dependent objects such as triggers or procedures. Therefore, it is possible to drop a table that has a view without any issues.

    Rate this question:

  • 18. 

    Can we use ORDER BY clause in the definition of a view?

    • A.

      Yes

    • B.

      No

    Correct Answer
    B. No
    Explanation
    The ORDER BY clause cannot be used in the definition of a view. A view is a virtual table that is derived from one or more tables or views, and it does not store any data itself. The ORDER BY clause is used to sort the result set of a query, but since a view does not store data, it does not make sense to use the ORDER BY clause in its definition. The ORDER BY clause should be used when querying the view, not when defining it.

    Rate this question:

  • 19. 

    When do one need to recompile stored procedure?

    • A.

      If a new index is added from which the stored procedure might benefit

    • B.

      New column is added to table

    • C.

      Table data is updated

    • D.

      All

    Correct Answer
    A. If a new index is added from which the stored procedure might benefit
    Explanation
    When a new index is added from which the stored procedure might benefit, it is necessary to recompile the stored procedure. This is because the addition of a new index can potentially change the execution plan of the stored procedure, leading to improved performance. By recompiling the stored procedure, the database can generate a new execution plan that takes into account the new index, ensuring optimal query performance.

    Rate this question:

  • 20. 

    Can a Stored Procedure call itself (recursive)?

    • A.

      Yes

    • B.

      No

    Correct Answer
    A. Yes
    Explanation
    A stored procedure can call itself recursively. This means that within the body of the procedure, it can include a statement to execute the same procedure again. This can be useful in situations where a repetitive task needs to be performed multiple times, with each iteration building upon the previous one. Recursive stored procedures can help simplify complex tasks and improve code reusability. However, it is important to ensure that proper termination conditions are defined to prevent infinite loops.

    Rate this question:

  • 21. 

    What is the difference between UNION and JOINS?

    • A.

      Join selects columns

    • B.

      Union selects rows.

    • C.

      Both

    • D.

      None

    Correct Answer
    C. Both
    Explanation
    The correct answer is "Both." The difference between UNION and JOINS is that JOINs select columns from multiple tables based on a specified condition, while UNION combines the result sets of two or more SELECT statements into a single result set, which includes all the rows from each SELECT statement. Therefore, both statements are correct in describing the differences between UNION and JOINS.

    Rate this question:

  • 22. 

    Diff b/w primary key and unique key.a) Primary is always uniqueb) unique can be nullc) primary can be nulld) unique is primary

    • A.

      A,b

    • B.

      B,c

    • C.

      C,d

    • D.

      D,a

    Correct Answer
    A. A,b
    Explanation
    The correct answer is a,b. This is because a primary key is always unique, meaning it cannot have duplicate values in a table. On the other hand, a unique key can also be null, allowing for the possibility of having duplicate values in a table. Therefore, option a,b accurately describes the difference between a primary key and a unique key.

    Rate this question:

  • 23. 

    Difference between char and nvarchar a) char[(n)] - Fixed-length non-Unicode character data with length of n bytes.b) nvarchar(n) - Variable-length Unicode character data of n characters. c) char cant have numbersd) none

    • A.

      A,c

    • B.

      B,d

    • C.

      B,c

    • D.

      A,b

    Correct Answer
    D. A,b
    Explanation
    The correct answer is a,b.


    a) char[(n)] is a fixed-length non-Unicode character data type with a length of n bytes.
    b) nvarchar(n) is a variable-length Unicode character data type of n characters.

    This means that the main difference between char and nvarchar is that char is non-Unicode and has a fixed length, while nvarchar is Unicode and has a variable length.

    Rate this question:

  • 24. 

    Function can use DML statements

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is false. Functions in most programming languages are not allowed to use Data Manipulation Language (DML) statements, such as INSERT, UPDATE, or DELETE, as they are primarily used for querying and retrieving data. DML statements are typically used in procedures or scripts rather than functions. Functions are designed to perform calculations or return values based on input parameters, making them more suitable for data manipulation and transformation rather than modifying the data itself.

    Rate this question:

  • 25. 

    Stored Procedure always have to return a value

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Stored procedures do not always have to return a value. A stored procedure is a set of pre-compiled SQL statements that can perform various operations, such as inserting, updating, or deleting data in a database. While a stored procedure can return a value using the RETURN statement, it is not mandatory. Some stored procedures may be designed to perform actions without returning any specific value. Therefore, the statement "Stored Procedure always have to return a value" is false.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Dec 08, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 26, 2014
    Quiz Created by
    Alokanibha

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.