SAS, Java, and Perl Programming Basics

Test your knowledge of basic concepts in SAS programming, including DATA steps, PROC procedures, and ODS commands, along with fundamental Java and Perl language features.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

$input =”12345”; $value1 = chop($input); $value2=chomp($input”); print $value1, $value2;

  1. 1234 and 1
  2. 12345 and 0
  3. 1234 and 0
  4. 5 and 0
  5. 1 and 0
Question 2 Multiple Choice (Single Answer)

How many times does the following loop iterates? %list = ("first", "1", "second", "2", "third", "3"); foreach $word (keys(%list)) { last if ($word == "second"); }

  1. four
  2. three
  3. two
  4. one
  5. Unpredictable
Question 3 True/False

By default all our code is placed in one package called main

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

Which of the following is not a legal scalar variable

  1. $Scalar
  2. $_Scalar
  3. $Scalar1
  4. $Sca_lar
Question 5 Multiple Choice (Single Answer)

print 12e-02;

  1. 0.12
  2. 12
  3. 120
  4. 0.012
Question 6 Multiple Choice (Multiple Answers)

SAS programs have basically 2 steps .They are

  1. Base SAS
  2. DATA
  3. Macro
  4. PROC
Question 7 True/False

A SAS program may contain a DATA step embedded within a PROC STEP and viceversa

  1. True
  2. False
Question 8 True/False

SAS Statements – Usually begins with a keyword, always ends with a colon and are free format

  1. True
  2. False
Question 9 True/False

Each time a step is executed, SAS software generates a log of the processing activities and the results of the processing.Separate sets of messages for each step in the program are produced.

  1. True
  2. False
Question 10 True/False

Each time a step is executed, SAS software generates a log of the processing activities and the results of the processing.Separate sets of messages for each step in the program are produced.

  1. True
  2. False
Question 11 True/False

Data Example2; Set Example1; Run; Proc Print Data = Example2; run; Here Proc step is executed first as Proc step always takes precedence in SAS .

  1. True
  2. False
Question 12 True/False

Data Example2; Set Example1; Run; Proc Print Data = Example2; run; Here Proc step is executed first as Proc step always takes precedence in SAS .

  1. True
  2. False
Question 13 True/False

In SAS log there are lines displayed with NOTE: ERROR: and WARNING:

  1. True
  2. False
Question 14 Multiple Choice (Multiple Answers)

In SAS log lines displayed with NOTE: contains

  1. Error messages
  2. Number of observations
  3. Usage of CPU in seconds
  4. Number of variables
Question 15 Multiple Choice (Multiple Answers)

The output created by the DATA step are

  1. Means Reports
  2. SAS Datasets
  3. Frequency Reports
  4. SAS Files
Question 16 Multiple Choice (Multiple Answers)

Some of the PROCs present in SAS are

  1. SUM
  2. MEANS
  3. FREQ
  4. DATASET
Question 17 True/False

In Java, all non-static methods are by default "virtual functions." Only methods marked with the keyword final are non-virtual.

  1. True
  2. False
Question 18 Multiple Choice (Single Answer)

Which is the correct statement: a.) ODS HTML FILE = ‘file’; b.) ODS FILE HTML = ‘file’ c.) ODS FILE = ‘file’ d.) ODS HTML = ‘file’

  1. c
  2. b
  3. a
  4. d
Question 19 Multiple Choice (Single Answer)

Which ODS command closes the HTML file

  1. ODS HTML; CLOSE;
  2. ODS HTML CLOSE;
  3. ODS; HTML CLOSE;
  4. ODS CLOSE HTML;
Question 20 Multiple Choice (Single Answer)

data temp; set lib1.x lib2.y; length jobcode $12.; run; What would be the length of Jobcode in temp?

  1. 5
  2. 12
  3. 8
  4. Syntax error