Mixed Programming Languages Quiz: SAS, ABAP, and Java

A quiz covering concepts from multiple programming languages including SAS PROC SQL queries, ABAP Dictionary and events, Java collections and syntax, and general programming language theory.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

class C { public static void main (String[] a1) { System.out.print(a1[1] + a1[2] + a1[3]); }} What is the result of attempting to compile and run the program? java command A B C

  1. Prints: ABC
  2. Prints BC and Runtime Exception
  3. Prints: BCD
  4. Runtime Exception
  5. None of the above
Question 2 Multiple Choice (Single Answer)

class C{ static int s; public static void main(String a[]){ C obj=new C(); obj.m1(); System.out.println(s); } void m1(); { int x=1; m2(x); System.out.println(x+""); } void m2(int x){ x=x*2; s=x; }}

  1. prints 1,2
  2. prints 2,0
  3. prints 2,2
  4. compile time error
  5. Noneofthe above
Question 3 Multiple Choice (Single Answer)

class C { public static void main(String[] args) { int i1=1; switch(i1){ case 1: System.out.println("one"); case 2: System.out.println("two"); case 3: System.out.println("three"); }}} What is the result of attempting to compile and run the program?

  1. prints one two three
  2. prints one
  3. compile time error
  4. Runtime exception
  5. None of the above
Question 4 Multiple Choice (Single Answer)

Each element must be unique Duplicate elements must not replace old elements. Elements are not key/value pairs. Accessing an element can be almost as fast as performing a similar operation on an array. Which of these classes provide the specified features?

  1. LinkedList
  2. TreeMap
  3. HashMap
  4. HashSet
Question 5 Multiple Choice (Single Answer)

What is necessary for a programming language?

  1. For loop
  2. While loop
  3. Recursion
  4. All of these
Question 6 Multiple Choice (Single Answer)

Identify the true statement.

  1. For efficient program writing, we need syntax which is not strict
  2. For efficient program writing, we need syntax which is strict
  3. For quick compiler design, syntax is strict
  4. Syntax strictness and compiler design are not related
Question 7 Multiple Choice (Single Answer)

Programming is the job of ____

  1. Developer
  2. Maintenance Person
  3. Both developer and maintenance person
  4. Tester
Question 8 Multiple Choice (Single Answer)

Name the type of ABAP Dictionary table that has these characteristics: Same number of fields as the database table Same name as database table Maps 1:1 to database table

  1. Pooled
  2. Cluster
  3. Transparent
  4. View
Question 9 Multiple Choice (Single Answer)

An event starts with an event keyword and ends with:

  1. Program execution
  2. END-OF-EVENT
  3. Another event keyword
  4. END-EVENT
Question 10 Multiple Choice (Single Answer)

Which of the following is NOT a required attribute when creating an ABAP program? A: Application B: Title C: Status D: Type

  1. A&C
  2. A&D
  3. C&D
  4. B&D
Question 11 True/False

Coding two INITIALIZATION events will cause a syntax error.

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

When creating a transparent table in the ABAP Dictionary, which step automatically creates the table in the underlying database?

  1. Adding technical settings to the table
  2. Checking the table syntax
  3. Saving the table
  4. Activating the table
Question 13 Multiple Choice (Single Answer)

A field declared as type T has the following internal representation

  1. SSMMHH
  2. HHMMSS
  3. MMHHSS
  4. HHSSMM
Question 14 Multiple Choice (Single Answer)

If you use a RUN statement with a PROC SQL step

  1. SAS ignores the RUN statement, executes the statements as usual.
  2. Stop running due to error.
  3. Executes the code with a warning note
  4. Unexpected Result.
Question 15 Multiple Choice (Single Answer)

Complete the SELECT clause below to create a new column named Profit by subtracting the values of the column Cost from those of the column Price. select fruit,cost,price, ________________

  1. Profit=price-cost
  2. price-cost as Profit
  3. profit=price-cost
  4. Profit as price-cost
Question 16 Multiple Choice (Single Answer)

Which PROC SQL query will remove duplicate values of MemberType from the query output, so that only the unique values are listed?

  1. proc sql nodup; select membertype from sasuser.frequentflyers;
  2. proc sql; select distinct(membertype) as MemberType from sasuser.frequentflyers;
  3. proc sql; select unique membertype from sasuser.frequentflyers group by membertype;
  4. proc sql; select distinct membertype from sasuser.frequentflyers;
Question 17 Multiple Choice (Single Answer)

What happens if you use a GROUP BY clause in a PROC SQL step without a summary function?

  1. The step does not execute.
  2. The first numeric column is summed by default.
  3. The GROUP BY clause is changed to an ORDER BY clause.
  4. The step executes but does not group or sort data.
Question 18 Multiple Choice (Single Answer)

Which clause in the following program is incorrect? proc sql; select sex,mean(weight) as avgweight from company.employees company.health where employees.id=health.id group by sex;

  1. SELECT
  2. FROM
  3. WHERE
  4. GROUP BY
Question 19 Multiple Choice (Single Answer)

You are creating a PROC SQL query that will list all employees who have spent (or overspent) their allotted 120 hours of vacation for the current year. The hours that each employee used are stored in the existing column Spent. Your query defines a new column, Balance, to calculate each employee’s balance of vacation hours. Which query will produce the report that you want?

  1. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where balance <= 0
  2. proc sql; select name, spent, 120-spent as Balance from Company.Absences where calculated balance <= 0;
  3. proc sql; select name, spent, 120-spent as Balance from Company.Absences where balance <= 0;
  4. proc sql; select name, spent, 120-spent as calculated Balance from Company.Absences where calculated balance <= 0;
Question 20 Multiple Choice (Single Answer)

What is the purpose of the following statement ---- PROC SQL INOBS= 10;

  1. Restricts the number of rows (observations) that PROC SQL retrieves from any single source.
  2. Restricts the number of rows (observations) that PROC SQL can print.
  3. Directs the system to start reading the source from 10th observation.
  4. None of the above.