Programmer Questionnaire

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Hiring_test
H
Hiring_test
Community Contributor
Quizzes Created: 1 | Total Attempts: 538
| Attempts: 538 | Questions: 17
Please wait...
Question 1 / 17
0 %
0/100
Score 0/100
1. Finally, are you still interested in the job?

Explanation

The explanation for the given correct answer is that the person is still interested in the job.

Submit
Please wait...
About This Quiz
Programming 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... see morefield so we know which resume is yours. see less

2. What command is used to compile a java class?

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.

Submit
3. 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;
}

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.

Submit
4. 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;
}

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.

Submit
5. 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;
}

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.

Submit
6. What is the default name of an ant project file?

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.

Submit
7. Which command lists all processes running on a Fedora machine?

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.

Submit
8. Why should you never use "rm -fr /"?

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.

Submit
9. What is the file catalina.out used for?

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.

Submit
10. Spring would most likely be run under:

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.

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

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.

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

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.

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

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.

Submit
14. What are the SWT libraries used for?

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.

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

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.

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

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.

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

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.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

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
Cancel
  • All
    All (17)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Finally, are you still interested in the job?
What command is used to compile a java class?
If the snippet were rewritten as below, what would it return given a...
What is wrong with this snippet?public int indexOfName(String name,...
Lastly for this snippet, what would it return given a list (alice,...
What is the default name of an ant project file?
Which command lists all processes running on a Fedora machine?
Why should you never use "rm -fr /"?
What is the file catalina.out used for?
Spring would most likely be run under:
Which command would you use to execute commands on a remote unix...
If you have a JAR file and want to know the API, what is the standard...
Which of the following commands would most likely be used to build a...
What are the SWT libraries used for?
The easiest way to determine the length of an array (people) in java...
In addition to logging in as root to the mysql server, what does the...
Why would this be a bad way to create a backup? mysqldump -u user -p...
Alert!

Advertisement