0

programming languages Online Quiz - 92

Description: programming languages Online Quiz - 92
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. To avoid having to declare variables.

  2. To refer to a class without using prefixes.

  3. To avoid calling methods.

  4. To import the images you want to use.


Correct Option: B
Explanation:

To answer this question, the user needs to understand the purpose of import statements in programming.

Option A: This option is incorrect. Import statements have nothing to do with declaring variables. Import statements are used to access classes, functions, and other resources from external modules.

Option B: This option is correct. One of the main advantages of using import statements is that they allow you to refer to a class without having to use a prefix. For example, if you import the "math" module in Python, you can use the "sqrt" function without having to write "math.sqrt" every time.

Option C: This option is incorrect. Import statements are not used to avoid calling methods. In fact, import statements are often used to make it easier to call methods from external modules.

Option D: This option is incorrect. Import statements are not used to import images. They are used to import code from external modules.

Therefore, the correct answer is:

The Answer is: B. To refer to a class without using prefixes.

An applet will run in almost any browser because...

  1. The server has a built-in JVM.

  2. The browser has a built-in JVM.

  3. The source code is interpreted by the browser.

  4. Applets don''t need a JVM.


Correct Option: B

The BorderLayout class provides static fields for...

  1. Introducing new methods.

  2. Adding components to specific areas of a container.

  3. Starting an applet.

  4. Specifying font size and color.


Correct Option: B
  1. Windows

  2. Unix/Linux

  3. Macs

  4. All of the Above


Correct Option: D
  1. A type of coffee

  2. An object-oriented programming language

  3. A Structured Programming language

  4. An interactive website


Correct Option: B

Which method will a web browser call first on a new applet?

  1. main method.

  2. start method.

  3. init method.

  4. run method


Correct Option: C

AI Explanation

To answer this question, you need to understand the lifecycle of an applet in Java.

When a web browser encounters an applet embedded in a webpage, it follows a specific sequence of method calls to initialize and start the applet. The correct answer is C) init method.

The init method is the first method called by a web browser when it encounters a new applet. This method is responsible for initializing the applet and setting up any necessary resources. It is typically used to perform tasks such as initializing variables, setting the applet's size, and loading any necessary resources.

After the init method is called, the browser will call the start method, which is responsible for starting the execution of the applet. The start method is typically used to start any threads or timers needed for the applet's functionality.

The main method, option A, is not applicable to applets. The main method is the entry point for standalone Java applications, not applets.

The run method, option D, is also not applicable to applets. The run method is used for multi-threaded programming in Java, but applets run in a single thread controlled by the browser.

Therefore, the correct answer is C) init method.

What is an Applet?

  1. An interactive website

  2. A Java program that is run through a web browser

  3. A type of computer

  4. Java method


Correct Option: B
  1. Java programming is derived from C++.

  2. The compiler is identical to a C++ compiler.

  3. The APIs do all the work.

  4. The Java Virtual Machine(JVM) interprets the program for the native operating system.


Correct Option: D

Servlets are typically used for...

  1. Extending a web server by providing dynamic web content.

  2. Create a JVM for applets.

  3. Storing information in applets.

  4. Loading buttons and menus.


Correct Option: A

When a program class implements an interface, it must provide behavior for...

  1. Two methods defined in that interface.

  2. All methods defined in that interface.

  3. Only certain methods in an interface.

  4. Any methods in a class.


Correct Option: B

Servlets are typically used for...

  1. Create a JVM for applets.

  2. Extending a web server by providing dynamic web content.

  3. Storing information in applets.

  4. Loading buttons and menus.


Correct Option: B

When a program class implements an interface, it must provide behavior for...

  1. Two methods defined in that interface.

  2. Only certain methods in an interface.

  3. All methods defined in that interface.

  4. Any methods in a class.


Correct Option: C
  1. Java programming is derived from C++.

  2. The Java Virtual Machine(JVM) interprets the program for the native operating system.

  3. The compiler is identical to a C++ compiler.

  4. The APIs do all the work.


Correct Option: B

An applet will run in almost any browser because...

  1. The server has a built-in JVM.

  2. The browser has a built-in JVM.

  3. The source code is interpreted by the browser.

  4. Applets don''t need a JVM.


Correct Option: B

What is tool tip text

  1. Tool tip text is the same as the caption

  2. Tool tip text is a tip of the day

  3. Tool tip text is shown when the mouse is held over a object for a period of time

  4. Tool tip text does not exist


Correct Option: C

What is the purpose of the name function in all controls?

  1. they can be sorted by type

  2. they can be called at runtime

  3. name functions does not exist

  4. they can be sorted by value


Correct Option: B

Which of these is not an vaild messagebox in VB?

  1. vbOKonly

  2. vbExitOnly

  3. vbRetryCancel

  4. vbAbortRetryIgnore


Correct Option: B

A control array is a list of controls with?

  1. Different names

  2. Same name

  3. Both 1 and 2

  4. None of these


Correct Option: B

What is the name of the bar where you would see a Categorized view or a Alphabetic View ?

  1. Project Properties Window

  2. Tool Bar

  3. Tool Box window

  4. Project explorer


Correct Option: A

AI Explanation

To answer this question, you need to understand the different components of an integrated development environment (IDE) or programming software.

Option A) Project Properties Window - This option is incorrect because the project properties window typically allows you to configure settings and properties of a specific project, such as build options, compiler settings, and deployment options. It does not provide a categorized or alphabetical view.

Option B) Tool Bar - This option is incorrect because the tool bar is a graphical user interface element that contains icons or buttons for frequently used functions or commands. It does not provide a categorized or alphabetical view.

Option C) Tool Box Window - This option is incorrect because the tool box window typically contains a collection of controls or components that can be used in the design or development of a graphical user interface. It does not provide a categorized or alphabetical view.

Option D) Project Explorer - This option is incorrect because the project explorer is a panel or window that displays the structure and contents of a project, such as files, folders, and resources. While it provides a hierarchical view of the project, it does not specifically provide a categorized or alphabetical view.

The correct answer is A) Project Properties Window. This option is correct because the project properties window often provides a categorized view or an alphabetical view of the properties and settings related to a specific project.

- Hide questions