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

What is a J2EE component?

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

Which of the following operators below allow to define the member functions of a class outside the class?

  1. ::

  2. ?

  3. :?

  4. %


Correct Option: A

AI Explanation

To answer this question, you need to understand how member functions of a class are defined.

Option A) :: (Scope resolution operator) - This option is correct because it allows you to define the member functions of a class outside the class. The scope resolution operator is used to define functions outside the class scope.

Option B) ? (Ternary conditional operator) - This option is incorrect because the ternary conditional operator is used for conditional expressions and does not have any relation to defining member functions outside the class.

Option C) :? - This option is incorrect because it does not represent a valid operator in C++.

Option D) % (Modulus operator) - This option is incorrect because the modulus operator is used for calculating the remainder of a division operation and does not have any relation to defining member functions outside the class.

The correct answer is A) :: (Scope resolution operator). This option is correct because it allows you to define the member functions of a class outside the class scope.

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.

An abstract class can be instantiated.

  1. True

  2. False


Correct Option: B

The default access level assigned to members of a class is ___________

  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

What is the difference between overloaded functions and overridden functions?

  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 defines a general set of operations that will be applied to various types of data?

  1. Template class

  2. Function template

  3. Class template

  4. Both a and c


Correct Option: B
  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
- Hide questions