Java and SQL Programming Fundamentals
Test your knowledge of Java APIs, threading, exceptions, OOP concepts, and SQL queries in this programming fundamentals quiz.
Questions
Given: 1. class Ring { 2. final static int x2 = 7; 3. final static Integer x4 = 8; 4. public static void main(String[] args) { 5. Integer x1 = 5; 6. String s = "a"; 7. if(xl < 9) s += "b"; 8. switch(x1) { 9. case 5: s += "c"; 10. case x2: s += "d"; 11. case x4: s += "e"; 12. } 13. System.out.println(s); 14. } 15. } What is the result?
- abc
- abcde
- Compilation fails due only to an error on line 7.
- Compilation fails due only to an error on line 8.
- Compilation fails due only to an error on line 10.
- Compilation fails due only to an error on line 11.
System.out.format("Pi is approximately %d.", Math.PI); What is the result?
- Compilation fails
- Pi is approximately 3
- Pi is approximately 3.141593
- An exception is thrown at runtime
Which two statements are true about has-a and is-a relationships? (Choose two.)
- Inheritance represents an is-a relationship
- . Inheritance represents a has-a relationship
- Interfaces must be used when creating a has-a relationship
- Instance variables can be used when creating a has-a relationship
public static void test(String str) { if (str == null | str.length() == 0) { System.out.println("String is empty"); } else { System.out.println("String is not empty"); } } And the invocation: test(null); What is the result?
- An exception is thrown at runtime.
- "String is empty" is printed to output
- Compilation fails
- "String is not empty" is printed to output.
public class TestOne { public static void main (String[] args) throws Exception { Thread.sleep(3000); System.out.println("sleep"); } } What is the result?
- Compilation fails.
- An exception is thrown at runtime.
- The code executes normally and prints "sleep".
- The code executes normally, but nothing is print ed.
It is recommended to overload run() in your Thread class
- True
- False
1 String #name = "Jane Doe"; 2 int $age = 24; 3 Double _height = 123.5; 4 double ~temp = 37.5; Which two statements are true?
- . Line 1 will not compile
- . Line 2 will not compile
- . Line 3 will not compile
- . Line 4 will not compile
The primary key on table EMP is the EMPNO column. Which of the following statements will not use the associated index on EMPNO?
- select * from EMP where nvl(EMPNO, '00000') = '59384';
- select * from EMP where EMPNO = '59384';
- select EMPNO, LASTNAME from EMP where EMPNO = '59384';
- select 1 from EMP where EMPNO = '59834';
Assuming today is Monday, 10 July 2000, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual;
- 03-JUL-00
- 10-JUL-00
- 11-JUL-00
- 17-JUL-00
How many columns are presented after executing this query: SELECT address1||','||address2||','||address2 "Adress" FROM employee;
- 0
- 1
- 3
- 2
Which character function can be used to return a specified portion of a character string?
- INSTR
- SUBSTRING
- SUBSTR
- POS
Which character is used to continue a statement in SQL*Plus?
- *
- /
- -
- --
This Contains all of the classes for creating user interfaces and for painting graphics and images
- java.lang
- java.util
- java.awt
- java.graphics
What does API stand for?
- Assignment Programming Interface
- Application Programming Interface
- Active Program Interface
- None of the above
Which API provides classes that are fundamental to the design of the Java programming language?
- Java.lang
- Java.nio
- Java.rmi
- Java.basic
java.sql API is used for accessing and processing data stored in a data source (usually a relational database) using the Java programming language
- True
- False
Which of the following is not a Java API?
- java.nio
- java.text
- java.xml
- java.io
Which of the following APIs provides the classes and interfaces for the security framework?
- java.io
- java.rmi
- java.security
- None of the above
COBOL stands for:
- Combined Business-Oriented Language
- Combined Business-OnLine Language
- Common Business-Oriented Language
- Common Business online Language
These element according to COBOL programming standard need not to be vertically aligned:
- PICTURE clauses
- VALUE clauses
- 'TO' in the statements
- All COBOL verbs