News Ticker

Menu

Browsing "Older Posts"

Browsing Category "Technologies"

UpWork (oDesk) & Elance Visual Basic 6 Test Question & Answers

July 03, 2015 / No Comments
UpWork (oDesk) & Elance Visual Basic 6 Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of Visual Basic 6. Lets Start test.


Ques : Which of the following cannot be included in the Open method of the recordset?
Ans  : Cursor Type

Ques : You are creating a client application that calls ActiveX DLLs. Which of the following properties of the Err object provides the name of a component that sends an error back to the client application?
Ans  : Number

Ques :  Which event should you use to store property values into the PropertyBag?
Ans  : Terminate

Ques : Which event should be used to resize an ActiveX control as the user modifies the size of the control implementation on a form?
Ans  :  Resize

Ques : The ______ function can be used to run any .com, .exe, .bat or .pif file from a Visual Basic program.
Ans  : Shell

Ques : Consider the following program code:

(i) Dim FileName as String
Open FileName For Input As #FreeFile

(ii) Dim FileName as String
FileNum = FreeFile
Open FileName For Input As #FileNum
Ans  : Both (i) and (ii) are correct

Ques : What data type is the HelpContextID?
Ans  : String

Ques : To store pictures in an array, Visual Basic provides the _____ control.
Ans  : PictureClip

Ques : What is the sequence of events when a form is unloaded?
Ans  : QueryUnload, Unload and Terminate

Ques : What is the default value for the scalemode property of the form?
Ans  : Twip

Ques : Visual Basic displays information depending upon the current value of two properties of the form, called:
Ans  : CurrentX and CurrentY

Ques : Which of the following statements is capable of abandoning a series of modifications made to a recordset locked with a BatchOptimistic lock?
Ans  :  CancelUpdate

Ques : What is the purpose of the Image List Control?
Ans  : To display images to the user

Ques : A __________ control defaults to displaying the files in the current directory:
Ans  : File List Box

Ques : Which property procedure is used to retrieve the value of a property?
Ans  : Retrieve

Ques : Which method will you use to remove a form from the Screen but retain it in memory?
Ans  : Show method

Ques : Which events allow you to determine if a Control or Shift key was pressed by the user?
Ans  : Click and KeyPress

Ques : In order to overlap the controls (say a command button) during design time, we use the 'Send To Back' or 'Bring To Front' option from the Edit menu. To change it dynamically (i.e. during program execution) we need to change:
Ans  : Background color property

Ques : The ____ function returns the numeric value from a string expression:
Ans  : Val

Ques : What do CurrentX and CurrentY return?
Ans  : Current X and Y co-ordinates of mousepointer

Ques :  Variables that allow sharing of values across event procedures are called:
Ans  : Form level variable

Ques : Which of the following approaches to data modifications is the least efficient?
Ans  :  Updating through a cursor using a recordse

Ques : The interval property of the Timer control specifies the time in:
Ans  : Milliseconds

Ques : Which parameter of the WriteProperty method can be omitted but should be included to increase the efficiency of the control?
Ans  : Name

Ques : A project group is a Project which:
Ans  : Consists of several Projects

Ques : What is the purpose of the Class Builder add-in in Visual Basic:
Ans  : To add classes to the current project

Ques : An ADO dynamic property is:
Ans  : A property that changes value at runtime

Ques :   In order to provide a transparent background to the Form, you must change the _________ property to _______.
Ans  : BackStyle, Opaque

Ques : What does the controls collection contain?
Ans  : A list of all controls on a form

Ques : Global Procedures and Global Variables are declared in:
Ans  : Form Modules

Ques : Given the following code segment, how many instances of the form are created and displayed ?

      dim frmvar1 as frmperson,frmvar2 as frmperson
      set frmvar1 = new frmperson
      set frmvar2 = frmvar1
      load frmvar1
      frmvar2.show
Ans  : None

Ques :  Only Controls with a ________ property such as Picturebox, Toolbox, Statusbar etc. can be placed on an MDI form:
Ans  : Showtips

Ques : Whenever the current record is about to change, Visual Basic generates the ______ event:
Ans  : Validate

Ques : Which of the following will provide the best aggregate performance for a query that is not executed repeatedly?
Ans  : Direct execution

Ques : The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.
Ans  : AutoRedraw = True

Ques : Which event of an ActiveX control data provider runs every time a bound control extracts data through the provider?
Ans  : GetDataMember

Ques : One can convert a Visual Basic Application into ActiveX Document using:
Ans  : Visual Database Manager

