Programmer Questionnaire

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Hiring_test
H
Hiring_test
Community Contributor
Quizzes Created: 1 | Total Attempts: 537
Questions: 17 | Attempts: 537

SettingsSettingsSettings
Programmer Quizzes & Trivia

This is a simple competency test. By passing the test, you ensure your resume will be considered for the position. Please provide your email address in the name field so we know which resume is yours.


Questions and Answers
  • 1. 

    What is the default name of an ant project file?

    • A.

      Ant.xml

    • B.

      Projectfile.txt

    • C.

      Projectfile.xml

    • D.

      Build.xml

    Correct Answer
    D. Build.xml
    Explanation
    The default name of an ant project file is "build.xml". This file is used to define the build process and targets for an ant project. It contains the necessary instructions and configurations for building the project.

    Rate this question:

  • 2. 

    Which of the following commands would most likely be used to build a JAR?

    • A.

      Javac

    • B.

      Jar -cf

    • C.

      Java -jar

    • D.

      Jar -xf

    Correct Answer
    B. Jar -cf
    Explanation
    The command "jar -cf" is most likely used to build a JAR. The "jar" command is used to create, manipulate, and extract JAR files in Java. The "-cf" option is used to create a new JAR file with the specified name and include the specified files and directories in it.

    Rate this question:

  • 3. 

    If you have a JAR file and want to know the API, what is the standard way to get that information?

    • A.

      Find the source code online

    • B.

      Use a debugger

    • C.

      Use javap to decompile the JAR

    • D.

      Read the javadoc

    Correct Answer
    D. Read the javadoc
    Explanation
    The correct answer is to read the javadoc. Javadoc is a tool provided by Java that generates documentation from source code comments. It provides detailed information about the classes, methods, and variables in the API, allowing developers to understand how to use the JAR file's functionality. Reading the javadoc is the standard and recommended way to get information about an API from a JAR file.

    Rate this question:

  • 4. 

    In addition to logging in as root to the mysql server, what does the command "mysql -u root -p mail" do?

    • A.

      Selects the mail database.

    • B.

      Uses the password "mail" to log in.

    • C.

      Lists the tables in the database.

    • D.

      Connects without requiring a password.

    Correct Answer
    A. Selects the mail database.
    Explanation
    The command "mysql -u root -p mail" selects the mail database. The "-u root" flag specifies that the user is root, and the "-p" flag prompts for the password, which in this case is "mail". Therefore, the command logs in as root and selects the mail database.

    Rate this question:

  • 5. 

    Why would this be a bad way to create a backup? mysqldump -u user -p marketing -t person

    • A.

      The -t flag affects the tabs being output by mysqldump.

    • B.

      The create statements are omitted.

    • C.

      The -u flag will affect the permissions on the table being dumped.

    • D.

      The dump won't be readable without the original password.

    Correct Answer
    B. The create statements are omitted.
    Explanation
    The given command "mysqldump -u user -p marketing -t person" is a bad way to create a backup because the create statements are omitted. The create statements are important as they define the structure of the database and without them, the backup will not be able to recreate the tables and their relationships accurately. This means that if the backup needs to be restored, it may not work properly without the create statements.

    Rate this question:

  • 6. 

    Which command lists all processes running on a Fedora machine?

    • A.

      Tasklist

    • B.

      Top

    • C.

      Ps -ef

    • D.

      Jobs

    Correct Answer
    C. Ps -ef
    Explanation
    The correct answer is "ps -ef". This command is used to list all processes running on a Fedora machine. The "ps" command stands for "process status" and the "-ef" option displays information about all processes in a full format, including the process ID, parent process ID, user, CPU usage, and more. This command is commonly used in Unix-like operating systems to view and manage running processes.

    Rate this question:

  • 7. 

    Why should you never use "rm -fr /"?

    • A.

      The -r deletes subdirectories, which you never want to do.

    • B.

      The -f should never be used, even when deleting a lot of files.

    • C.

      The / will result in everything being deleted.

    • D.

      Nothing, this command is safe on any machine.

    Correct Answer
    C. The / will result in everything being deleted.
    Explanation
    Using the command "rm -fr /" will result in everything being deleted because the forward slash (/) represents the root directory in the file system. When this command is executed, it recursively deletes all files and directories starting from the root directory. This can cause severe damage to the system, as it deletes essential system files and directories, rendering the machine inoperable. Therefore, it is crucial to never use this command, as it can lead to irreversible data loss and system malfunction.

    Rate this question:

  • 8. 

    What are the SWT libraries used for?

    • A.

      Desktop User interface

    • B.

      Web application interface

    • C.

      Network Interface

    • D.

      Eclipse Parser

    Correct Answer
    A. Desktop User interface
    Explanation
    The SWT libraries are used for creating desktop user interfaces. They provide a set of tools and components that allow developers to create graphical user interfaces for desktop applications. SWT stands for Standard Widget Toolkit and it is a Java-based framework that provides a native look and feel for different operating systems. It allows developers to create windows, buttons, menus, and other UI elements that are consistent with the platform on which the application is running. This makes it easier for users to interact with the application and provides a seamless user experience.

    Rate this question:

  • 9. 

    Spring would most likely be run under:

    • A.

      Tomcat

    • B.

      Hibernate

    • C.

      James

    • D.

      Swt

    Correct Answer
    A. Tomcat
    Explanation
    Spring is a popular Java framework used for building enterprise-level applications. It provides various features such as dependency injection, aspect-oriented programming, and MVC architecture. Tomcat, on the other hand, is a web server and servlet container that is commonly used to deploy and run Java web applications. Since Spring is primarily used for web development, it is most likely to be run under Tomcat as it provides the necessary environment to host and execute Spring-based applications. Hibernate, James, and SWT are not directly related to running Spring applications, hence they are less likely to be the correct answer.

    Rate this question:

  • 10. 

    What is wrong with this snippet?public int indexOfName(String name, List names) {  for(String aName : names) {    if (aName.equals(name)) {      return i;    } else {      i++;    }  }    return -1;}

    • A.

      The List interface cannot be used in the for-each construct.

    • B.

      The if should check if aName == name

    • C.

      AName cannot be declared in the for contstruct.

    • D.

      The variable "i" can't be used this way.

    Correct Answer
    D. The variable "i" can't be used this way.
    Explanation
    The variable "i" can't be used this way because it is not declared or initialized before being used in the for-each loop. This will result in a compilation error.

    Rate this question:

  • 11. 

    If the snippet were rewritten as below, what would it return given a list (alice, bob, charlie, dave) and input "zebra"? (assume the foreach is in alphabetic order)public int indexOfName(String name, List names) {  int i = 0;  for(String aName : names) {    if (aName.equals(name)) {      return i;    } else {      i++;    }  }    return i;}

    • A.

      4

    • B.

      -1

    • C.

      5

    • D.

      26

    Correct Answer
    A. 4
    Explanation
    The given code snippet is a method that searches for a specific name in a list of names and returns the index of that name. It initializes a variable "i" as 0 and iterates through each name in the list using a foreach loop. If the current name is equal to the input name, it returns the value of "i" which represents the index of that name. If the current name is not equal to the input name, it increments the value of "i" by 1. If the loop completes without finding a match, it returns the value of "i" which represents the index of the last name in the list plus 1. In this case, since the input name "zebra" is not present in the list, the method will return 4.

    Rate this question:

  • 12. 

    Lastly for this snippet, what would it return given a list (alice, bob, charlie, dave) and input "bob"? (assume the foreach is in alphabetic order)public int indexOfName(String name, List names) {  int i = 0;  for(String aName : names) {    if (aName.equals(name)) {      return i;    } else {      i++;    }  }    return i;}

    • A.

      2

    • B.

      0

    • C.

      1

    • D.

      -1

    Correct Answer
    C. 1
    Explanation
    The given code is a method that takes a String name and a List of names as input. It iterates over the list using a foreach loop and checks if each name in the list is equal to the given name. If a match is found, it returns the index i. In the given example, the name "bob" is present at index 1 in the list (alice, bob, charlie, dave), so the method would return 1.

    Rate this question:

  • 13. 

    What is the file catalina.out used for?

    • A.

      Apache logs

    • B.

      Tomcat logs

    • C.

      James logs

    • D.

      Java logs

    • E.

      MySQL logs

    Correct Answer
    B. Tomcat logs
    Explanation
    The file catalina.out is used for Tomcat logs. Tomcat is an open-source web server and servlet container that is used to serve Java applications. The catalina.out file contains logs related to the activities and events that occur within the Tomcat server. These logs can be used for troubleshooting, monitoring, and analyzing the performance of the Tomcat server.

    Rate this question:

  • 14. 

    The easiest way to determine the length of an array (people) in java is:

    • A.

      Array_count($people)

    • B.

      People.length

    • C.

      Using a for loop

    • D.

      Arrays.sizeof(people)

    • E.

      People.length()

    Correct Answer
    B. People.length
    Explanation
    The correct answer is "people.length". In Java, the length of an array can be determined by using the "length" property of the array object. This property returns the number of elements in the array, allowing us to easily determine its length.

    Rate this question:

  • 15. 

    What command is used to compile a java class?

    • A.

      Javac HelloWorld.java

    • B.

      Java --compile HelloWorld.java

    • C.

      Javap HelloWorld.java

    • D.

      Javah HelloWorld.java

    Correct Answer
    A. Javac HelloWorld.java
    Explanation
    The correct answer is "javac HelloWorld.java". This command is used to compile a Java class. The "javac" command stands for Java Compiler and it is used to compile Java source code files into bytecode files that can be executed by the Java Virtual Machine (JVM). In this case, the command is specifically compiling the "HelloWorld.java" class.

    Rate this question:

  • 16. 

    Which command would you use to execute commands on a remote unix server?

    Correct Answer
    A. Ssh [email protected]
    Explanation
    The correct answer is "ssh [email protected]". SSH (Secure Shell) is a network protocol that allows secure remote access to a Unix server. It provides a secure encrypted connection for executing commands and managing files on a remote server. The "ssh" command followed by the username and domain allows the user to establish a secure connection to the remote Unix server.

    Rate this question:

  • 17. 

    Finally, are you still interested in the job?

    • A.

      Yes

    • B.

      No

    Correct Answer
    A. Yes
    Explanation
    The explanation for the given correct answer is that the person is still interested in the job.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 01, 2010
    Quiz Created by
    Hiring_test
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.