Tuesday, October 30, 2007

coldfusion interview questions and answers

1. Which path is used in the template attribute in the tag?

A. physical path
B. calling template relative path
C. web document root relative path
D. any directory under Cfusion\CustomTags

The correct answer is B.

2. Which of the following would be the last one to capture an exception?

A.
B.
C.
D. site-wide error handler specified in the ColdFusion Administrator

The correct answer is D.

3. Of these tags with errors, which could NOT be caught with a block?

A.
B.
C.
D. where file.cfm is NOT found

The correct answer is B.

4. If you have the following variable definition in the Application.cfm file, what is the scope of the variable after it is created?



A. Variables (local)
B. Application
C. Session
D. Request

The correct answer is A.

5. What is the purpose of the GetAuthUser() function?

A. To log in a specified user
B. To return the name of a logged in user who is requesting the page on which the function is used
C. To retrieve user details from a specified data source
D. To assign roles to the user who is requesting the page on which the function is used

The correct answer is B.

6. Which of the following variable types requires the use of the scope when referencing the variable? (Choose two)

A. request
B. form
C. local
D. application
E. URL

The correct answer is A and D.

7. Which function is necessary when using CACHEDWITHIN attribute with the tag?

A. CreateDateTime()
B. ParseDateTime()
C. CreateTimeSpan()

The correct answer is C.

8. What is missing from the following tag’s SELECT statement if you want to return the count?


SELECT Count(*)
FROM TestTable


A. SELECT Count(CountVar)
B. SELECT Count(*) AS CountVar
C. SELECT Count(*) INTO CountVar
D. SELECT Count(*)

The correct answer is B.

9. Which of the following ANSI standard WHERE clauses will return all rows where City begins with the letter ‘S’?

A. WHERE City LIKE “S”
B. WHERE City = ‘S*’
C. WHERE City LIKE ‘S_’
D. WHERE City LIKE ‘S%’

The correct answer is D.

10. Which one of the following tags is used for server-side validation? (Choose one.)

A. input type =”text”
B. input type=”hidden”
C. input value=”hidden”
D. input value=”text”

The correct answer is B.

11. When will the cookie created by the following tag expire?



A. never
B. after one day
C. when the last browser window is closed
D. after the timeout period for session variables has elapsed

The correct answer is C.
ColdFusion Interview Questions - Part I
15

04

2007
How would you loop through a SQL result set stored in the CF variable named my “results” and output the result set columns named “cola” and “colb” in an html table?








#cola##colb#


Given the url http://localhost/test.cfm?printmesg=yes How would you write an if statement which would echo the message “hello world!” if the url parameter printmesg equals “yes”.


hellol world!


When is it appropriate to use versus ?

allows you to set a default parameter if that variable does not have a value bound to it.
merely sets the value of a given variable.

Given the datasource named “mydb” and a SQL stored procedure named “mystoredproc” which takes the following two parameters one VARCHAR param and one INTEGER parameter respectively, how would you declare this using the cold fusion tags , , and ?





value=”#param1#”>
value=”#param1#”>



How do you call a module named “testmod.cfm” with the parameters param1=”yes” and param2=5?

param1=”yes”
param2=5>

When is it appropriate to use versus ?

Given two tables:

movie
——————
| id |
|—————-|
| title |
| rating |
| length |
| country |
——————

actor
——————
| id |
|—————-|
| movie_id |
| name |
——————

How would you write a SQL statement to find the names of all the actors associated with a movie titled “fight club”?

SELECT actor.name
FROM movie INNER JOIN actor ON movie.id = actor.movie_id
WHERE movie.title = ‘Fight Club’

movie
——————
| id |
|—————-|
| title |
| rating |
| length |
| country |
——————

director
——————
| id |
|—————-|
| movie_id |
| name |
——————

How would you write a LEFT JOIN statement to return a result set of movie.title’s and director.name’s?

SELECT
movie.title,
director.name
FROM movie LEFT JOIN director ON movie.id = director.movie_id

If there are no indices defined on any of the columns in the above two tables, which columns would you index to speed up the LEFT JOIN query?

movie_id

How would you write a simple stored procedure in TSQL which takes a movie_id and returns all the directors associated with it?

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE procedure [dbo].getDirector (
@movie_id INT
)

SELECT name FROM directors WHERE movie_id = @movie_id

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

What are the advantages and disadvantages of using stored procedures versus calling SQL inline in Cold Fusion?

Stored procedures abstract database logic from server side code. They also offer performance benefits in pushing application logic to the database side.

The disadvantage is that if they are poorly written then they can hinder database performance and make development a little more obfuscated.

How would you format some text using css to be verdana and bold?

.myfontclass {
font-family: Verdana;
font-weight: bold;
}

What is the difference between absolute and relative div positioning?

Absolute is from the absolute 0,0 position in the top left corner of the browser window. Relative is relative from the positioning of where the div is declared within the html body.

How would you declare an inline css to format the table with a background color of “yellow” and give the table cell a right margin of 10 pixels?







Hello world

No comments: