Java Programming Questions and Answers Set 21

Java Programming OOPs

Questions 201 to 210



201.
Every event object has the ________ method.
(a)
getSource()
(b)
getActionCommand()
(c)
getTimeStamp()
(d)
getWhen()
(e)
getKeyChar().
202.
Analyze the following code:
public class Test {
   public static void main(String[] args) {
     String s = new String("Welcome to Java");
     Object o = s;
     String d = (String)o;
   }
}
(a)
When assigning s to o in Object o = s, a new object is created
(b)
When casting o to s in String d = (String)o, a new object is created
(c)
When casting o to s in String d = (String)o, the contents of o is changed
(d)
s, o, and d reference the same String object
(e)
s,o,and d doesnot reference the same String object.
203.
Analyze the following code:
public class Test {
   int x;
   { x++; }
}
(a)
The program cannot be compiled, because the statement x++ must be placed inside a method or a constructor
(b)
You cannot construct an instance of Test, because it does not have a constructor
(c)
When you construct an instance of Test, the value of x becomes 0;
(d)
When you construct an instance of Test, the value of x becomes 1;
(e)
When you contruct an instance of Test the value of x become -1.
204.
The code causes Java to throw
int number = Integer.MAX_VALUE + 1;
(a)
RuntimeException
(b)
Exception
(c)
Error
(d)
Throwable.
(e)
No exceptions.
205.
After Analyzing the following code, which statement is appropriate?
class Test {
   public static void main(String[] args)
     throws MyException {
     System.out.println("Welcome to Java");
   }
}

class MyException extends Error {
}
(a)
You should not declare a class that extends Error, because Error raises a fatal error that terminates the program
(b)
You cannot declare an exception in the main method
(c)
You declared an exception in the main method, but you did not throw it

(d)
The program has a compilation error
(e)
You can declare a class that extends error.
206.
What is the output for y?
int y = 0;
for (int i = 0; i<10; ++i) {
   y += i;
}
System.out.println(y);
(a)
10
(b)
11
(c)
12
(d)
13
(e)
45.
207.
What will be the value of i for the following loop?
int y = 0;
for (int i = 0; i<10; ++i) {
   y += i;
}
(a)
  9
(b)
10
(c)
11
(d)
12
(e)
Undefined.
208.
Which of the following provides the naming services for the server to register the object and for the client to locate the object?
(a)
Server object interface
(b)
Server implementation
(c)
RMI Registry
(d)
Server stub
(e)
Server Skeleton.
209.
Which of the following statement is not defined in the Object class?
(a)
sleep(long milliseconds)
(b)
wait()
(c)
notify()
(d)
notifyAll()
(e)
toString().
210.
Which of the following method is a static in java.lang.Thread?
(a)
run()
(b)
sleep(long)
(c)
start()
(d)
join()
(e)
setPriority(int).

Answers


201.
Answer : (a)
Reason:  Every event object is a subclass of EventObject, which contains the getSource() method.
202.
Answer : (d)
Reason:  Casting object reference variable does not affect the contents of the object.
203.
Answer : (d)
Reason:  x++ is in an initialization block. It is invoked when any constructor of the class is invoked.
204.
Answer : (e)
Reason:  At present, Java does not throw integer overflow exceptions. The future version of Java may fix this problem to throw an over flow exception.
205.
Answer : (a)
Reason:  When an exception of Error type occurs, your program would terminate. Therefore, you should not declare an exception that extends Error.
206.
Answer : (e)
Reason:  Your answer D is incorrect
y should be 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45
207.
Answer : (e)
Reason:  The scope of i is inside the loop. After the loop, i is not defined.
208.
Answer : (c)
Reason:  The RMI registry provides the naming services for the server to register the object and for the client to locate the object.
209.
Answer : (a)
Reason:  Remaining other statements are defined in the object class.
210.
Answer : (b)
Reason:  B is the apt choice.


<< Prev   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22  

 23   24   25   26   27   28   29   30  Next >>


52 comments :

  1. I was researching on different was of How to Write a Personal Experience Essay Effectively before I landed on this page and have found good articles that have been written with not only excellent writing skills but also good grammar. I will be applying the same skills when writing my personal experience essay. Thanks for sharing this post with us.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. 2. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Regards,
    java training in Chennai|| j2ee training in Chennai

    ReplyDelete
  4. Install full MICROSOFT office setup 365 with our support. Now setting up your account will be a cakewalk with us.
    Setup and Install Office 2017/2018 365 on your Mac/PC with genuine OFFICE PRODUCT key.
    Word, Excel, PowerPoint, Outlook, OneNote and OneDrive, on your PC,Publisher and Access.Everything you need for home, education and work.
    We are providing independent support service if in case you face problem to activate or SETUP OFFICE product.
    Regards- www.office.com/setup

    ReplyDelete
  5. Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked.Please also seek advice from my site.
    Visit Here:www.office.com/setup

    ReplyDelete
  6. If you want to Fastest Car In The World. you can visit listforever.com here you will get Top 30 Fastest Cars In The World | Pictures, Price and Specifications.

    ReplyDelete
  7. Best Kukri is a classic Nepalese knife on outdoor survival knife as a must-have utility item. Nowadays we see this knife is used as a multi-purpose machete; it comes from Nepal’s Gurkha soldiers. Moreover, it’s a curved blade which is thick enough along with great sharpness.

    ReplyDelete
  8. if you want to know Fastest Trains in the World. you can visit listforever.com here you will get Top 12 Fastest Trains in the World | Pictures, Price and Specifications

    ReplyDelete
  9. I just want to mention I am just very new to blogging and actually enjoyed your web page. Almost certainly I’m want to bookmark your site . You definitely have awesome articles. Appreciate it for revealing your website.
    Do you know about How to make potato vodka? Visit Our Website CelebrityPing

    ReplyDelete
  10. Hi, the post which you have provided is fantastic, I really enjoyed reading your post, and hope to read more. thank you so much for sharing this informative blog.
    Office.com/setup

    ReplyDelete
  11. Thank you so much for this wonderful Post and all the best for your future. I hope to see more post from you. I am satisfied with the arrangement of your post. You are really a talented person I have ever seen.
    mcafee.com/activate

    ReplyDelete
  12. office.com/setup : Developed by Microsoft, MS-Office is a popular productivity suite that is being used by millions of consumers and businesses across the world. It comprises several applications such as PowerPoint, Excel, Visio, Word, and Access. You can choose its trial version that is free for 30 days or download the paid version from office setup. All you need to do is to enter a valid product key at office.com/setup.
    norton.com/setup ,
    norton.com/nu16

    ReplyDelete
  13. Shadow Creation is the process to change the color of an image or video..Shadow Creation It means correcting the lighting, white color balance, red or blue color balance, so that the image looks more clear or natural

    ReplyDelete


  14. Microsoft Office 365 including the complete system of downloading, presenting and start MS Office 365 on the web.
    office.com/setup

    ReplyDelete
  15. I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such blog.

    norton.com/setup

    www.spectrum.net/login

    aolmail.com

    kaspersky activation

    ReplyDelete
  16. Learn about working at office.com/setup. Join LinkedIn today for free. See who you know at Office Setup, leverage your professional network, and get hired.

    ReplyDelete
  17. good style , quality content and well describe . I really happy about this article
    Matka boss otg

    ReplyDelete
  18. This is a very interesting article, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your fantastic post.
    McAfee Activate

    ReplyDelete
  19. Its really helpful for me, awaiting for more new post. Keep Blogging!Brother HL-L2390DW Driver

    ReplyDelete
  20. Whenever you are facing trouble with your Roku Device, and it is displaying the Roku Error Code 005. You can try to change the protocol to access the Roku device. This might not be a fault of your device, but rather your internet connection or wireless router.

    ReplyDelete
  21. You will find all typical issues that occur in HP printers from time to time and also learn the correct ways to fix such problems effectively. In this HP Printer Troubleshooting guide. HP Printer Troubleshooting for paper jam related concerns is an easy task with experienced professionals.

    ReplyDelete
  22. Hulu offers a video streaming service in the Hulu app. You can watch favorite movies and TV shows on the Hulu channel. Everything you need to enter your Hulu account email address and password. It may ask you to set up Hulu com at hulu.com/activate, www.hulu.com/activate, hulu activate, hulu activation code.
    hulu.com/activate, www.hulu.com/activate, hulu activate, hulu activation code

    Go to Office.com/Setup website www.office.com/setup us Sign In to your Microsoft Account Or Create a new Account. Enter your Product key Nonprofits can no longer download Microsoft Office products directly through the VLSC. Here's how nonprofits can download these products

    Go to Office.com/Setup website www.office.com/setup us Sign In to your Microsoft Account Or Create a new Account. Enter your Product key Nonprofits can no longer download Microsoft Office products directly through the VLSC. Here's how nonprofits can download these products

    ReplyDelete
  23. Working on the pc sometimes might get boring. To get rid of the boredom one can play games like solitaire, but rarely the Microsoft solitaire won’t open in the computer this is the place where you can get help by visiting our website.

    ReplyDelete
  24. Go for the best services and devices to help yourself. Talk to the customer care executives with the free spirit if some kinds of issues stop you to make the necessary decisions.
    netgear router setup without modem
    netgear router not login
    netgear couter customer service number

    ReplyDelete
  25. For useful and effective instructions on how to hook up roku, complete the instructions given in the section that follows.

    ReplyDelete
  26. www.mcafee.com/activate:Visit and complete your activation process. Enter the 25-digit activation key on mcafee.com/activate.

    ReplyDelete
  27. Activate your amazon prime in simple step follow the amazon website offical www.amazon.com/mytv or primevideo.com/mytv to activate your amazon prime in your device.
    www.primevideo.com/mytv primevideo.com mytv primevideo mytv primevideo Enter mytv code

    ReplyDelete
  28. Primevideo.com/mytv – Learn how to enroll and initiate another gadget on amazon prime to watch motion pictures and arrangement utilizing amazon myTV code from primevideo.com/mytv. You are at the correct spot. You simply need to get the amazon prime membership from Primevideo.com/myTV and use the Amazon Prime Video application on TV to begin watching films and web shows.
    Read more…

    ReplyDelete
  29. Best method to create your primevideo mytv account through the activation process by primevideo enter code. You need to follow the instructions to activate www.amazon.com login mytv. If you are viewing Amazon Prime Video on your device go to amazon.com enter code.

    ReplyDelete
  30. The way you explained great critical topics in amazing ways. Every step is so helpful for even the person who is no so tech-savvy. This is really helpful for beginners like me. Thank you so much. Keep on posting such a high weighted topic.
    Charli D Amelio Net Worth

    ReplyDelete
  31. PayPal is the faster and more advanced way to make online payments. It enables its users to pay for their online purchases or make other transactions without any hassle of converting the currency.
    paypal log in |
    paypal sign in |

    ReplyDelete
  32. After you have successfully signed in, you will receive a code on the Roku channel. Log in to Roku to receive a code.
    primevideo/mytv enter code
    amazon/mytv
    paypal login
    www.amazon.com/mytv enter code
    amazon.com/code

    ReplyDelete
  33. The world has enjoyed their Prime membership on larger-screens. www.amazon.com/mytv has made it easy. MyTV App registration is your best option for streaming all of the Amazon Prime shows to your Smart TVs. The above article will solve all your registration, login, verification problems. Now all you have to do is put on your comfy clothes and enjoy the theatre-like experience at home. Log in with your Amazon Prime Login account to access all your favorite web series and original web shows on your smart television.
    www.amazon.com/mytv
    primevideo/mytv enter code
    www.amazon.com/code
    amazon/mytv
    paypal login

    ReplyDelete
  34. Amazon is one the largest multinational companies worldwide that contributes to technological advancements and makes people's lives easier. Amazon is not only the largest online retailer, but it has also been recognized as a leader in multinational technology around the world. Amazon offers a wide range of technological devices including the Echo Dot and Fire TV, as well as Cloud Cam, Kindle, Fire TV, Fire TV, and Fire TV. It also offers entertainment services such as Prime Video, Music Unlimited and Amazon Digital Game Store.
    www.amazon.com/code
    roku.com/link
    tubi.tv/activate
    espn.com/activate
    target.com/checkbalance

    ReplyDelete
  35. this question may come back to your mind once you come upon a “Yahoo mail not working” issue. At times, once the Yahoo mail server is down you'll not be ready to use your Yahoo account.

    ReplyDelete
  36. You can simply visit Amazon.com/mytv to link your Amazon Prime Video account to your streaming device.
    Primevideo/mytv
    Primevideo/mytv
    amazon.co.uk/mytv
    amazon.co.uk/mytv
    amazon.co.uk/mytv

    ReplyDelete
  37. Sign-in to your Roku with your Amazon username, password, or a code that you have received from Amazon. You will receive a code to enter when you register on Amazon.Amazon.com/mytv. The code will be automatically entered by the Roku channel to log you in to your account.
    amazon.co.uk/mytv
    amazon.co.uk/mytv
    amazon.co.uk/redeem
    amazon.com/mytv
    www.Amazon.com/mytv

    ReplyDelete
  38. If the gmail keeps crashing on your android device, there ar a number of of troubleshooting tips which can act like your knight in shining armor.

    ReplyDelete
  39. This comment has been removed by the author.

    ReplyDelete
  40. This comment has been removed by the author.

    ReplyDelete
  41. This comment has been removed by the author.

    ReplyDelete
  42. As you are switching to a more recent TV service, you would possibly don’t understand tons about FuboTV. So, we are right here to assist you with that. FuboTV is an choice to cable or satellite tv for pc offerings the place rather of having any of these, you can work with your net connection. With a FuboTV like minded device, or your smartphone or computer, you can get entry to the offerings through subscribing to FuboTV with fubotv/activate enter code. fubo.tv/Activate enter code

    ReplyDelete
  43. You will first have to sign in and connect your device to further fubo.tv/activate your services. After you have created the account, you can download the application on your streaming device. You can even login with fubo.tv/connect enter code later if you forget your email id or password. fubo tv connect code

    ReplyDelete
  44. Obrigado por este site. Eu aprecio seu trabalho. muito bom eu tenho um site que muda sua fonte no Insta, Facebook, Snapchat, e outras redes sociais se você quiser mudar seu nome de usuário Visite Letras

    ReplyDelete
  45. You can verify the balance of your American Express gift card balance on the internet or via an toll-free call. Make sure you know the process of checking your Available Balancepaypal login
    primevideo/mytv
    amazon co uk code
    amazon.com/code
    primevideo/mytv

    ReplyDelete
  46. The Amex gift Card is a pre-paid payment card that is loaded with a predetermined US value in dollars. It is able to be used at any online shop within the US that accepts Amex
    amazon/mytv
    amazon.com/code
    coinbase login
    amazon/mytv
    amazon/code

    ReplyDelete
  47. JAVA PROGRAMMING QUESTIONS AND ANSWERS SET 21 it seems to be best questions set you an also visit us for a new best emulator,An Android emulator pokemon white 2 cheats is a software application that allows your mobile to imitate Android OS features into your PC. It allows you to install Android Apps on your computer or laptop and use them natively by clicking desmume emulator pc

    ReplyDelete