Programming Languages Fundamentals: SAS, Java, and C++

Covers core programming concepts across multiple languages including SAS data processing, Java object-oriented programming, collections, exceptions, and C++ memory management and operator overloading.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

In C++ the function that is used to release the block of memory already used is

  1. release
  2. deallocate
  3. delete
  4. all the above
Question 2 Multiple Choice (Single Answer)

Index of an array starts from

  1. One
  2. Zero
  3. Two
  4. None of the Above
Question 3 Multiple Choice (Single Answer)

Which of the following OOPS concepts are used with cin and cout

  1. Data Hiding
  2. Encapsulation
  3. Operator Overloading
  4. None Of the Above
Question 4 Multiple Choice (Single Answer)

Which of the following is used to store data of different types

  1. Arrays
  2. Structures
  3. Both a and b
  4. None of the Above
Question 5 Multiple Choice (Single Answer)

Which of the following denote operator of logical AND

  1. &&
  2. ^&
  3. !&
  4. &
Question 6 Multiple Choice (Single Answer)

The class with name exforsys and having integer data x in its have constructor name as

  1. any name
  2. x
  3. exforsys
  4. None of the Above
Question 7 Multiple Choice (Multiple Answers)

which of these will compile and run? choose all the apply.

  1. LinkedList<integer> l=new LinkedList<int>();
  2. List<number> l=new LinkedList<number>();
  3. LinkedList<integer> l=new LinkedList();
  4. LinkedList<integer> l=new <integer>LinkedList()
  5. List<number> l=new LinkedList<integer>();
Question 8 Multiple Choice (Single Answer)

How are numeric and character missing values represented internally in SAS?

  1. numeric will be represented by blank and character will be represented by .
  2. both character and numeric will be represented as blanks
  3. numeric will be represented by . and character will be represented by blank
  4. numeric will be represented by . and character will be represented by NULL values
Question 9 Multiple Choice (Single Answer)

class A{ int b=10; private A(){ this.b=7; } int f(){ return b; } } class B extends class A{ int b; } class Test{ public static void main(String args[]){ A a=new B(); System.out.println(a.f()); } }

  1. Does not compile
  2. prints 0
  3. prints 10
  4. prints 7
Question 10 Multiple Choice (Multiple Answers)

what could be replaced with the "XX" in the following program to compile and run sucessfully? select four choices. class Parent{ public void amethod(int i) throws IOException{ } } public class Child extends Parent{ //XX }

  1. public void amethod(int i) throws FileNotFoundException{ }
  2. public void amethod(int i) throws IOException, RuntimeException{ }
  3. public void amethod(int i) throws RuntimeException{ }
  4. public void amethod(int i) throws Exception{ }
  5. public void amethod(int i) { }
  6. public void amethod(int i) throws Throwable{ }
Question 11 Multiple Choice (Multiple Answers)

which of the following modifiers can be applied to top level class(i.e., a class which is not enclosed by other class) select all that apply

  1. private
  2. protected
  3. transient
  4. public
  5. final
Question 12 Multiple Choice (Multiple Answers)

Class Foo{ Int num; Baz comp=new Baz(); } Class Bar{ Boolean flag; } Class Baz extends Foo{ Bar thing=new Bar(); Double limit; }

  1. A Bar is a Baz
  2. A Foo has a Bar
  3. A Baz is a Foo
  4. A Foo is a Baz
  5. A Baz has a Bar
Question 13 Multiple Choice (Single Answer)

Given: class Waiter{ void takeOrders(){ } void serveFood(){ } void takeOrdersAndServe(){ takeOrders(); serveFood(); } }

  1. It exhibits high cohesion
  2. It exhibits low cohesion
  3. It exhibits tight coupling
  4. It exhibits loose coupling
  5. None of the Above
Question 14 Multiple Choice (Single Answer)

Select correct answer Given: Class A{ A(){ System.out.print(“A”); } } Class B extends A{ B(){ this(4); super(); System.out.print(“B”); } B(int i){ System.out.print(“C”); } }

  1. Does not compile
  2. prints "ABC"
  3. prints "ACB"
  4. prints "CAB"
  5. run time exception
Question 15 Multiple Choice (Single Answer)

Which of the most suitable java collection class for storing various currencies and their equivalent prices in USD if multiple threads access and modify this data? It is required that class should be synchronized inherently

  1. HashSet
  2. Vector
  3. HashMap
  4. TreeMap
  5. None of the above
Question 16 Multiple Choice (Single Answer)

Which java collection class can be used to maintain the entries in the order in which they were last accessed?

  1. java.util.HashSet
  2. java.util.LinkedHashMap
  3. java.util.Hashtable
  4. java.util.Vector
  5. none of these
Question 17 Multiple Choice (Single Answer)

How does the following macros will resolve? What will be the output in log file? %let one=two; %let two=three; %let three=one; %put &one; %put &&one; %put &&&one;

  1. two, two, one
  2. two, three, one
  3. two, two, three
  4. two, two, two
Question 18 Multiple Choice (Single Answer)

Which date function advances a date, time or date/time value by a given interval?

  1. INTCK
  2. INTNX
  3. INTCX
  4. INTNK
Question 19 Multiple Choice (Single Answer)

How many observations will be there in the output dataset TEMP? Data temp; Set test (firstobs=50 obs=450); Run;

  1. 450
  2. 401
  3. 400
  4. 500
Question 20 Multiple Choice (Single Answer)

Which of the following can be used to read numeric values that contain numeric values and commas into a SAS dataset?

  1. comma. informat
  2. dollar. format
  3. comma. format
  4. w.d informat