Programming (Structured OR OOP)

Enter at...
View Complete Description
×

Topic Summary

Enter at least 20 MCQs
70
Questions
Question Type Legends

Easy

Medium

Difficult

Multiple Choice Questions for Programming (Structured OR OOP)

  • 1 Which is the valid statement to pass the base address of an array x to a function fun()?
    1. fun(&x);
    2. fun(int[]);
    3. fun(&x[1]);
    4. fun(x);

  • 2 Value that can be sent to a function is known as:
    1. Argument
    2. Parameter
    3. Local value
    4. User-Defined value

  • 3 What happened if sequence of parameter in function prototype and function call differs?
    1. Syntax error
    2. Fatal error
    3. Program will compile successfully
    4. Logical error

  • 4 The difference between x and ‘x’ is:
    1. Both are same
    2. First one is integer and second is char
    3. The first one is a character constant x and second one is the string literal x
    4. The first refers to identifier x and the second one refers to the char constant x

  • 5 Which of the following is not a valid statement?
    1. int x=99390;
    2. int x=9999;
    3. float x=3.1416;
    4. None

  • 6 What is synchronization in reference to a thread?
    1. It’s a method that allow to many threads to access any information require
    2. It’s a process by which many thread are able to access same shared resource
    3. It’s a process by which a method is able to access many different threads
    4. It’s a process of handling situations when two or more threads need access to a shared resource

  • 7 Which of these method is used to find out that a thread is still running or not?
    1. run()
    2. Alive()
    3. checkRun()
    4. isAlive()

  • 8 Which of these is a correct statement about args in this line of code? public static viod main(String args[]){ }
    1. args is an array of String
    2. args is a String
    3. args is a Character
    4. args in an array of Character

  • 9 When does Exceptions in Java arises in code sequence?
    1. Run Time
    2. Compilation Time
    3. Can Occur Any Time
    4. None of Above

  • 10 Which of the following is correct way of implementing interface salary by class manager in JAVA?
    1. class manager implements salary { }
    2. class manager extends salary { }
    3. class manager imports salary { }
    4. None of above

  • 11 Which of these is correct way of inheriting class A by class B?
    1. class B + class A {}
    2. class B extends A {}
    3. class B inherits class A {}
    4. class B extends class A {}

  • 12 The process of coupling data and functionality is known as:
    1. Encapsulation
    2. Abstraction
    3. Information Hiding
    4. Coupling

  • 13 While using the super reference in a constructor, what restriction is always necessary?
    1. Only one child class can use it.
    2. It must be as the first statement of the constructor.
    3. It must be used as the last statement of the constructor.
    4. No restriction is necessary.

  • 14 A type parameter is always delimited by :
    1. ( ) parenthesis
    2. { } curly braces
    3. [ ] square brackets
    4. < > angle brackets

  • 15 According to the principles of OOP, which of the following is preferred during class design?
    1. High Coupling, High Cohesion
    2. Low Coupling, High Cohesion
    3. High Coupling, Low Cohesion
    4. LowCoupling, Low Cohesion

  • 16 The degree of interdependency among objects is known as:
    1. Cohesion
    2. Association
    3. Composition
    4. Coupling

  • 17 Integer i = 1000; int j = i.intValue( ); The processes above is known as:
    1. AutoBoxing and manual unboxing
    2. ManualBoxing and manual unboxing
    3. AutoBoxing and Autounboxing
    4. AutoUnBoxing and manual unboxing

  • 18 Boolean a = new Boolean("afsfalsea"); What happens after execution of the following ?
    1. a gets assigned the boolean value false
    2. FormatException is thrown
    3. a is assigned null
    4. None of these.

  • 19 Which of the following is the correct way to declare a method that receives a variable number of arguments of String type.
    1. void Method (String a, String b, String c){ }
    2. void Method (String a){ }
    3. void Method(String... a){ }
    4. none of these, must use array in definition of parameters

  • 20 if a class contains a static initializer block and a constructor, which of them is bound to be used first if instantiation occurs.
    1. The constructor
    2. The static initializer block
    3. Both get used concurrently
    4. None of these

  • 21 Java provides the ability of a program to examine or introspect itself at runtime using:
    1. Abstraction
    2. Serialization
    3. Debugging
    4. Reflection

  • 22 During class design, partitioning your functionality so that it is concise and closest to the data relevant to it is known as:
    1. Coupling
    2. Abstraction
    3. Cohesion
    4. Data Hiding

  • 23 A specialized constructor that creates a deep copy of an object provided is known as:
    1. Object constructor
    2. Parameterised constructor
    3. default constructor
    4. Copy constructor

  • 24 An exception that forces the use of the throws clause or the try statements is categorized as:
    1. Unchecked Exception
    2. Checked Exception
    3. Exception
    4. None. All excetptions will need throws, or try statements.

  • 25 Cardinality of an object indicates the number of :
    1. Compositions it partakes in.
    2. Associations it partakes in.
    3. Aggregations it partakes in.
    4. Total number of instances.

  • 26 When an object of a class uses the services of another object, it indicates which form of relationship?
    1. Aggregation
    2. Inheritance
    3. Composition
    4. None of these

  • 27 When an assertion evaluates to false, what effect does it have?
    1. AssertionException is thrown
    2. AssertionError is thrown
    3. Program continues in normal fashion
    4. AssertionInvalid Exception is thrown

  • 28 In order to be eligible to participate in serialization, a class must implement the Serializable interface that is defined in the java.io package. Which of the following methods must it implement from that interface?
    1. void serialize( )
    2. int serialize( )
    3. bool serialize( )
    4. the interface specifies no methods

  • 29 Which design pattern deals with the problem of adding functionality to a given object ?
    1. Factory
    2. Singleton
    3. Decorator
    4. Observer

  • 30 The design pattern in which the Constructor is made private and an instance is created within whereby clients are then provided unified access to it is known as:
    1. Factory Pattern
    2. Singleton Pattern
    3. Decorator Pattern
    4. Observer

  • 31 An array with varying column sizes is known as
    1. Jagged
    2. Zig Zagged
    3. TwoDimensional
    4. Single Dimensional

  • 32 ______________ can have both abstract and non-abstract methods.
    1. Final Class
    2. Static Class
    3. Derived Class
    4. None of the Above

  • 33 The Non-static methods inside a class are known as ________________ methods.
    1. Non Static
    2. Static
    3. Class
    4. Instance

  • 34 Method Overloading is ________ Polymorphism.
    1. Run Time
    2. Execution Time
    3. Compile Time
    4. None of the Above

  • 35 Checked Exceptions are also called ___________ exceptions,
    1. Compile Time
    2. Run Time
    3. I/O
    4. None of The Above

  • 36 ________________ cannot be extended by any other class.
    1. Child Class
    2. Abstract Class
    3. Static Class
    4. None of the above

  • 37 Unchecked Exceptions are also called ________________ Exceptions.
    1. Compile Time
    2. Run Time
    3. I/O
    4. None of the above

  • 38 Interfaces are used to achieve ________________ of the code.
    1. Inheritance
    2. Polymorphism
    3. Encapsulation
    4. None of the above

  • 39 ________ class cannot be instantiated.
    1. Final
    2. Static
    3. Abstract
    4. Default

  • 40 An “is a” relationship represents _____________.
    1. Inhertitance
    2. Composition
    3. Abstraction
    4. None of The Above

  • 41 A “has a” relationship represents _____________.
    1. Inheritance
    2. Composition
    3. Abstraction
    4. None of the Above

  • 42 Taking away characteristics in order to reduce to a set of essential characteristics is ___________.
    1. Polymorphism
    2. Encapsulation
    3. Inheritance
    4. Abstraction

  • 43 Type casting of variable from smaller to bigger data type is called __________.
    1. Widdening
    2. Narrowing
    3. Explicit
    4. None of the Above

  • 44 In Java type casting from ‘int’ data type to ‘long’ data type is ________.
    1. Implicit Conversion
    2. Explicit Conversion
    3. User Defined Conversion
    4. Not Possible

  • 45 Overriding is ________ time polymorphism.
    1. Compile
    2. Run
    3. Execution
    4. Not Polymorphism

  • 46 The term ________ means the ability to take multiple forms.
    1. Abstraction
    2. Ecapsulation
    3. Inheritance
    4. Polymorphism

Contact Us

support@subexpert.com
Write to Us View Help
Subject Expert Logo

Subject Expert

Learn and Evaluate

Follow Us
© 2020 - Subject Expert