Java Programming and IT Security Basics
Quiz covering fundamental Java programming concepts including arrays, operators, OOP principles, and common IT security abbreviations
Questions
What is the output of the following program? class example { public static void main(String args[]) { int j; do { j++; } while(j < 0); System.out.println(j); } }
- The program does not compile as j is not initialized
- The program compiles but does not run
- The program compiles and runs but does not print anything
- prints some value
If MyProg.java were compiled as an application and then run from the command line as: java MyProg I like testswhat would be the value of args[ 1 ] inside the main( ) method?
- MyProg
- "I"
- "like"
- 3
After the declaration: char[] c = new char[100]; what is the value of c[50]?
- 50
- ‘\u0000'
- cannot be determined
- always null until a value is
If you compile and execute an application with the following code in its main() method: String s = new String( "Computer" ); if( s == "Computer" ) System.out.println( "Equal A" ); if( s.equals( "Computer" ) ) System.out.println( "Equal B" );
- It will not compile because the
- "Equal A" is the only thing that is printed
- "Equal B" is the only thing that is printed
- Both "Equal A" and
Consider the two statements: 1. boolean passingScore = false && grade == 70; 2. boolean passingScore = false & grade == 70;The expression grade == 70 is evaluated:
- in both 1 and 2
- in neither 1 nor 2
- in 1 but not 2
- invalid because false should be FALSE
Consider this class example: class MyPoint { void myMethod() { int x, y; x = 5; y = 3; System.out.print( " ( " + x + ", " + y + " ) " ); switchCoords( x, y ); System.out.print( " ( " + x + ", " + y + " ) " ); } void switchCoords( int x, int y ) { int temp; temp = x; x = y; y = temp; System.out.print( " ( " + x + ", " + y + " ) " ); }}What is printed to standard output if myMethod() is executed?
- (5, 3) (5, 3) (5, 3)
- (5, 3) (3, 5) (5, 3)
- (5, 3) (3, 5) (3, 5)
- (3, 3) (3, 5) (3, 5)
To declare an array of 31 floating point numbers representing snowfall for each day of March in Gnome, Alaska, which declarations would be valid?
- double snow[] = new double[31];
- doublesnow[31] = new array[31];
- doublesnow[31] = new array;
- double[]snow = new double[31];
If arr[] contains only positive integer values, what does this function do? public int guessWhat( int arr[] ){ int x= 0; for( int i = 0; i < arr.length; i++ ) x = x < arr[i] ? arr[i] : x; return x;}
- Returns the index of the highest
- Returns true/false if there are any elements that repeat in the array
- Returns how many even numbers are in the array
- Returns the highest element in the array
Consider the code below: arr[0] = new int[4]; arr[1] = new int[3]; arr[2] = new int[2]; arr[3] = new int[1]; for( int n = 0; n < 4; n++ ) System.out.println( /* what goes here? */ );
- arr[n].length();
- arr.size;
- arr.size-1;
- arr[n].length;
Method Overloading blocks the Inheritance from the Super Class
- True
- False
- cant be said
- none of the above
Interfaces can be used to implement the Inheritance relationship between the non-related classes that do not belongs to the same hierarchy, i.e. any Class and any where in hierarchy.An interface can not be
- native
- synchronize
- protected or private.
- All of the above
Which amongst the following is not a valid statements type
- Create statement
- Prepared Statement
- Callable Statement
- Synchronized statement
what Stands for DSCI?
- Data Security Council of Ireland
- Data Security Council of India
- Databank Security Council of Ireland
- Device Security Communication & Integration
What Stands for HTTPS?
- Hypertext Transfer Protocol Secure
- Hypertext Transfer Protocol Security
- Hypertext Transfer Protocol Safe
- Not an abbreviation
what stands for SSL?
- Secured Structured Layer
- Security Sockets Layer
- Secure Sockets Layer
- Safety Security Layer
whats stands for CERT?
- Communication Emergency Rescure Team
- Communication Enterprise Rescure Team
- Computer Emergency Response Team
- None of the Above
What stands for GRC?
- Global Rescue Council
- Governance, Risk & Compliance
- Geo-Political River Council
- Governance, Response & Communication