0

programming languages Online Quiz - 38

Description: programming languages Online Quiz - 38
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which version of the .NET Framework introduced WPF?

  1. 1.1

  2. 2.0

  3. 3.0

  4. 3.5

  5. 4.0


Correct Option: C

How can a class be both abstract and sealed?

  1. The class has no public constructors.

  2. The class is static.

  3. The class implements more than one interface.

  4. The class is generic.

  5. This scenario is impossible.


Correct Option: B

Which of the following technologies does NOT support some form of declarative data binding?

  1. WPF

  2. Windows Forms

  3. ASP.NET

  4. XAML

  5. Silverlight


Correct Option: B

Which of the following is not a real namespace in the .NET Framework?

  1. System

  2. System.Windows

  3. System.Windows.Presentation

  4. System.Windows.Media

  5. System.Windows.Zaml


Correct Option: E

How do you get help about the command "cp"?

  1. help cp

  2. man cp

  3. cp ?

  4. ? cp


Correct Option: B

How do you list all the files that are in the current directory?

  1. list all

  2. ls -full

  3. ls -a

  4. ls -all


Correct Option: C

How do you rename file "new" in file "old"?

  1. mv new old

  2. cp new old

  3. rn new old

  4. rename new old


Correct Option: A

How do you visualize the content of file "not_empty"?

  1. type not_empty

  2. cat not_empty

  3. more not_empty

  4. view not_empty


Correct Option: B

How do you create a new directory called "flower"?

  1. newdir flower

  2. mkdir flower

  3. crdir flower

  4. create flower


Correct Option: B

The following statement is valid. double price = 7,450.98

  1. True

  2. False


Correct Option: B

Which of the following are storage qualifiers in C++ ?

  1. const

  2. volatile

  3. mutable

  4. All the Above

  5. None of the Above


Correct Option: D

Which of the following exists in C++?

  1. virtual destructor

  2. virtual constructor

  3. Both A and B

  4. None of the Above


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of virtual functions in C++.

In C++, virtual functions are used to achieve runtime polymorphism. When a base class pointer points to a derived class object, and a virtual function is called using that pointer, the function in the derived class gets executed instead of the base class. This allows for dynamic binding of the function call based on the actual type of the object being pointed to.

Now, let's go through each option to understand why it is correct or incorrect:

Option A) virtual destructor - This option is correct. In C++, a virtual destructor is used to ensure that the destructor of the most derived class is called when deleting an object through a base class pointer. This is important when dealing with polymorphic objects to ensure that all resources are properly deallocated.

Option B) virtual constructor - This option is incorrect. In C++, constructors cannot be virtual. The constructor of a class is called automatically when an object is created, and it is determined statically at compile-time based on the type of the object being created.

Option C) Both A and B - This option is incorrect because option B is incorrect. Only option A, virtual destructor, exists in C++.

Option D) None of the Above - This option is incorrect. As explained above, option A, virtual destructor, exists in C++.

The correct answer is A) virtual destructor. This option is correct because a virtual destructor is used in C++ to ensure proper cleanup of resources when deleting objects through base class pointers.

A template can be instantiated by

  1. Explicit Instantiation

  2. Implicit instantiation

  3. Both A and B

  4. None of the Above


Correct Option: C

The member functions of a class can be defined outside the class using

  1. Extraction Operator

  2. Insertion Operator

  3. Scope resolution operator

  4. None of the Above


Correct Option: C

The output of operation 20%3 is

  1. 6

  2. 2

  3. 1

  4. 4


Correct Option: B

Using pointers to call a function is called as

  1. call by value

  2. call by reference

  3. call by address

  4. All the Above


Correct Option: B

What will be output if you will Execute following code?

  1. 65

  2. -65

  3. 97

  4. -97

  5. CompilationError


Correct Option: D

Which of the following can be used to initialize a newly declared variable from an existing variable?

  1. Virtual Function

  2. Namespaces

  3. copy constructor

  4. None of the Above


Correct Option: C

AI Explanation

To answer this question, you need to understand the concept of initializing variables from existing variables.

Let's go through each option to understand why it is correct or incorrect:

Option A) Virtual Function - Virtual functions are used to achieve polymorphism in object-oriented programming. They are not used for initializing variables from existing variables, so this option is incorrect.

Option B) Namespaces - Namespaces are used to organize code into logical groups and prevent naming conflicts. They are not used for initializing variables from existing variables, so this option is incorrect.

Option C) Copy Constructor - A copy constructor is a special constructor that creates a new object by initializing it with an existing object of the same class. This is the correct option because it allows you to initialize a newly declared variable from an existing variable.

Option D) None of the Above - This option is incorrect because the correct answer is option C, copy constructor.

The correct answer is option C) copy constructor. This option is correct because it allows you to initialize a newly declared variable from an existing variable.

The inserting of the code of a called function at the point where the function gets called is achieved by using

  1. Inline functions

  2. virtual functions

  3. Both A and B

  4. None of the Above


Correct Option: A
- Hide questions