Intermediate Java Test 1
Intermediate Java Mastery Quiz
Test your knowledge on intermediate Java programming concepts with this engaging quiz. Perfect for students and educators alike, it covers various topics including arrays, ArrayLists, and formatted output.
Key Features:
- 23 questions with multiple choice answers
- Focus on practical Java programming skills
- Improve your coding and problem-solving abilities
1. Declare a 2x5 dim array named arrayOne of String data type
A) int arrayOne[][] = new int[row][col];
B) int arrayOne[][] = new int[col][row];
C) String arrayOne[][] = new int[ 2 ] [ 5 ];
D) String arrayOne[][] = new String[ 2 ] [ 5 ];
E) String arrayOne[][] = new String [ 5 ][ 2 ];
2) How many indexes/locations does the 2 dimensions arrayOne, with 2 rows and 5 columns, has
A) 25
B) 7
C) 4
D) 10
E) 15
3) Add two rows to a dimension array named arrayOne that has 2 rows and 5 columns.
A) arrayOne.add(2, 0);
B) arrayOne.add[2, 0];
C) arrayOne.add<2><0>;
D) arrayOne.add[2][0];
E) arrays can not be expanded by themselves
4) Using System.out.printf display Good Morning friend
A) System.out.printf("Good Morning %s \n", "friend");
B) System.out.printf("Good Morning %c \n", "friend");
C) System.out.printf("Good Morning %w \n", "friend");
D) System.out.printf("Good Morning %d \n", "friend");
E) System.out.printf("Good Morning '%s' \n", "friend");
6) Using terminal mode, move to your pgm1 folder
A) move pgm1 folder
B) cd pgm1
C) move pgm1
D) mv pgm1
E) cdir pgm1
7) What is the main difference we spoke about, between an Array and an ArrayList
A) An Array can be expanded while an ArrayList can not
B) An ArrayList can accept data of type Object while an Array can not
C) An ArrayList can be expanded while an Array does not have its own commands to be expanded
D) An Array can accept more data than an ArrayList
E) An ArrayList can accept mode data than an Array
8) Declare an ArrayList of Object data type named listOne
A) ArrayList(Object) listOne = new ArrayList(Object)();
B) ArrayList(Object) listOne = new ArrayList(Object listOne);
C) ArrayList < Object > listOne = new ArrayList < Object >;
D) ArrayList < Object > listOne = new ArrayList < Object >();
E) ArrayList < Object > = new ArrayList < Object > (listOne);
9) Load listOne ArrayList with the following data 123, hello, ab3, 10A
A) listOne.add( ArrayList[123, hello, ab3, 10a] );
B) listOne.add(123); listOne.add(hello); listOne.add(ab3), listOne.add(10A);
C) listOne.add < ArrayList[123, hello, ab3, 10a] >;
D) listOne.add < 123 >; listOne.add < hello >; listOne.add < ab3 >; listOne.add < 10A >;
E) listOne.add( ArrayList<123, hello, ab3, 10a> );
10) In the following sequence of events, create a directory named pgm4, go into folder pgm4, display all files and directories
A) cd pgm4, dir, mkdir pgm4
B) cd linux, mkdir pgm4, ls
C) mkdir pgm4, cd pgm4, cat
D) mkdir pgm4, cd pgm4, dir
E) mkdir pgm4, dir pgm4, ls
12) Using terminal mode create a folder named pgm1
A) mv pgm1
B) cdir pgm1
C) mkdir pgm1
D) make pgm1
E) create pgm1
13) Using terminal mode, move to your pgm1 folder
A) move pgm1 folder
B) cdir pgm1
C) cd pgm1
D) move pgm1
E) mv pgm1
14) Delete the first and the last record from an ArrayList named listOne containing the following data items: abcd, 123, ac7, 78bg, 9983bc
A) listOne.remove(1); listOne.remove(5)
B) ArrayList.remove(1); ArrayList.remove(5);
C) listOne.delete(4); listOne.delete(0);
D) ArrayList.erase(1); ArrayList.erase(5);
E) listOne.remove(4); listOne.remove(0);
15) Using System.out.printf display this is a number with 2 decimals 3804.01
A) System.out.printf( "this is a number with 2 decimals %17.2f \n", 3804.01);
B) System.out.printf( "this is a number with 2 decimals %-.2c \n", 3804.01);
C) System.out.printf( "this is a number with 2 decimals %17.2d \n", 3804.01);
D) System.out.printf( "this is a number with 2 decimals %17.2i \n", 3804.01
E) System.out.printf( "this is a number with 2 decimals %17.2w \n", 3804.01);
16) Why is terminal mode important in IT
A) It allows us to have full control of our computers
B) It is used primary in cell phones
C) Can be used without needing a password
D) Easier to use than graphical access
E) Does not need random access memory
17) As taught in this class, what new benefit the System.out.printf command provide us
A) Do not need to use the prints commands
B) Allows to easily align reports in columns
C) Do not need to use the cat command to do the same
D) The system.out.println is better to use
E) We can use it to convert hex numbers to decimal numbers
18) Using System.out.printf display this is an int with no decimal 3804
A) System.out.prinf( "this is an int with no decimal %d \n", 3804);
B) System.out.prinf( "this is an int with no decimal %i \n", 3804);
C) System.out.prinf( "this is an int with no decimal %f \n", 3804);
D) System.out.prinf( "this is an int with no decimal %i \n", 3804.01);
E) System.out.prinf( "this is an int with no decimal %s \n", 3804);
19) Why did we install JDK in your computer
A) Because the operating system can not work without it
B) The operating system needs it to access its RAM chips
C) Because we needed to use the wget command to download the RAM hex chips
D) To be able to use the java_version and javac_version commands
E) Needed to create our program 2 assignment
20) What do "java -version" and "javac -version" must have in common?
A) They must have come from Canvas
B) They must have to come from the Ocelot server
C) Both of them must be installed in Ocelot to run your program 2
D) They have to be the same version
E) Both have to be downloaded from virtual PC
21) Using System.out.printf display the number 3767.01 so that the integer part displays using 12 spaces and the decimal part displays using 4 spaces
A) System.out.printf("%s16.4", 3767.01);
B) System.out.printf("%17.4f", 3767.01);
C) System.out.printf("%12.4f", 3767.01);
D) System.out.printf("%12.4d", 3767.01);
E) System.out.printf("%16.4s", 3767.01);
22) Add two columns to a 2 dimensions array named arrayOne that has 2 rows and 5 columns
A) arrayOne.add(0,2);
B) arrayOne.add[0,2];
C) arrayOne.add<0><2>;
D) arrayOne.add[0][2];
E) arrays can not be expanded by themselves
23) What is the main benefit of using an Enhanced for loops
A) It allow us to align our data in perfect columns
B) Allows processing data forwards
C) Allows processing data of object data type
D) Processes a complete collection of elements including arrays
E) Allows processing data forward and backwards
24) Parallel Arrays are used to
A) A report of arrays of object data type only
B) Process multiple arrays of the same type
C) Process multiple arrays at the same time
D) Data structure of arrays with the same length
E) A report of arrays of the same data type
25) String tokenizers are used to
A) Print data structures of arrays with the same length
B) Processes a complete collection of elements including arrays
C) Allows processing data of object data type
D) Prints data structure of arrays with the same length
E) Allows us to process string records into tokens
{"name":"Intermediate Java Test 1", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge on intermediate Java programming concepts with this engaging quiz. Perfect for students and educators alike, it covers various topics including arrays, ArrayLists, and formatted output.Key Features:23 questions with multiple choice answersFocus on practical Java programming skillsImprove your coding and problem-solving abilities","img":"https:/images/course5.png"}