Ques :  Which function or method will you use to get a count of the maximum index limit of an array?
Ans  :  UBound function

Ques : Which property of the ProgressBar determines how much of the bar is filled?
Ans  : Min

Ques : In order to change the mouse pointer shape from glass to watch-glass, the property to be used is:
Ans  : MousePointer

Ques : The caption and the name properties of the command button:
Ans  : Are one and the same

Ques : In order to access a file in Non-textual format, you have to open file in:
Ans  : Ascii Format

Ques : What is the extension of the Visual Basic project file that stores the design of a user control.
Ans  : .ctx

Ques : After a Dynaset type recordset has been created and opened, further searching is possible using the:
Ans  : FindNext method

Ques : Which method of the Recordset object should you use to navigate multiple recordsets returned by a stored procedure?
Ans  : NewRecordset

Ques :  Which event procedure is called only if AutoRedraw property is set to false:
Ans  : Form_GotFocus

Ques : Which events enable you to determine which key was pressed by the user?
Ans  :  Click and KeyPress

Ques : The Kill command in Visual Basic is used for:
Ans  : Stopping the current process

Ques : Which method would you use to get a free or unused File identifier while opening any file:
Ans  : FreeFile

Ques : Which event is fired when a text box loses focus?
Ans  : LostFocus

Ques :  Message Boxes can hold a maximum of _______ characters.
Ans  : 256

Ques : Which of the following is the only valid Resume statement in an error handler?
Ans  : Resume prior

Ques : Which is the only event of the timer control?
Ans  : Timer

Ques : Consider the following subprogram:

        Sub ChangeText(ByVal X as String,Y as String)
          Y = X
        End Sub


If you are calling it using the following code:

            Call ChangeText(Form1.Caption,Y$)
Ans  : The Caption of Form1 will change to the value contained in Y$

Ques : If one needs to use an ampersand(&) in a Label but does not want it to be an Access Key, the _______ property of the label must be set to False.
Ans  : Caption

Ques : Which property of the Err object returns the numeric value associated with the most recent runtime error?
Ans  : Description

Ques : The event Lost_Focus of one object results in _____ of the other object:
Ans  : Got_Focus

Ques : Which of the following ADO recordset types provides the greatest degree of concurrency?
Ans  : Static

Ques : The ______ property is used to show Tool Tips or Help Balloons when the mouse rests on the object:
Ans  : ToolTipText

Ques :  Which of the following can be shown to the user using the Common Dialog control in VB?
Ans  : Common messages passed to Windows

Ques :  Which property of the form changes the form's title?
Ans  : Name

Ques : In order to enable the DBGridControl or the MSFlexGrid Control to display the contents of a table or query, you need to set only the ______ property:
Ans  : DataSource

Ques : In Visual Basic, which method can you use to send key strokes to other Window applications?
Ans  : AppActivate

Ques :  The _______ property changes the tab order at runtime:
Ans  : Tab stop

Ques : You want the code of the close command button to execute upon pressing the ESC key, even though the focus may be on another control in the form. Which property of the command button would you set to true?
Ans  : Cancel

Ques : Which collection of an ActiveX control enumerates all of the properties that can be bound to a data source?
Ans  : DataFields

Ques : You can create menus by the ________ and _________.
Ans  : Menu Editor, Application Wizard

Ques :   What is the sequence in which the following events are triggered when a form is loaded?
Ans  : Initialize, Load, Resize and Paint

Ques : Procedures declared in a _____ are local whereas procedures declared in a ______ are  available to the whole application.
Ans  : Form window, standard or code module

Ques : Which property of the ListView control determines which field a sort is based on?
Ans  : Sorted

Ques :  The method used to search for records from within a table type recordset object is:
Ans  : LookUp

Ques : Which event is triggered when the user moves to another open form?
Ans  : Unload

Ques : Which of the following is an event of the Shape control?
Ans  : GotFocus

Ques :  Which line of code listed here can be used to create a string of fixed length:
Ans  : Dim strFirstName as String

Ques : Which of the following statements is incorrect regarding toolbars?
Ans  : There can be only one toolbar on a form

Ques : The settings for the Color properties in Visual Basic are indicated by:
Ans  : Decimal Coding

Ques : What does the forms collection contain?
Ans  : A list of all forms in a project

Ques : Which of the following will perform a direct execution of a Command object?
Ans  : The Execute method

Ques : The _______ function enables a VB application to make use of the idle time and to respond periodically to events.
Ans  :  GetTime()

Ques : The Load & Activate events are associated with:
Ans  : All controls

