0

programming languages Online Quiz - 91

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

Which of these is used to open an database?

  1. Set dbMyDB = OpenDatabase

  2. Set dbMyDB = OpenDatabase("MyDatabase.mdb")

  3. dbMyDB = OpenDatabase("MyDatabase.mdb")

  4. None of these


Correct Option: B

On start up, which of these window is not displayed?

  1. The Class window

  2. The Project window

  3. The Properties window

  4. The Blank Form window


Correct Option: A

AI Explanation

To answer this question, you need to have a basic understanding of the windows that are typically displayed on start-up in a programming environment. Let's go through each option to understand which window is not displayed:

Option A) The Class window - This option is incorrect because the Class window is typically displayed on start-up in a programming environment. The Class window allows you to view and edit the classes in your project.

Option B) The Project window - This option is incorrect because the Project window is typically displayed on start-up in a programming environment. The Project window provides an overview of the files and resources in your project.

Option C) The Properties window - This option is incorrect because the Properties window is typically displayed on start-up in a programming environment. The Properties window allows you to view and modify the properties of the selected object or control.

Option D) The Blank Form window - This option is correct because the Blank Form window is not typically displayed on start-up in a programming environment. The Blank Form window is only displayed when you create or open a form in your project.

The correct answer is D) The Blank Form window. This option is correct because it is the only window that is not displayed on start-up in a programming environment.

Which of these is not an collection of the VB project?

  1. The object module

  2. The class module

  3. The form module

  4. The global module


Correct Option: A

Visual Basic uses an object called ______ to hold your table?

  1. file

  2. Record

  3. table

  4. RecordSet


Correct Option: D
Explanation:

To solve this question, the user needs to have a basic understanding of Visual Basic programming language and database management.

The correct answer is D.

Explanation:

Visual Basic uses an object called RecordSet to hold your table. Recordset is an object that represents a set of records in a database table or a query result set, and it is used to manipulate data in a database. The Recordset object provides methods and properties to access and manipulate data in a database table or a query result set.

Option A is incorrect because a file is a container for storing data and programs that can be accessed by a computer.

Option B is incorrect because a record is a collection of related data fields or items that are treated as a single unit.

Option C is incorrect because a table is a collection of related data organized in rows and columns, but it is not an object that holds the table in Visual Basic.

Therefore, the correct answer is D.

The Answer is: D.

What will be printed out if this code is run with the following command line? java myprog good morning public class myprog{ public static void main(String argv[]) { System.out.println(argv[2]); } }

  1. myprog

  2. good

  3. morning

  4. Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"


Correct Option: D

A byte can be of what size

  1. -128 to 127

  2. (-2 power 8 )-1 to 2 power 8

  3. -255 to 256

  4. depends on the particular implementation of the Java Virtual machine


Correct Option: A

What data will be printed out if you attempt to compile and run the following code(ignore newline in output)? int i=1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println("default"); }

  1. one

  2. one default

  3. one two default

  4. default


Correct Option: C

Which of the following will output -4.0

  1. System.out.println(Math.floor(-4.7));

  2. System.out.println(Math.round(-4.7));

  3. System.out.println(Math.ceil(-4.7));

  4. System.out.println(Math.min(-4.7));


Correct Option: C

What is the result of the following operation? System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7


Correct Option: D

Which of the following lines will compile without warning or error.

  1. float f=2.3;

  2. char c="z";

  3. boolean b=null;

  4. int i=21;

  5. byte b=257;


Correct Option: D

Which of the following will throw an error while compilation 1) import java.awt.; package Mypackage; class Myclass {} 2) package MyPackage; import java.awt.; class MyClass{} 3) /This is a comment */ package MyPackage; import java.awt.; class MyClass{}

  1. Option 1

  2. Option 2

  3. Option 1 & 2

  4. Option 3

  5. Option 2 & 3


Correct Option: A

What will happen if you try to compile and run the following code public class MyClass { public static void main(String arguments[]) { amethod(arguments); } public void amethod(String[] arguments) { System.out.println(arguments); System.out.println(arguments[1]); } }

  1. error method main not correct

  2. error Can't make static reference to void a method.

  3. error array must include parameter

  4. a method must be declared with String


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) error method main not correct - This option is incorrect. There is no error with the main method in the given code.

Option B) error Can't make static reference to void a method - This option is correct. The error occurs because the method amethod is not static, but it is being called from the static main method. Non-static methods can only be called from an instance of the class, not from a static context.

