Interview Questions

Q:

Explain how to store the uploaded file to the final location.

Answer

A HTML form should be build before uploading the file. The following HTML code is used for selecting the file that is to be uploaded. The type attribute of input must be “file”.


<form enctype="multipart/form-data" action="uploader.php" method="POST">


<input type="hidden" name="MAX_FILE_SIZE" value="100000" />


Choose a file to upload: <input name="uploadedfile" type="file" /><br />


<input type="submit" value="Upload File" />


</form>


At the time of executing uploader.php, the uploaded file will be stored in a temporary storage are on the webserver. An associative array $_FILES['uploadedfile']['name'] is used for uploading. The ‘name’ is the original file that is to be uploaded. Another associative array $_FILES['uploadedfile']['tmp_name'] is used for placing the uploaded file in a temporary location on the server and the file should be empty and should exist with the tmp_name.


The following code snippet is used for uploading the file.


$target_path = "uploads/"; // the target location of the file


$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);


if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) 


{


       echo "The file ". basename( $_FILES['uploadedfile']['name']). 


        " has been uploaded";


}


else


{


      echo “There was an error while uploading the file”;


}


The function move_uploaded_file()is used to place the source file into the destination folder, which resides on the server.


If the uploading is successful, the message “The file filename has been uploaded. Otherwise the error message “There was an error while uploading the file” would be displayed.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2583
Q:

What Are Your Goals?

Answer

Sometimes it's best to talk about short-term and intermediate goals rather than locking yourself into the distant future. For example, "My immediate goal is to get a job in a growth-oriented company. My long-term goal will depend on where the company goes. I hope to eventually grow into a position of responsibility."

Report Error

View answer Workspace Report Error Discuss

8 2579
Q:

Compounding interest means interest accrues

A) at variable rates throughout the term B) more quickly than simple interest
C) more slowly than simple interest D) at the same rate as simple interest
 
Answer & Explanation Answer: B) more quickly than simple interest

Explanation:

Compounding interest means interest accrues on the interest charged and the principal amount each period the interest is charged.

Compound interest is calculated by multiplying the principal amount by one plus the annual interest rate raised to the number of compound periods minus one.The total initial amount of the loan is then subtracted from the resulting value.

The formula for calculating compound interest is:

[P (1 + i)n] – P

= P [(1 + i)n – 1]

(Where P = Principal, i = nominal annual interest rate in percentage terms, and n = number of compounding periods.)


Take a three-year loan of Rs. 10,000 at an interest rate of 5% that compounds annually. What would be the amount of interest? In this case, it would be:

Rs. 10,000 [(1 + 0.05)3] – 1

= 10,000 [1.157625 – 1]

= Rs. 1,576.25.

 

How it grows ::

 

compound_interest1532497613.jpg image

 

Report Error

View Answer Report Error Discuss

Filed Under: Bank Interview
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2575
Q:

What are the basic interfaces of Java Collections Framework ?

Answer

Java Collections Framework provides a well designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are:


Collection, which represents a group of objects known as its elements.


Set, which is a collection that cannot contain duplicate elements.


List, which is an ordered collection and can contain duplicate elements.


Map, which is an object that maps keys to values and cannot contain duplicate keys.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

1 2570
Q:

Distinguish between speculator and hedger?

Answer

The main difference lies in the motive of the two parties. The main motive of the hedger is to hedge(minimize) the risk from the occurence of some events. 


The motive of the speculator is to gamble in the market in order to make the profit by buying/selling the derivative products.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Finance

2 2569
Q:

What is MultiThreading?

Answer

Executing two or more blocks (threads) of a program at a time is called MultiThreading.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2568
Q:

When is the onStop() method invoked?

Answer

A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

Report Error

View answer Workspace Report Error Discuss

0 2564
Q:

How can we encrypt the username and password using PHP?

Answer

User names and passwords in PHP can be encrypted using md5 function.


MD5 function calculates the md5 hash of a string. It is basically used for encryption. It is also used for digital signature applications, where a large file must be "compressed" in a secure manner.


Example:


Md5($str);


 


Crypt() function can also be used to encrypt a string,. It used MD5, DES or blow fish algorithms for encryption.


Syntax:


Crypt(str, salt)


Salt is an optional parameter used to increase the number of characters encoded, to make the encoding more secure

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2564