C++, Java, and .NET Programming Concepts
Quiz covering core programming concepts in C++ (constructors, destructors, memory allocation, OOP), Java (operators, data types, exceptions), and .NET (ADO.NET, LINQ)
Questions
LINQ query to Select and return all the rows from Product table and display the product names.
- Dim query = From product In products.AsEnumerable() Select product
- Dim query as select product From product In products.AsEnumerable()
- Dim query = From p In products.AsEnumerable() Select p
- None of these
Method used in LINQ to SQL for database updation
- Commit();
- Update();
- SubmitChanges();
- CommitTransaction();
Which is not the an ADO.NET object
- SqlDataAdapter
- SqlConnection
- SqlDataReader
- SqlDataView
Which is/are the method/s of an ADO.NET command object
- CreateObjRef
- BeginExecuteNonQuery
- Prepare
- All of the above
Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }
- True
- False
What will be output from the following statements: System.out.println(1+2+”3”); System.out.println (“1”+2+3);
- 33,123
- 123,33
- 6,6
- Compilation Error
Is following line throws Exception.If yes ,which type? justify it . float f = 100.00/0.0
- True
- False
what is the output? class A{ int i=1; void printit() { i=i++; system.out.println(i);} } class AS { public static void main(String s[]) { A a=new A(); a.printit(); } }
- 1
- 2
- Error
- None
Which one is faster in java ? A. Math.max(a,b); B. (a>b)?a:b
- A
- B
- Both are Same
- None
Which of the following is(are) true for Macro functions(#define fn()) & inline functions
- macro functions are expanded during compile. Inline functions are just usual functions calls
- macro functions are expanded during preprocessing and inline functions are expanded during compile
- macro functions are expanded during compile and inline functions are expanded during preprocessing
- No difference.Both are expanded at compile.
Considereing int take 2 bytes of memory. What is size of memory allocated for ob in the below program.the size of memory allocated for object of class class my_class { int x; int y; public: void add(int k); void display(); }; my_class ob;
- 4 bytes
- 6 bytes
- 8 bytes
- 12 bytes
What is abstract class?
- A class which can not be inherited
- A class which can have only single object
- A class which can not have any objects
- A class which can not inherit other classes
How is dynamic binding achieved in C++?
- Using virtual functions
- Using method overloading
- Using operator overloading
- Using both method & operator overloading
Which of the following statement(s) is(are) correct?
- constructors can be virtual
- destructors can be virtual
- constructors can be overloaded
- virtual functions are fast in execution
void func(){ double d; static int si; int i; }; where will be memory allocated for the variables?
- all(d,si,i) in stack
- d in stack;si in heap;i in stack
- d in stack;si in stack;i in heap
- d in heap;si in heap;i in stack
Which of the following statment(s) is(are) true for constructors & destructors
- constructors are executed only(once) when the first object is instantiated
- destructor is executed only at the end of main() execution
- constructors are executed on every object instantiation
- destructor is executed when all the objects of the class moves out of scope
- constructors can not take parameters
int he below code, which declaration hold for copy constructor? class C{ int x; public: C(int t);//-----> (1) C(C t); //-----> (2) C(C& t); //-----> (3) C(C t, int k);// ------> (4) };
- (1)
- (2)
- (3)
- (4)
What is singleton class?
- that can not be inherited
- that can be inherited only once
- that can have only one object
- there is no such class
which of the below statemen(s)is(are) true for malloc() & new functions?
- malloc is used to allocate store for integer arrays only
- new is used to allocate store for objects only
- new is used to allocate any kind of memory
- malloc is used to allocate any kind of memory
- new initializes the store after allocation
- malloc intializes the store after allocation
Pass by reference and Pass by address are same in C++.
- True
- False