0

Java Online Quiz

Description: Questions about Java,Git,JUnit and SQL
Number of Questions: 60
Created by:
Tags: programming
Attempted 0/59 Correct 0 Score 0

Denormalization is

  1. The process of adding redundancy to a database

  2. Using triggers to automate tasks

  3. Abstracting data

  4. Putting the database in an exceptional state that prevents public access


Correct Option: A

Data Definition Language (DDL) statements are used to define database structure or schema

  1. True

  2. False


Correct Option: A

DML stands for

  1. Data Manipulated Language

  2. Defined Manipulation Language

  3. data Morphed Language

  4. Data Manipulation Language


Correct Option: D

DDL stands for

  1. Data Definition Language

  2. Data Directed Language

  3. Data Defined Language

  4. Derived Data Language


Correct Option: A

Which SQL statement is used to insert new data in a database?

  1. insert into

  2. insert new

  3. add new

  4. add record


Correct Option: A

What is SQL Injection?

  1. Using inline queries in a SqlCommand object

  2. Using Parameters to take inputs from users

  3. Injecting a SQL Statement as user input

  4. Installing a plugin to SQL Server Management Studio


Correct Option: C

The SQL UPDATE statement can...

  1. Update only one row at a time

  2. Update multiple rows at a time

  3. Delete a row based on a where clause

  4. Update the current system time of the database


Correct Option: B

Which of the following are typical commands of DML?

  1. CREATE

  2. ALTER

  3. DROP

  4. UPDATE


Correct Option: D

SQL stands for:

  1. Shorthand Query Language

  2. Structured Query Lines

  3. Structured Query Language

  4. Structured Query Lambda


Correct Option: C

A constraint is applied to a row and not a column

  1. True

  2. False


Correct Option: B

A primary key is used to uniquely identify a particular entry or row in a table.

  1. True

  2. False


Correct Option: A

In a one-to-one relationship, you typically use a third table as an association or join table.

  1. True

  2. False


Correct Option: B

DDL Statements include commands like INSERT, UPDATE, and DELETE?

  1. True

  2. False


Correct Option: B

Which command is used to remove a table from memory?

  1. DELETE

  2. DROP

  3. TRUNCATE

  4. REMOVE


Correct Option: B

A subquery is a SQL query that inserts a record into a table.

  1. True

  2. False


Correct Option: B

Which of the following returns the number of records in the result from a SELECT query?

  1. ADD()

  2. SUM()

  3. COUNT()

  4. TOTAL()


Correct Option: C

Which of the following retrieves all columns and all rows from the Customers table?

  1. SELECT * FROM Customers

  2. SELECT % FROM Customers

  3. SELECT all FROM Customers

  4. SELECT all columns FROM Customers


Correct Option: A

CRUD stands for:

  1. Create, Retrieve, Update, Derive

  2. Create, Retrieve, Undo, Delete

  3. Create, Read, Update, Delete

  4. Control, Read, Undo, Delete


Correct Option: C

Use the AS keyword to specify an alias

  1. True

  2. False


Correct Option: A

A join can be used to combine information from two separate tables

  1. True

  2. False


Correct Option: A

What is required of a primary key? (Select all that apply)

  1. Unique Value

  2. Integer Data Type

  3. Not Null

  4. Foreign


Correct Option: A,C

What do we call a field that references a field in another table?

  1. Connection Key

  2. Primary Key

  3. Candidate Key

  4. Foreign Key


Correct Option: D

Insert is a part of this sublanguage

  1. DQL

  2. DML

  3. TCL

  4. DDL


Correct Option: B

UPPER(), ABS(), CONCAT() are examples of

  1. Aggregate Functions

  2. Constraints

  3. Scalar functions

  4. Filters


Correct Option: C

MAX(), SUM(), and COUNT() are examples of

  1. Aggregate functions

  2. Scalar functions

  3. Operators

  4. Sequences


Correct Option: A

Referential integrity stipulates

  1. Every table must have a primary key

  2. Foreign keys must always reference a valid unique key

  3. Joins should only be used with foreign and primary keys

  4. Columns should be atomic


Correct Option: B

In SQL, NULL values

  1. May throw NullPointerExceptions

  2. Have undefined behavior in logical expressions

  3. Represent the lack of a value for a column

  4. Are only valid in columns with the NULLABLE constraint


Correct Option: C

The UNIQUE constraint requires that values must be

  1. Unique in the table

  2. Uniquely reference a primary key

  3. Unique in the row

  4. Unique in the column


Correct Option: D

A sequence is

  1. Operations meant to encapsulate a task and must maintain ACID properties

  2. Used to track sequence values

  3. A column data type used to represent arrays

  4. The set of valid values in a BETWEEN clause