Option C) error array must include parameter - This option is incorrect. The code has an array parameter arguments in both the main method and the amethod method, so there is no error related to the array parameter.

Option D) a method must be declared with String - This option is incorrect. The code does have a method amethod declared with a String[] parameter, so there is no error related to the method declaration.

The correct answer is B) error Can't make static reference to void a method. This option is correct because the code tries to call a non-static method from a static context, which is not allowed.

If you wanted to find out where the position of the letter v (ie return 2) in the string s containing "Java", which of the following could you use?

  1. mid(2,s);

  2. charAt(2);

  3. s.indexOf('v');

  4. indexOf(s,'v');


Correct Option: C

Which of the following is not a keyword or reserved word in Java?

  1. if

  2. then

  3. goto

  4. while

  5. case


Correct Option: B

if(check4Biz(storeNum) != null) {} Referring to the above, what datatype could be returned by method check4Biz()?

  1. Boolean

  2. int

  3. char

  4. float


Correct Option: A

AI Explanation

To answer this question, we need to consider the given code snippet:

if(check4Biz(storeNum) != null) {}

In this code, the method check4Biz() is being called with the parameter storeNum. The code then checks if the returned value of check4Biz() is not null.

Based on this information, we can deduce that the return type of check4Biz() must be some kind of reference type, as null can only be assigned to reference types in Java.

Looking at the given options:

A) Boolean - This option is correct because Boolean is a reference type, and it can be compared to null.

B) int - This option is incorrect because int is a primitive data type, and it cannot be compared to null.

C) char - This option is incorrect because char is a primitive data type, and it cannot be compared to null.

D) float - This option is incorrect because float is a primitive data type, and it cannot be compared to null.

Therefore, the correct answer is A) Boolean. The return type of the check4Biz() method could be Boolean, which is a reference type that can be compared to null.

Which of the following lines will compile without warning or error.

  1. float f=1.3;

  2. char c="a";

  3. int i=10;

  4. boolean b=null;


Correct Option: C

AI Explanation

To answer this question, we need to understand the data types and their allowed values in Java.

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

Option A) float f=1.3; - This option is incorrect because the value 1.3 is a double literal, and it cannot be directly assigned to a float variable without a typecasting. To fix this, you can either change the data type of the variable to double or use a typecasting operator, as shown below: float f = (float) 1.3; or float f = 1.3f;

Option B) char c="a"; - This option is incorrect because the value "a" is a string literal, and it cannot be directly assigned to a char variable. To fix this, you need to use single quotes to represent a char value, as shown below: char c = 'a';

Option C) int i=10; - This option is correct because the value 10 is an integer literal, and it can be directly assigned to an int variable without any issues.

Option D) boolean b=null; - This option is incorrect because the value null cannot be assigned to a boolean variable. Boolean variables can only have two values: true or false.

The correct answer is option C. This option is correct because the value 10 is an integer literal, and it can be directly assigned to an int variable without any issues.

A byte can be of what size

  1. -128 to 127

  2. (-2 power 8 )-1 to 2 power 8

  3. -255 to 256

  4. 8


Correct Option: A

Which of the following are keywords or reserved words in Java?

  1. if

  2. then

  3. goto

  4. while


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) if - This option is a keyword in Java. The "if" keyword is used to specify a condition in an if statement.

Option B) then - This option is incorrect. "Then" is not a keyword or reserved word in Java.

Option C) goto - This option is incorrect. "Goto" is not a keyword or reserved word in Java.

Option D) while - This option is a keyword in Java. The "while" keyword is used to create a while loop, which repeatedly executes a block of code as long as a given condition is true.

The correct answer is B. "Then" is not a keyword or reserved word in Java.

System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7


Correct Option: D

AI Explanation

To answer this question, we need to understand the bitwise OR operation.

The bitwise OR operation (|) is a binary operation that takes two operands and performs a bitwise OR on each corresponding bit of the operands.

In this case, we have the numbers 4 and 3. Let's convert them to binary:

4 in binary: 100 3 in binary: 011

Performing the bitwise OR operation on each corresponding bit, we get:

100

OR 011

111

Converting the result back to decimal, we get 7.

So, when we execute the statement System.out.println(4 | 3);, the output will be 7.

Therefore, the correct answer is option D.

What is the size for double data type in c#

  1. 1 Byte

  2. 2 Byte

  3. 4 Byte

  4. 8 Byte

  5. 16 Byte


Correct Option: D
- Hide questions