Ques : What you must do before making calls to an ActiveX DLL project in the same Project Group?
Ans  : Compile the DLL

Ques : Name the only property supported by a collection?
Ans  : Name

Ques : Which event of a text box would you use for validating the data entered by the user?
Ans  : Validate

Ques : Which event occurs only once in the entire life cycle of an ActiveX control?
Ans  : Initialize

Ques : How can you keep the user from exiting a form by clicking the Close button?
Ans  : Place code in the Terminate event

Ques : Which of the following debug tools would you use to locate your current position in a series of embedded procedure calls?
Ans  :  Locals window

Ques : You are creating an ActiveX component that raises user-defined errors. Which of the following statements correctly raises an error to the client with error number 20000?
Ans  : Err.Raise vbObjectError + 20000

Ques :  A prepared statement is:
Ans  : Query text cached on the server

Ques : The _______ method loads the form named 'Form1' in to memory and also displays it.
Ans  :  Load Form1

Ques : You want to display the code and the description of an error. What would be the correct syntax?
Ans  : Msgbox err.no & err.text

Ques : If the CancelError Property of the CommonDialog Box is set to true then which of the following statement is true:
Ans  : A runtime error can result if the user clicks the cancel button

Ques : How do you create a read only property in a form?
Ans  : Create only a Property Set procedure

Ques : Which three methods does the collection object support?
Ans  : Let, Get, Set

Ques : Labels do not respond to _____ and ______ events.
Ans  : Got_Focus , Lost_Focus

Ques : The _______ method resets the contents of bound controls to their original values when the user clicks on the cancel button.
Ans  : UpdateControls

Ques : Which of the following is the only drag related event?
Ans  : DragEnter

Ques : You are creating an ActiveX component that raises user-defined errors. What is the valid range of error numbers that you can use for user-defined errors?
Ans  : 1-1000

Ques : Which of the following procedure types will execute when you assign a value to a property of an object?
Ans  : Property Get

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance Spring MVC Test Question & Answers

/ No Comments
UpWork (oDesk) & Elance Spring MVC Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of Spring MVC. Lets Start test.


Ques : In an annotation-based Spring MVC controller, which of the following are valid ways to set cache headers for a specific path?
Ans  :  Ensuring the instance of "AnnotationMethodHandlerAdapter" does not have the    "cacheSeconds" property set, and adding an instance of "WebContentInterceptor".
       Adding "final HttpServletResponse response" as a parameter, then setting the header "Cache-Control" to "all-cache".
       Using a Handler Interceptor and using the "postHandle" method provided by it.

Ques : Which of the following are valid sets of constructor arguments for the ModelAndView class? (Select all correct answers.)
Ans  :  String viewName
        String viewName, Map model

Ques :  Which of the following are possible validation methods for user input in Spring MVC?
Ans  :  Annotation validation
        Programmatic validation

Ques : Which of the following code samples will get the ServletContext inside an Interceptor?
Ans  : @Autowired ServletContext context;
       request.getSession().getServletContext();

Ques : Which of the following dependency injection (DI) methodologies are available in Spring MVC?
Ans  : Constructor-based dependency injection
       Setter-based dependency injection

Ques : Which of the following interfaces can be implemented to interact with a container's management of the bean lifecycle?
Ans  : InitializingBean
       DisposableBean

Ques : Select all authentication methods that are supported by Spring Security by default:
Ans  : Basic Authentication
       Digest Access Authentication

Ques : True or false: a factory class can hold more than one factory method.
Ans  : True

Ques : Regarding the @Resource annotation, which of the following statements is false?
Ans  :  If no name attribute is specified, the default name is derived from the field name or setter method.

Ques : Which of the following  statements is true about method arguments that have an @ModelAttribute annotation?
Ans  :  Model attributes have to be explicitly added when using @ModelAttribute.

Ques : What does the following code do?