Correct Option: B

What do we call a primary key that consists of multiple columns in a table?

  1. composite key

  2. double-primary key

  3. consisting key

  4. foreign key


Correct Option: A

Which of the following statements are correct about JUnit?

  1. It is an open source framework.

  2. All of the above.

  3. It provides Annotation to identify the test methods.

  4. It provides Assertions for testing expected results.


Correct Option: B

Which of the following annotation causes that method to be run before each Test method?

  1. @Test

  2. @After

  3. @BeforeClass

  4. @Before


Correct Option: D

Which of the following classes implement the Map interface? (Choose all that apply)

  1. HashMap

  2. ArrayMap

  3. Hashtable

  4. TreeMap


Correct Option: A,C,D

What is garbage collection?

  1. The process of negating methods from a super class.

  2. The process of restoring orphaned objects.

  3. The process of de-allocating memory automatically.

  4. The process of creating a new object.


Correct Option: C

What is test-driven development?

  1. Process of writing tests first, then ensuring the tests pass

  2. The process of writing tests at the end of development

  3. The process of having end users test out the application and report bugs

  4. The process of automating deployment of the application and then testing


Correct Option: A

What is unit testing?

  1. Manually testing your application through the GUI or the command line

  2. Testing the smallest components of the application in isolation.

  3. A way of testing the integration of many different components

  4. Having the end users of the application try it out and report bugs


Correct Option: B

What is JUnit?

  1. An integration testing framework for Java

  2. A unit test framework for any programming language

  3. A unit testing framework for Java

  4. A testing library which provides a few helper methods


Correct Option: C

A mock is used to

  1. Provide stand-in objects for dependencies to isolate tested code.

  2. Modify the tested class state at runtime.

  3. Assert values to ensure they meet expectations.

  4. Fake unit tests so that they pass regardless of code stability.


Correct Option: A

What language does Gradle use for declaring the project configuration

  1. XML

  2. HTML

  3. JSON

  4. Groovy


Correct Option: D

Which interface does not extend the Collection interface?

  1. List

  2. Map

  3. Set

  4. Queue


Correct Option: B

A class can be abstract, even if all of its methods are concrete.

  1. True

  2. False


Correct Option: A

The equals() method is equivalent to the == operator, unless overridden

  1. True

  2. False


Correct Option: A

Java can be run on any machine that has a JVM

  1. True

  2. False


Correct Option: A

What is the standard signature for the main method?

  1. public void main(String args[])

  2. public void static main(String args[])

  3. public static void main(String args[])

  4. public static void main()


Correct Option: C

An unchecked exception must be dealt with in a try/catch block.

  1. True

  2. False


Correct Option: B

A sub class can access private members of the super class.

  1. True

  2. False


Correct Option: B

Method overriding is

  1. Method with different number or type of parameters

  2. When the JVM overrides your calls for Garbage Collection.

  3. None of the Above

  4. Same method signature but different implementation


Correct Option: D

How do you get the size of an array?

  1. myArray.size

  2. myArray.size()

  3. myArray.length

  4. myArray.length()


Correct Option: C

Which of the following are Short-Circuit?

  1. ||

  2. &

  3. &&


Correct Option: B,D

Serializable interface methods must be implemented in the class it extends.

  1. True

  2. False


Correct Option: B

Under what situation do you obtain a default constructor?

  1. When the class has no other constructors

  2. When you define at least one constructor with at least one parameter

  3. When you define at least one constructor

  4. none of the above


Correct Option: A

The changes to the instance variables of one object also have an effect on the instance variables of the other object.

  1. True

  2. False


Correct Option: B

A try-finally block is legal and does not require a catch block.

  1. True

  2. False


Correct Option: A

What is the root interface of the Collections API?

  1. Collections

  2. Throwable

  3. List

  4. Collection


Correct Option: D

Which one of these is NOT a benefit provided by an IDE?

  1. They provide a GUI for writing code

  2. They can compile your code for you

  3. They automatically download 3rd-party libraries from the internet

  4. They make it easy to manage your project structure


Correct Option: C

What is the purpose of the Java compiler?

  1. To transform Java code into instructions usable by a web browser

  2. To transform Java code into instructions usable by the JVM

  3. To transform Java code into instructions usable by the operating system


Correct Option: B

What is the proper format for assigning a value to a variable?

  1. int 5 = x;

  2. 5 = x int;

  3. int x = 5;

  4. x = 5 int;


Correct Option: C

What is the difference between the = and == operators?

  1. The = operator is assignment, the == operator tests equality

  2. The == operator is assignment, the = operator tests equality


Correct Option: A

If one class can be described as a "specific example" of another, that relationship can be described through inheritance

  1. True

  2. False


Correct Option: A
- Hide questions