Java, SQL, and JUnit Fundamentals
Comprehensive quiz covering Java programming concepts, SQL database operations, and JUnit testing framework fundamentals
Questions
Denormalization is
- The process of adding redundancy to a database
- Using triggers to automate tasks
- Abstracting data
- Putting the database in an exceptional state that prevents public access
Data Definition Language (DDL) statements are used to define database structure or schema
- True
- False
DML stands for
- Data Manipulated Language
- Defined Manipulation Language
- data Morphed Language
- Data Manipulation Language
DDL stands for
- Data Definition Language
- Data Directed Language
- Data Defined Language
- Derived Data Language
Which SQL statement is used to insert new data in a database?
- insert into
- insert new
- add new
- add record
What is SQL Injection?
- Using inline queries in a SqlCommand object
- Using Parameters to take inputs from users
- Injecting a SQL Statement as user input
- Installing a plugin to SQL Server Management Studio
The SQL UPDATE statement can...
- Update only one row at a time
- Update multiple rows at a time
- Delete a row based on a where clause
- Update the current system time of the database
Which of the following are typical commands of DML?
- CREATE
- ALTER
- DROP
- UPDATE
SQL stands for:
- Shorthand Query Language
- Structured Query Lines
- Structured Query Language
- Structured Query Lambda
A constraint is applied to a row and not a column
- True
- False
A primary key is used to uniquely identify a particular entry or row in a table.
- True
- False
In a one-to-one relationship, you typically use a third table as an association or join table.
- True
- False
DDL Statements include commands like INSERT, UPDATE, and DELETE?
- True
- False
Which command is used to remove a table from memory?
- DELETE
- DROP
- TRUNCATE
- REMOVE
A subquery is a SQL query that inserts a record into a table.
- True
- False
Which of the following returns the number of records in the result from a SELECT query?
- ADD()
- SUM()
- COUNT()
- TOTAL()
Which of the following retrieves all columns and all rows from the Customers table?
- SELECT * FROM Customers
- SELECT % FROM Customers
- SELECT all FROM Customers
- SELECT all columns FROM Customers
CRUD stands for:
- Create, Retrieve, Update, Derive
- Create, Retrieve, Undo, Delete
- Create, Read, Update, Delete
- Control, Read, Undo, Delete
Use the AS keyword to specify an alias
- True
- False
A join can be used to combine information from two separate tables
- True
- False
What is required of a primary key? (Select all that apply)
- Unique Value
- Integer Data Type
- Not Null
- Foreign
What do we call a field that references a field in another table?
- Connection Key
- Primary Key
- Candidate Key
- Foreign Key
Insert is a part of this sublanguage
- DQL
- DML
- TCL
- DDL
UPPER(), ABS(), CONCAT() are examples of
- Aggregate Functions
- Constraints
- Scalar functions
- Filters
MAX(), SUM(), and COUNT() are examples of
- Aggregate functions
- Scalar functions
- Operators
- Sequences
Referential integrity stipulates
- Every table must have a primary key
- Foreign keys must always reference a valid unique key
- Joins should only be used with foreign and primary keys
- Columns should be atomic
In SQL, NULL values
- May throw NullPointerExceptions
- Have undefined behavior in logical expressions
- Represent the lack of a value for a column
- Are only valid in columns with the NULLABLE constraint
The UNIQUE constraint requires that values must be
- Unique in the table
- Uniquely reference a primary key
- Unique in the row
- Unique in the column
A sequence is
- Operations meant to encapsulate a task and must maintain ACID properties
- Used to track sequence values
- A column data type used to represent arrays
- The set of valid values in a BETWEEN clause
What do we call a primary key that consists of multiple columns in a table?
- composite key
- double-primary key
- consisting key
- foreign key
Which of the following statements are correct about JUnit?
- It is an open source framework.
- All of the above.
- It provides Annotation to identify the test methods.
- It provides Assertions for testing expected results.
Which of the following annotation causes that method to be run before each Test method?
- @Test
- @After
- @BeforeClass
- @Before
Which of the following classes implement the Map interface? (Choose all that apply)
- HashMap
- ArrayMap
- Hashtable
- TreeMap
What is garbage collection?
- The process of negating methods from a super class.
- The process of restoring orphaned objects.
- The process of de-allocating memory automatically.
- The process of creating a new object.
What is test-driven development?
- Process of writing tests first, then ensuring the tests pass
- The process of writing tests at the end of development
- The process of having end users test out the application and report bugs
- The process of automating deployment of the application and then testing
What is unit testing?
- Manually testing your application through the GUI or the command line
- Testing the smallest components of the application in isolation.
- A way of testing the integration of many different components
- Having the end users of the application try it out and report bugs
What is JUnit?
- An integration testing framework for Java
- A unit test framework for any programming language
- A unit testing framework for Java
- A testing library which provides a few helper methods
A mock is used to
- Provide stand-in objects for dependencies to isolate tested code.
- Modify the tested class state at runtime.
- Assert values to ensure they meet expectations.
- Fake unit tests so that they pass regardless of code stability.
What language does Gradle use for declaring the project configuration
- XML
- HTML
- JSON
- Groovy
Which interface does not extend the Collection interface?
- List
- Map
- Set
- Queue
A class can be abstract, even if all of its methods are concrete.
- True
- False
The equals() method is equivalent to the == operator, unless overridden
- True
- False
Java can be run on any machine that has a JVM
- True
- False
What is the standard signature for the main method?
- public void main(String args[])
- public void static main(String args[])
- public static void main(String args[])
- public static void main()
An unchecked exception must be dealt with in a try/catch block.
- True
- False
A sub class can access private members of the super class.
- True
- False
Method overriding is
- Method with different number or type of parameters
- When the JVM overrides your calls for Garbage Collection.
- None of the Above
- Same method signature but different implementation
How do you get the size of an array?
- myArray.size
- myArray.size()
- myArray.length
- myArray.length()
Which of the following are Short-Circuit?
- |
- ||
- &
- &&
Serializable interface methods must be implemented in the class it extends.
- True
- False
Under what situation do you obtain a default constructor?
- When the class has no other constructors
- When you define at least one constructor with at least one parameter
- When you define at least one constructor
- none of the above
The changes to the instance variables of one object also have an effect on the instance variables of the other object.
- True
- False
A try-finally block is legal and does not require a catch block.
- True
- False
What is the root interface of the Collections API?
- Collections
- Throwable
- List
- Collection
Which one of these is NOT a benefit provided by an IDE?
- They provide a GUI for writing code
- They can compile your code for you
- They automatically download 3rd-party libraries from the internet
- They make it easy to manage your project structure
What is the purpose of the Java compiler?
- To transform Java code into instructions usable by a web browser
- To transform Java code into instructions usable by the JVM
- To transform Java code into instructions usable by the operating system
What is the proper format for assigning a value to a variable?
- int 5 = x;
- 5 = x int;
- int x = 5;
- x = 5 int;
What is the difference between the = and == operators?
- The = operator is assignment, the == operator tests equality
- The == operator is assignment, the = operator tests equality
If one class can be described as a "specific example" of another, that relationship can be described through inheritance
- True
- False