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.
Questions
In C++ the function that is used to release the block of memory already used is
- release
- deallocate
- delete
- all the above
Index of an array starts from
- One
- Zero
- Two
- None of the Above
Which of the following OOPS concepts are used with cin and cout
- Data Hiding
- Encapsulation
- Operator Overloading
- None Of the Above
Which of the following is used to store data of different types
- Arrays
- Structures
- Both a and b
- None of the Above
Which of the following denote operator of logical AND
- &&
- ^&
- !&
- &
The class with name exforsys and having integer data x in its have constructor name as
- any name
- x
- exforsys
- None of the Above
which of these will compile and run? choose all the apply.
- LinkedList<integer> l=new LinkedList<int>();
- List<number> l=new LinkedList<number>();
- LinkedList<integer> l=new LinkedList();
- LinkedList<integer> l=new <integer>LinkedList()
- List<number> l=new LinkedList<integer>();
How are numeric and character missing values represented internally in SAS?
- numeric will be represented by blank and character will be represented by .
- both character and numeric will be represented as blanks
- numeric will be represented by . and character will be represented by blank
- numeric will be represented by . and character will be represented by NULL values
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()); } }
- Does not compile
- prints 0
- prints 10
- prints 7
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 }
- public void amethod(int i) throws FileNotFoundException{ }
- public void amethod(int i) throws IOException, RuntimeException{ }
- public void amethod(int i) throws RuntimeException{ }
- public void amethod(int i) throws Exception{ }
- public void amethod(int i) { }
- public void amethod(int i) throws Throwable{ }
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
- private
- protected
- transient
- public
- final
Class Foo{ Int num; Baz comp=new Baz(); } Class Bar{ Boolean flag; } Class Baz extends Foo{ Bar thing=new Bar(); Double limit; }
- A Bar is a Baz
- A Foo has a Bar
- A Baz is a Foo
- A Foo is a Baz
- A Baz has a Bar
Given: class Waiter{ void takeOrders(){ } void serveFood(){ } void takeOrdersAndServe(){ takeOrders(); serveFood(); } }
- It exhibits high cohesion
- It exhibits low cohesion
- It exhibits tight coupling
- It exhibits loose coupling
- None of the Above
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”); } }
- Does not compile
- prints "ABC"
- prints "ACB"
- prints "CAB"
- run time exception
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
- HashSet
- Vector
- HashMap
- TreeMap
- None of the above
Which java collection class can be used to maintain the entries in the order in which they were last accessed?
- java.util.HashSet
- java.util.LinkedHashMap
- java.util.Hashtable
- java.util.Vector
- none of these
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;
- two, two, one
- two, three, one
- two, two, three
- two, two, two
Which date function advances a date, time or date/time value by a given interval?
- INTCK
- INTNX
- INTCX
- INTNK
How many observations will be there in the output dataset TEMP? Data temp; Set test (firstobs=50 obs=450); Run;
- 450
- 401
- 400
- 500
Which of the following can be used to read numeric values that contain numeric values and commas into a SAS dataset?
- comma. informat
- dollar. format
- comma. format
- w.d informat