Fresher Drive @ 27 September - C#, SQL

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Alokanibha
A
Alokanibha
Community Contributor
Quizzes Created: 4 | Total Attempts: 391
| Attempts: 90 | Questions: 25
Please wait...
Question 1 / 25
0 %
0/100
Score 0/100
1. Can u drop a table if it has a view?

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.

Submit
Please wait...
About This Quiz
Fresher Drive @ 27 September - C#, SQL - Quiz

This quiz is designed for freshers preparing for roles involving C# and SQL, focusing on basic concepts like namespaces, access modifiers, and inheritance in C#.

2. 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

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.

Submit
3. Can a Stored Procedure call itself (recursive)?

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.

Submit
4. What is the difference between UNION and JOINS?

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.

Submit
5. 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);    }

Explanation

not-available-via-ai

Submit
6. Does the View occupy memory space?

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.

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

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.

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

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.

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

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".

Submit
10. Stored Procedure always have to return a value

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.

Submit
11. Can we call destructor arbitrarily?

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."

Submit
12. Destructor can be parameterized.

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.

Submit
13. Default namespace in dotnet?

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.

Submit
14. 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);      }    }

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.

Submit
15. Signature of function contains?

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".

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

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.

Submit
17. Access modifier for destructor?

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.

Submit
18. Function can use DML statements

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.

Submit
19. Which access modifier destructor can have?

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.

Submit
20. When do one need to recompile stored procedure?

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.

Submit
21. Which modifier cant be used with class name?

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.

Submit
22. 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.

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.

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

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.

Submit
24. Int is a?

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.

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

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.

Submit
View My Results

Quiz Review Timeline (Updated): Dec 8, 2023 +

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
Cancel
  • All
    All (25)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Can u drop a table if it has a view?
Difference between char and nvarchar a) char[(n)] - Fixed-length...
Can a Stored Procedure call itself (recursive)?
What is the difference between UNION and JOINS?
What will be the O/P of following program?const int i=j+4;  ...
Does the View occupy memory space?
Diff b/w primary key and unique key.a) Primary is always uniqueb)...
Can we use * (asterisk) sign in c#?
O/P of program belowpublic class zzz    {  ...
Stored Procedure always have to return a value
Can we call destructor arbitrarily?
Destructor can be parameterized.
Default namespace in dotnet?
O/P of program belowpublic class zzz    {  ...
Signature of function contains?
Using which we can define the function in child class of same...
Access modifier for destructor?
Function can use DML statements
Which access modifier destructor can have?
When do one need to recompile stored procedure?
Which modifier cant be used with class name?
Which one is truei) A class inhertits everything from its base class...
Can we use ORDER BY clause in the definition of a view?
Int is a?
Is there any class in C# which on which v can use inheritance?
Alert!

Advertisement