Informix Prog Test
Posted in 1995
A few years back someone posted an Informix Programmer's Test on
this newsgroup. I was never able to find it so a few months
back one of my customers asked me to come up with one. I
thought I would post it for all. If you really want the
answers send me mail. I figure a "GOOD" informix programmer
should be able to get 20 correct in under 20 minutes.
Let me know if you have any good questions to add. I
want to keep the test strictly to SQL and 4GL type questions.
If you have anything to add, please e-mail the question
(and I will hopefully know the answer). If you want the
answers as I said above I will be happy to e-mail them to
you. Please be patient with my reply as I will be at
the World-Wide Conf all next week, but I will hopefully
be able to reply the week after.
Stuart
slitel@netcom.com
P.S. - if you use this test - please leave my name on at the end
as a courtesy!
------------------ The test begins -------------------
INFORMIX 4GL Programming Test
1) Explain what the Informix "Construct" statement does?
2) What is the difference between the "Input by name" and
"input prog_rec from screen_rec"?
3) In 4GL reports what does "order external" do?
4) What will happen in the following code sample - find at least
two mistakes...
define p_array[100] of smallint
define x smallint
#NOTE assume the next two lines are correct and xyz is
# a smallint field
declare abc_curs cursor for
select xyz from abc
foreach abc_curs into p_array[x]
end foreach
5) Explain briefly what the following Informix built-in
functions do:
1) errorlog(char-expr)
2) infield(field-name)
3) scr_line()
4) arg_val(integer_expr)
6) Explain what wil be displayed on the the lines below in bold
database abc
globals
define x smallint
end globals
main
define x smallint
display x
let x = 2
display x
call funct1()
display x
call funct2()
display x
call funct3() returning x
display x
end main
function funct1()
define x smallint
let x = 3
end function
function funct2()
let x = 4
end function
funciton funct3()
let x = 5
return x
end function
7) How do you "force the cursor" in the input array statement to
go down on line or bounce to the next row?
8) What is int_flag? How and when is it set?
9) What is the prepare statement used for?
10) What is the difference in the following code
# SAMPLE #1
define x smallint
declare abc_curs cursor for
select field from table
open abc_curs
while true
fetch abc_curs into x
if (status = 100) then
exit while
end if
display x
end while
# SAMPLE #2
define x smallint
declare abc_curs cursor for
select field from table
foreach abc_curs into x
display x
end foreach
11) When using ring menus explain how to make a different key
other than the first key the "choice" key?
12) When using ring menus explain how to Hide Options to cettain
certain users?
13) What is the difference between the "format" and "picture"
attribute in a .per screen file?
For the next few questions(#14 - # 19) - use the following two
tables
Person Table State table
first_name char(20) state char(2)
last_name char(20) description char(20)
address char(30)
Job_title char(30)
city char(30)
state char(2)
zip char(5)
age smallint
14) Write an SQL query that will find all the people in the
person table that do not live in a state that begins with the
letter "M"
15) Write an SQL query that will give a list of all the first
and last names of the people in the person table and the long
description that "joins" them from the state table.
16) Write an SQL query that will give a list of all the first
and last names of the peopl in the person table and the long
description that "goes" with them and if the description is not
in the State table we will still get the person's first and last
name.
17) Write a single query that will give a list of the average
age of all the people in the Person table broken down by state
and in order of the youngest to oldest age.
18) Write a query that will find all people who have a job title
with a quote (") in the title (i.e. the data actually has
"GURU")?
19) Write a single query that will give you a list of people in
the Person table that live in states where the state is NOT IN
the State table.
20) What is the difference in "Select Distinct" and "Select
Unique" sql statement?
21) What is the difference on the following two statemnts:
a) Lock table abc in exclusive mode
b) Lock table abc in share mode
22) Write a simple .4gl program that displays the time of day in
HH:MM format
(i.e. 09:00)?
23) What happens in the following code - what will be displayed
by the last line?
define x smallint
let x = 2
case
when x = 2
let x = 4
when x = 4
let x = 5
when x = 6
let x = 8
otherwise
let x = 10
end case
display x
24) Explain how to change the "Accept" key in Informix to "F10"
(the Accept key by default is the Esc or Escape key)?
25) What is the "Options input wrap" do in 4gl?
Test created by: Stuart Litel, P.O. Box 40, Newtonville, MA 02160
(617)527 - 4551, FAX: (617)964-4262. E-Mail: slitel@netcom.com
-----------------END OF TEST ----------------------------