0

programming languages Online Quiz - 126

Description: programming languages Online Quiz - 126
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. Special icons for creating the user interface elements for thin clients

  2. A data module saved to the component area of the database.

  3. A self-contained functional software unit that is assembled into a J2ee application and interfaces with other application components

  4. A JAR file


Correct Option: C

What advantage does a entity-bean have over a session bean?

  1. Entity-bean data survives crashes.

  2. An entity-bean represents non-persistent data.

  3. It creates its own JAR file during deployment

  4. You get authentication code without having to write any.


Correct Option: A

When do you use a session bean?

  1. When you want to be certain your application data persists between program invocations , even in the event of a crash

  2. If you need to initiate a database transaction

  3. To process transient data that can be re-created in the event of a crash.

  4. to keep people who do not know how to program , from accidentally changing important logic code.


Correct Option: C

Why would you design a J2EE application so user data is entered by way of a JavaServer Page and managed by an underlying JavaBeans class?

  1. To make the user interface more interesting.

  2. To simplify application deployment.

  3. To prevent malicious programs from gaining access to sensitive information on your database server.

  4. To make the application much easier to update, maintain, and manage


Correct Option: D

Why is XML a good way to transfer text-based data from one program or tool to another?

  1. XML imposes important limitations on the receiving program or tool.

  2. The receiving program or tool can use the XML tagging information to determine how to best handle the incoming data

  3. XML tags offer an extra level of security.

  4. XML tags specify to the receiving program or tool exactly how to format and display the data.


Correct Option: B

What part of the J2EE platform handles data storage and retrieval on behalf of a container-managed entity bean?

  1. The thin client.

  2. Deployment descriptors

  3. The JAR file.

  4. The bean's container


Correct Option: D

What is bean-managed persistence?

  1. When you implement entity or session bean methods to use SQL commands you provide

  2. When the bean's container handles data storage and retrieval.

  3. When the J2EE server is never shut down.

  4. When changes to database data are lost during a crash


Correct Option: A

How are life cycle methods called?

  1. By thin clients.

  2. By calls to the database

  3. By the J2EE server.

  4. By the bean's container.


Correct Option: D

In a multitiered application, which tier is the browser in?

  1. First tier.

  2. Second tier.

  3. Third tier.

  4. Fourth tier.


Correct Option: A
  1. Run time

  2. Compile time

  3. Depends on how it is invoked

  4. Both b and c


Correct Option: B

Every class has at least one constructor function, even when none is declared.

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of constructor functions in object-oriented programming.

In object-oriented programming, a constructor function is a special method that is used to initialize objects of a class. It is called automatically when an object is created from the class.

In many programming languages, including Java and C++, if a class does not explicitly define a constructor function, a default constructor is automatically provided by the compiler. This default constructor initializes the object with default values or performs any necessary setup for the object.

Therefore, even when a constructor function is not explicitly declared in a class, a default constructor is still present. So, the statement "Every class has at least one constructor function, even when none is declared" is true.

Option A) True - This option is correct because, as explained above, every class has at least one constructor function, even if none is explicitly declared. Option B) False - This option is incorrect because, as explained above, even when no constructor function is declared, a default constructor is still present.

The correct answer is A) True. This option is correct because every class has at least one constructor function, even when none is declared.

Can constructors be overloaded?

  1. True

  2. False


Correct Option: A

An abstract class can be instantiated.

  1. True

  2. False


Correct Option: B
  1. Public

  2. Protected

  3. Private

  4. Default


Correct Option: C
Explanation:

To solve this question, the user needs to know the concept of access modifiers in object-oriented programming and their default level assigned to the members of a class.

Now, let's go through each option and explain why it is right or wrong:

A. Public: This option is incorrect. Public access modifier allows members of a class to be accessible from anywhere in the program. However, it is not the default access level assigned to members of a class.

B. Protected: This option is incorrect. Protected access modifier allows the members of a class to be accessible within the class and its subclasses. However, it is not the default access level assigned to members of a class.

C. Private: This option is correct. Private access modifier allows the members of a class to be accessible within the class only. It is the default access level assigned to the members of a class if no other access modifier is explicitly specified.

D. Default: This option is incorrect. Default access modifier allows the members of a class to be accessible within the package only. It is not the default access level assigned to the members of a class.

The Answer is: C

  1. Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding

  2. Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called a overloaded fucntion.

  3. Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding

  4. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden fucnion.


Correct Option: C

Which of the following library function below by default aborts the program?

  1. Terminate()

  2. end()

  3. abort()

  4. exit()


Correct Option: A

AI Explanation

To answer this question, you need to understand the purpose and behavior of each library function mentioned.

Option A) Terminate() - This option is incorrect because there is no standard library function called "Terminate()" that aborts the program by default.

Option B) end() - This option is incorrect because there is no standard library function called "end()" that aborts the program by default.

Option C) abort() - This option is correct because the "abort()" function is a standard library function that is used to terminate the program abnormally. When the "abort()" function is called, it causes the program to terminate immediately and generate a core dump (if supported by the operating system).

Option D) exit() - This option is incorrect because the "exit()" function does not abort the program by default. The "exit()" function is used to terminate the program normally by returning an exit status to the operating system.

The correct answer is C) abort(). This option is correct because the "abort()" function is the library function that by default aborts the program.

What happens when a pointer is deleted twice?

  1. It can abort the program

  2. It can cause a failure

  3. It can cause an error

  4. It can cause a trap


Correct Option: D

AI Explanation

To answer this question, we need to understand the concept of memory management in programming.

When a pointer is deleted twice, it can cause a trap. This means that the program can encounter a runtime error or crash.

Here's an explanation for each option:

Option A) It can abort the program - This option is incorrect because deleting a pointer twice does not necessarily result in program abortion. Instead, it can cause a runtime error or crash.

Option B) It can cause a failure - This option is incorrect because "failure" is a broad term and does not specifically describe the consequence of deleting a pointer twice. The consequence is more accurately described as a runtime error or crash.

Option C) It can cause an error - This option is correct because deleting a pointer twice is considered an error in memory management. It violates the principle of proper memory deallocation and can lead to unexpected behavior.

Option D) It can cause a trap - This option is correct because deleting a pointer twice can cause a trap. A trap refers to a runtime error or crash that occurs when the program attempts to access invalid memory.

The correct answer is D) It can cause a trap. This option accurately describes the consequence of deleting a pointer twice, as it can result in a runtime error or crash.

There is nothing like a virtual constructor of a class.

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of constructors in object-oriented programming.

A constructor is a special member function of a class that is used to initialize objects of the class. It is usually called automatically when an object is created. Constructors have the same name as the class and do not have a return type.

In C++, there is no concept of a "virtual constructor." Virtual functions allow a derived class to provide its own implementation of a function defined in the base class. However, constructors cannot be virtual because they are responsible for creating objects and initializing their states, and the concept of virtual dispatch does not apply during object creation.

Therefore, the statement "There is nothing like a virtual constructor of a class" is true. Option A is correct.

- Hide questions