@RequestMapping("/{id}/**")
public void foo(@PathVariable("id") int id, HttpServletRequest request) {
    String restOfTheUrl = (String) request.getAttribute(
        HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    ...
}
Ans  :  It retrieves the partial path value (after "**") before the @RequestMapping and @PathVariable values have been parsed.

Ques : Which of the following can be used to serve static resources while still using DispatchServlet at the site's root?
Ans  :

Ques : What is the difference between the @Repository and the @Controller annotations in Spring?
Ans  : "@Repository" is used as a stereotype for the persistence layer, while "@Controller" is used as a stereotype for the presentation layer.

Ques : Which of the following annotations are supported by classes with the @Bean annotation?
Ans  :  @PostConstruct

Ques : Which of the following statements is false?
Ans  : By default, a transaction is only marked for rollback in the case of runtime unchecked exceptions.

Ques :  Which of the following statements is true about the HandlerExceptionResolver class?
Ans  : DefaultHandlerExceptionResolver converts standard Spring exceptions and converts them to HTTP Status Codes.

Ques : Given the following method:

@RequestMapping(method=RequestMethod.GET, value="/fooBar")
    public ResponseEntity fooBar2() {
      String json = "jsonResponse";
      HttpHeaders responseHeaders = new HttpHeaders();
      responseHeaders.setContentType(MediaType.APPLICATION_JSON);
      return new ResponseEntity(json, responseHeaders, HttpStatus.CREATED);
    }

Which of the following statements is correct?
Ans  : It returns a JSON String and sets the mimetype to text/javascript.

Ques : Which of the following classes provides built-in pagination functionality in SpringMVC?
Ans  : PagedListHolder

Ques : Given the method below:

@RequestMapping(value = "/foo", method = RequestMethod.GET)
public final String foo(HttpServletRequest request, BindingResult bindResult, ModelMap model) {
    model.addAttribute("abc", 123);
    return "foo";
}

When the view is displayed in the browser, it's URL is "http://mydomain/foo?abc=123".

Which of the following statements is true?
Ans  : The attribute name-value pair will be included in the URL, regardless of the use of @ModelAttribute in the controller.

Ques : Which of the following is true about the use of in a servlet?
Ans  :   activates many different annotations in beans, whether they are defined in XML or through component scanning.

Ques : Fill in the blank:
The _______ enables the use of the bean element’s attributes, instead of nested elements, to describe property values and/or collaborating beans.
Ans  : p-namespace

Ques : Which of the following statements is true about the @RequestMapping annotation?
Ans  : It supports ant-style paths.

Ques : Which of the following statements is true for the configuration of the Spring handler adapter(s) in a Spring MVC application context?
Ans  : If at least one request handler adapter is defined the context files, Spring will not create the default adapters.

Ques : Which of the following statements is true about the HandlerInterceptor interface?
Ans  : It allows exchanging the request and response objects that are handed down the execution chain.

Ques : How can an HTTP 404 status code be returned from a Spring MVC Controller?
Ans  : Having the method accept HttpServletResponse as a parameter, so that setStatus(404) can be called on it.

Ques : Which of the following is the default bean scope in Spring MVC?
Ans  : singleton

Ques : Which of the following enables custom qualifier annotation types to be registered even if they are not annotated with Spring’s @Qualifier annotation?
Ans  : CustomAutowireConfigurer

Ques : Which of the following statements is correct?
Ans  : doesn't declare its own handler mapping

Ques : Which of the following statements is true about the @RequestParam annotation?
Ans  : It indicates that a method parameter should be bound to a web request parameter.

Ques : Which of the following code samples will correctly return an image in @ResponseBody from a byte[] of image data?
Ans  : @ResponseBody @RequestMapping("/photo", method = RequestMethod.GET, produces = MediaType.IMAGE_JPEG_VALUE) public byte[] testphoto() throws IOException { InputStream in = servletContext.getResourceAsStream("/images/no_image.jpg"); return IOUtils.toByteArray(in); }

Ques : Which of the following statements are correct, with respect to using the @PreAuthorize annotation in Spring controller methods?
Ans  : @PreAuthorize works with Spring controller methods.

Ques : Which of the following is not a built-in Spring MVC bean scope?
Ans  : local session

Ques : Fill in the blank: _______ is a class-level annotation indicating that an object is a source of bean definitions.
Ans  : @Configuration

Ques : Fill in the blank:
When defining a bean that is created with a static factory method, the ______ attribute is used to specify the class containing the static factory method.
Ans  : class

Ques : Which of the following statements is true about the @ModelAttribute annotation?
Ans  : It can be used to expose reference data to a web view.

Ques : Fill in the blank:
In Spring's XML-based configuration, the _______ attribute of the element specifies a property or constructor argument as a string representation.
Ans  : name

Ques : Which of the following statements is/are true about autowiring in Spring?
Ans  : Fields are injected after the construction of a bean.

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance Java v3 Test Question & Answers

June 28, 2015 / No Comments
Java v3 Test Question & Answer is really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is very valueable to acquire knowledge of this skill. Lets Start test.


Ques : What is the result of an attempt to compile and run the given program?

public class Test107 {
        public static void main(String[] args) {
                System.out.println(test());
        }
        private static int test() {
                return (true ? null : 0);
        }
}
Ans  : It compiles, but throws NullPointerException at run-time.

Ques : What is the output of the given program?

public class Test93 {
        private int x = 0;

        public static void main(String[] args) {
                new Test93().test();
        }

        private int f(int x) { return ++x; }
        private int g(int y) { return x++; }

        private void test() {
                System.out.print( f(x)==f(x) ? "f" : "#" );
                System.out.print( g(x)==g(x) ? "g" : "#" );
        }
}
Ans  : f#

Ques : Which design pattern reduces network traffic by acting as a caching proxy of a remote object?
Ans  : Value Object

Ques : What is the output of the given program?

public class Test89 {
        public static void main(String[] args) {
                T x = new T("X", null); x.start();
                T y = new T("Y", x); y.start();
                T z = new T("Z", y); z.start();
        }
}
class T extends Thread {
        private Thread predecessor;
        private String name;
        public T(String name, Thread predecessor) {
                this.predecessor = predecessor;
                this.name = name;
        }
        public void run() {
                try {
                        Thread.sleep((int)(Math.random()*89));
                        System.out.print(name);
                } catch (InterruptedException ie) {
                        ie.printStackTrace();
                }
        }
}
Ans  : any of the following: XYZ, XZY, YXZ, YZX, ZXY, ZYX

Ques : Assuming that val has been defined as an int for the code below, which values of val will result in "Test C" being printed?

if( val > 4 ) {

 System.out.println("Test A");

} else if( val > 9 ) {

 System.out.println("Test B");

} else

 System.out.println("Test C");
Ans  : val between 0 and 4

Ques : How many objects are created by the following code?


Object a, b, c, d, e;

e = new Object ();

b = a = e;

e = new Object ();
Ans  : 2

Ques : Which of the following is the correct syntax for creating a Session object?
Ans  :  HttpSession ses=request.getSession()

Ques : Which statement is true about the given code?

public class Test78 {
        public static void main(String[] args) throws Exception {
                new JBean().setHeight(1).setWidth(2).setDepth(3).setDensity(9);
        }
}
class JBean {
        private int height, width, depth, density;
        public JBean setHeight  (int h) { this.height  = h; return this; }
        public JBean setWidth   (int w) { this.width   = w; return this; }
        public JBean setDepth   (int d) { this.depth   = d; return this; }
        public JBean setDensity (int d) { this.density = d; return this; }
}
Ans  : The code compiles and runs.

Ques : X.509 version 3 specifies which of the following?
Ans  :  A format and content for digital certificates.

Ques : How many objects are created in the given code?

Object x, y, z;
x = new Object();
y = new Object();
Ans  : 2

Ques : How does the set collection deal with duplicate elements?
Ans  : The add method returns false if you attempt to add an element with a duplicate value.

Ques : Conventionally, which directory do servlet class files get placed on?
Ans  :  WEB-INF\classes

Ques : Which is a proper way to declare and throw exception of class XYException?
Ans  : class XYException extends Exception {} ... throw new XYException();

Ques : Which of the following is a well-known HTTP port?
Ans  : 80

Ques : What is the output of the given program?

public class Test89 {
        public static void main(String[] args) {
                T x = new T(""X"", null); x.start();
                T y = new T(""Y"", x);    y.start();
                T z = new T(""Z"", y);    z.start();
        }
}
class T extends Thread {
        private Thread predecessor;
        private String name;
        public T(String name, Thread predecessor) {
                this.predecessor = predecessor;
                this.name = name;
        }
        public void run() {
                try {
                        Thread.sleep((int)(Math.random()*89));
                        System.out.print(name);
                } catch (InterruptedException ie) {
                        ie.printStackTrace();
                }
        }
}
Ans  : Any of the following: XYZ, XZY, YXZ, YZX, ZXY, ZYX

Ques :  Which of the following code snippets will take transform input string "2012/06/05"  to output string "05 - 06 - 2012"?
Ans  : String dateString = "2012/06/05"; Date date = new SimpleDateFormat("yyyy/MM/dd").parse(dateString); SimpleDateFormat sdf = new SimpleDateFormat("dd - MM - yyyy"); System.out.println(sdf.format(date));

Ques : Which statement is true regarding ServletContext Initialization Parameters in the deployment descriptor?
Ans  : They are accessible by all servlets in a given web application.

Ques : Which of the following is the correct syntax for suggesting that the JVM perform garbage collection?
Ans  : System.gc();

Ques : Why can't a Graphics object be created using the following statement?

Graphics g = new Graphics();
Ans  :  The Graphics class is an abstract class.

Ques : What is the output of the given program?

public class Test97 {
        public static void main(String[] args) {
                int[][] a = new int[2][2];
                System.out.println(a.length);
        }
}
Ans  : 2

Ques : Which of the following interfaces makes it possible for Java to save an object to a file and turn it into a data stream?
Ans  :  java.io.Serializable

Ques : How many objects are created in the given code?

Object x, y, z;
x = new Object();
y = new Object()
Ans  : 2

Ques : Consider the following code:

public static void main(String bicycle[])
{
        System.out.println(bicycle[0]);
}

What would be the result if "java TwoTyre one two" is entered in the command line?
Ans  : one

Ques : What is the term to describe a situation where two or more threads are blocked forever, waiting for each other?
Ans  : deadlock

Ques : SQLException has a feature of chaining - identify the right code to execute the same from the following options:
Ans  :  catch(SQLException e) { out.println(e.getMessage()); while((e=e.getNextException())!=null) { out.println(e.getMessage()); } }

Ques : Which statements are true regarding ServletContext Init Parameters in the deployment descriptor?
Ans  :  They are set at deployment-time and can be updated at run-time.

Ques : Which of the following methods are members of the Vector class and allow you to input a new element?
Ans  : addElement

Ques : In which class is the notify method defined?
Ans  : Object

Ques : The principal finder method that must be implemented by every entity bean class is:
Ans  :  findByPrimaryKey()

Ques : Which option lists Java access modifiers in the right order from the most permissive to the most restrictive?
Ans  : public, protected, []no modifier/default/package[], private

Ques : What should be the replacement of "//ABC" in the following code?

class Krit
{
    String str= new String("OOPS !!! JAVA");
    public void KritMethod(final int iArgs)
    {
      int iOne;
      class Bicycle
      {
        public void sayHello()
        {
          //ABC
        }
      }
    }
    public void Method2()
    {
      int iTwo;
    }
}
Ans  : System.out.print(str);

Ques : What is the output of the given program?

public class Test118 extends _Test118 {
        {
                System.out.print("_INIT");
        }
        static {
                System.out.print("_STATIC");
        }
        Test118() {
                System.out.print("_CONST");
        }
        public static void main(String[] args) {
                System.out.print("_MAIN");
                new Test118();
        }
}
class _Test118 {
        _Test118() {
                System.out.print("_BASE");
        }
}
Ans  :  _STATIC_MAIN_BASE_INIT_CONST

Ques : What will be the output, if the following program is run?
public class Test8 {
    public static void main(String[] args) {
        System.out.println(Math.sqrt(-4));
    }
}
Ans  : NaN

Ques : What will be the output of this program?

public class Test {

 public static void main(String args[]) {

  int a, b;
  a = 2;
  b = 0;
  System.out.println(g(a, new int[] { b }));
 }

 public static int g(int a, int b[]) {

  b[0] = 2 * a;
  return b[0];
 }
}
Ans  : 4

Ques : There are three classes named A, B, and C. The class B is derived from class A and class C is derived from B. Which of the following relations are correct for the given classes?
Ans  : Any instance of B is an instance of A.

Ques : What is the output of the given console application?

public class Test19 {
        public static void main(String[] args) {
                final int X = 9;
                int[][] a = {{5, 4, 3}, {9, 7, 2}, {1, 6, 8}};
                for (int i=0; i<3 b="" i="">
                        for (int j=0; j<3 b="" j="">
                                if (a[i][j] == X) break;
                                System.out.print(a[i][j] + "" "");
                        }
                }
        }
}
Ans  : 5 4 3 1 6 8

Ques : Which of the following statements is true?
Ans  :  public interface RemoteTrain extends java.rmi.Remote

Ques : The JDK comes with a special program that generates skeleton and stub objects that is known as:
Ans  : rmic

Ques :  Which of these interfaces is the most applicable when creating a class that associates a set of keys with a set of values?
Ans  : Map

Ques : Choose all valid forms of the argument list for the FileOutputStream constructor shown below:
Ans  :  FileOutputStream( File f )

Ques : Which of the following methods should be invoked by the container to get a bean back to its working state?
Ans  : EJBActivate()

Ques :  Select all true statements:
Ans  : An abstract class can have non-abstract methods.

Ques :  Which option could be used to see additional warnings about code that mixes legacy code with code that uses generics?
Ans  :  -Xlint:unchecked

Ques : Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how can the request parameter in that servlet be retrieved?
Ans  :  String value=req.getParameter("product");

Ques : Which of these is not an event listener adapter defined in the java.awt.event package?
Ans  : ActionAdapter

Ques : What would be the result of compiling and running the following code class?

public class Test {

 public static void main(String args[]) {

  Test t = new Test();
  t.start();
 }

 public void start() {

  int i = 2;
  int j = 3;
  int x = i & j;
  System.out.println(x);
 }
}
Ans  :  The code will compile and print 2.

Ques : Which of the following are the methods of the Thread class?
Ans  :  yield()

Ques :  What protocol is used by the DatagramSocket class?
Ans  : UDP

Ques : Which statements are true? Select all true statements.
Ans  : A method can be declared synchronized.

Ques : Which exception must a setter of a constrained JavaBean property throw to prevent the property value from changing?
Ans  :  PropertyVetoException

Ques : What will be the output when this code is compiled and run?
public class Test {

    public Test() {

        Bar b = new Bar();
        Bar b1 = new Bar();
        update(b);
        update(b1);
        b1 = b;
        update(b);
        update(b1);
    }

    private void update(Bar bar) {

        bar.x = 20;
        System.out.println(bar.x);
    }

    public static void main(String args[]) {

        new Test();
    }

    private class Bar {

        int x = 10;
    }
}
Ans  : 20 20 20 20

Ques :  Which of the following methods can be used for reporting a warning on a Connection object, Statement object & ResultSet object?
Ans  : getWarnings()

Ques : Which of the following are valid ways to define a thread in Java?
Ans  :  Create a subclass of java.lang.Thread class

Ques : JDBC is based on:
Ans  : X/Open CLI (Call Level Interface)

Ques : Which of the following statements regarding abstract classes are true?
Ans  :  The abstract class may have method implementation.

Ques :  Which of the following is the name of the cookie used by Servlet Containers to maintain session information?
Ans  : JSESSIONID

Ques : Which method is called by the servlet container just after the servlet is removed from service?
Ans  : public void destroy() {// code...}

Ques : The transaction attribute of a bean is set to 'TX_REQUIRES_NEW.' What can be inferred about its behavior?
Ans  : The bean manages its own transaction.

Ques : What is the output of the given program?

public class Test106 {
        public static void main(String[] args) {
                Integer x = 0;
                Integer y = 0;
                Integer a = 1000;
                Integer b = 1000;
                System.out.println( (a==b) + "; " + (x==y) );
        }
}
Ans  :  false; true

Which of the following is the correct way to complete the code snippet above?
Ques : Which of the following transaction modes are supported by Enterprise Java Beans?
Ans  : All of the above

Ques :What is the output of the given program?

public class Test120 extends _Test120 {
        {
                System.out.print("_INIT");
        }
        static {
                System.out.print("_STATIC");
        }
        Test120() {
                System.out.print("_CONST");
        }
        public static void main(String[] args) {
                System.out.print("_MAIN");
                new Test120();
        }
}
class _Test120 {
        {
                System.out.print("_BIN");
        }
        static {
                System.out.print("_START");
        }
        _Test120() {
                System.out.print("_BASE");
        }
}
Ans  : _START_STATIC_MAIN_BIN_BASE_INIT_CONST

Ques :  Which distributed object technology is most appropriate for systems that consist entirely of Java objects?
Ans  : RMI

Ques : The following code was written to save a handle to an EJBObject named 'bookEJBObject' for an online book shop:

javax.ejb.Handle bookHandle = _____________;

ObjectOutputStream stream = new ObjectOutputStream(newFileOutputStream(fileName));
stream.writeObject(bookHandle);
stream.close();

Which of the following methods should be filled in the blank?
Ans  : bookEJBObject.getHandle()

Ques : Which sequence will be printed when the following program is run?

import java.util.*;

public class Test {

 public static void main(String str[]) {

  List l = new ArrayList();
  l.add(''1'');
  l.add(''2'');
  l.add(1,''3'');
  System.out.println(l);
 }
}
Ans  : [1, 3, 2]

Ques : Which of the following JDBC methods is used to retrieve large binary objects?
Ans  : getBinaryStream()

Ques : What is the output of the given program?

public class Test129 {
        public static void main(String[] args) {
                A a = new A2();
                B b = new B2();
                System.out.println(a.a + "" + b.b);
        }
}
class A { int a = 1; }
class A2 extends A { int a = 2; }
class B { public int b = 1; }
class B2 extends B { public int b = 2; }
Ans  :  11

Ques : hat exception is thrown by this code, if arr[j]>arr[j+1]:

public static  void main(String[] args) {
    int []arr={12,23,43,34,3,6,7,1,9,6};
        {
              int temp;
              for (int i=0;i
              {
                for (int j=0;j
                {
                  if (arr[j]>arr[j+1])
                 {
                     temp=arr[j];
                     arr[j+1]=arr[j];
                     arr[j+1]=temp;
                  }
                }
              }
            }
        for(int i=0; i
         {
             System.out.print(arr[i] + " ");
         }
    }
Ans  : ArrayIndexOutOfBoundException

Ques : What is the output of the given console application?

public class Test31 {
        public static void main(String[] args) {
                test();
        }
        public static void test() {
                try {
                        System.out.print("-try");
                        return;
                } catch (Exception e) {
                        System.out.print("-catch");
                } finally {
                        System.out.print("-finally");
                }
        }
}
Ans  :  -try-finally

Ques : Which of these interfaces are used by implementations of models for JTable?
Ans  : TableModel

Ques : Which of the following require explicit try/catch exception handling by the programmer?
Ans  :  Attempting to open a network socket

Ques :  Which of the following statements is true of the HashMap class?
Ans  :  It stores information as key/value pairs.

Ques : Which distributed object technology is most appropriate for systems that consist of objects written in different languages and that execute on different operating system platforms?
Ans  :   CORBA

Ques : What is the output of the given code?

public class Test15 {
        public static void main(String[] args) {
                VO a = new VO(2);
                VO b = new VO(3);
                swapONE(a, b);
                print(a, b);
                swapTWO(a, b);
                print(a, b);
        }

        private static void print(VO a, VO b) {
                System.out.print(a.toString() + b.toString());
        }

        public static void swapONE(VO a, VO b) {
                VO tmp = a;
                a = b;
                b = tmp;
        }
        public static void swapTWO(VO a, VO b) {
                int tmp = a.x;
                a.x = b.x;
                b.x = tmp;
        }
}

class VO {
        public int x;
        public VO(int x) {
                this.x = x;
        }
        public String toString() {
                return String.valueOf(x);
        }    
}
Ans  : 2332

Ques : What would happen on trying to compile and run the following code?

class House {

 public final void MaintainMethod() {
  System.out.println("MaintainMethod");
 }
}

public class Building extends House {

 public static void main(String argv[]) {
  House h = new House();
  h.MaintainMethod();
 }
}
Ans  : Successful compilation and output of "MaintainMethod" at run time.

Ques :  Which of the following code snippets will generate five random numbers between 0 and 200?
Ans  : Random r = new Random(); for (int i = 0; i < 5; i++) { System.out.println(r.nextInt(200)); }

Ques : What will be the output when this code is compiled and run?

public class Test {

 public Test() {

  Bar b = new Bar();
  Bar b1 = new Bar();
  update(b);
  update(b1);
  b1 = b;
  update(b);
  update(b1);
 }

 private void update(Bar bar) {

  bar.x = 20;
  System.out.println(bar.x);
 }

 public static void main(String args[]) {

  new Test();
 }

 private class Bar {

  int x = 10;
 }
}
Ans  : 20 20 20 20

Ques : Which class contains a method to create a directory?
Ans  : File

Ques : What is the output of the given program?

public class Test130 {
        public static void main(String[] args) {
                A a = new A2();
                B b = new B2();
                System.out.println(a.a + """" + b.b());
        }
}
class A {
        public int a = 1;
}
class A2 extends A {
        public int a = 2;
}
class B {
        public int b() { return 1; }
}
class B2 extends B {
        public int b() { return 2; }
}
Ans  : 12

Ques : Select all correct statements:
Ans  : Vector is synchronized, ArrayList is not synchronized

Ques : Which of the following is false?
Ans  : A while loop can be used because next () & previous () methods return -1 beyond the resultset.

Ques : Consider the following code:

public class Jam {

    public void apple(int i, String s) {
    }

    //ABC

}

Choose possible valid code replacements of "//ABC" among the choices:
Ans  :  public void apple(String s, int i) {}

Ques :  RMI allows remote communication between:
Ans  :  Java and Java

Ques : As part of the type erasure process, when compiling a class or interface that extends a parameterized class or implements a parameterized interface, the compiler may need to create a synthetic method, called a _________.
Ans  :  bridge method

Ques :  What will be the output of the following code?
public class MyTest {

    public static void main(String[] args) {
        for (int i=0; i > 10; i+=2) {
            System.out.println(i);
        }
    }
}

Ans  : Nothing will be printed


Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techtunes, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab