Top 20 Objective Questions On Applets In Java

Here are the collection of objective questions on Applets in Java which includes definition of applets, the applet class, uses of applets in HTML, life cycle of an applet and the graphics class in Java Applet. It also includes MCQ of components, containers and layout managers in java applets, update( ), paint( ) and repaint( ) methods used in Java applets. 

1. When the ................... method of the Applet class is called, it displays the result of the Applet code on the screen.
A) paint( )
B) repaint( )
C) update( )
D) reupdate( )

2. Before we try to write applets, we must make sure that Java is installed properly and also ensure that either the java is installed properly and also ensure that either the java ................. or a java-enabled browser is available.
A) viewer( )
B) appletviewer( )
C) appletrunner( )
D) browserviewer( )

3. Arrange the steps involved in developing and testing the applet in correct order.
i) creating an executable applet (.classfile)
ii) preparing <APPLET> tag
iii) creating HTML file
iv) building an applet code (.java file)
v)  testing the applet code
A) 1-i, 2-ii, 3-iii, 4-iv, 5-v
B) 1-ii, 2-iii, 3-iv, 4-v, 5-i
C) 1-iv, 2-i, 3-ii, 4-iii, 5-v
D) 1-iii, 2-iv, 3-v, 4-i, 5-ii

4. State whether the following statements about the Applets are True or False.
i) Applets can communicate with other services on the network.
ii) Applets cannot run any program from the local computer.
A) True, False
B) False, True
C) True, True
D) False, False

5. Applet class is a subclass of the panel class, which is again a subclass of the ....................... class.
A) object
B) component
C) awt
D) container

6. The ..................... method called the first time an applet is loaded into the memory of a computer.
A) init( )
B) start( )
C) stop( )
D) destroy( )

7. The ........................... method is called every time the applet receives focus as a result of scrolling in the active window.
A) init( )
B) start( )
C) stop( )
D) destroy( )

8. Which of the following applet tags is legal to embed an applet class named Test into a webpage?
A) <applet class=Test width=200 height=100>
B) <applet>
code=Test.class width=200 height=100>
C) <applet
code=Test.class width=200 height=100>
D) <applet
param=Test.class width=200 height=100>

9. If you want to assign a value of 88 to the variable year, then which of the following lines can be used within an <applet> tag.
A) number = getParameter(88)
B) <number=99>
C) <param = radius value=88>
D) <param name=number value=88>

10. The ...................... class is an abstract class that represents the display area of the applet.
A) display
B) graphics
C) text
D) area

Read More »

Top 20 MCQ Questions On Streams In Java

This set of multiple choice questions on streams in java includes collection of MCQ questions on the methods used in InputStream, MarkableStream and OutputStream class in Java. It also includes objective questions on the methods of file input stream and fileOutputStream, ButteredInputStream and BufferedOutputStream, DataInputStream and DataOutputStream along with Reader and Writers classes. You will also find MCQs about RandomAccessFile, StreamTokenizer and other stream classes like object streams, piped streams, pushback streams and filtered streams. 

1. The ........................ package contains a large number of stream classes that provide capabilities for processing all types of data.
A) java.awt
C) java.util

2. State whether the following statements about the stream in Java.
i) The two basic streams used are the input and the output streams.
ii) Filters are used to read data from one stream and write it to another stream.
A) True, True
B) True, False
C) False, True
D) False, False

3. The InputStream class defines methods for performing input functions such as
i) reading bytes                                  ii) closing streams
iii) skipping ahead in a stream          iv) flushing streams
A) ii, iii and iv only
B) i, ii and iii only
C) i, iii and iv only
D) All i, ii, iii and iv

4. The OutputStreams includes methods that are designed to perform  the following tasks.
i) closing streams                        ii) flushing streams
iii) reading bytes                         iv) writing bytes
A) ii, iii and iv only
B) i, ii and iii only
C) i, ii and iv only
D) All i, ii, iii and iv

5. Which of the following method(s) not included in InputStream class.
A) available( )
B) reset( )
C) flush( )
D) close( )

6. Which of the following methods not included in OutputStream class.
A) write( )
B) skip( )
C) close( )
D) flush( )

7. The class DataInputStream extends .......................... and implements the interface DataInput.
A) FileInputStream
B) SequenceInputStream
C) FilterInputStream
D) InputStream

8. The method ......................, force writes whenever the data accumulates in the output stream.
A) write( )
B) flush( )
C) read( )
D) reset( )

9. The DataInputStream and DataOutputStream classes are .......................... streams that allow the reading and writing of java primitive data types.
A) file
B) sequence
C) object
D) filter

10. The ........................... class provides the capacity to read primitive data types from an input stream.
A) pushbackInputStream
B) DataInputStream
C) BufferedInputStream
D) PipeInputStream

Read More »

MCQ On Inheritance, Package And Interface In Java

Here are the collections of multiple choice questions on implementing inheritance in java, defining packages and interfaces. You will find here MCQ questions on three types of access specifiers and the final keyword . It also includes about creating package, adding more classes to a package and accessing the contents of a package. 

1. ..................... is one of the cornerstones of object-oriented programming because it allows the creation of hierarchical classifications.
A) Mutual Exclusion
B) Inheritance
C) Package
D) Interface

2. .................... helps to extend the functionality of an existing by adding more methods to the subclass.
A) Mutual Exclusion
B) Inheritance
C) Package
D) Interface

3. The variables, methods and inner classes that are declared ..................... are accessible to the sub-classes of the class in which they are declared.
A) private
B) public
C) protected
D) friend

4. State whether the following statements about the advantages of organizing classes into packages are True or False.
i) Two classes in two different packages can not have the same name.
ii) The classes contained in the packages of other programs can be easily reused.
A) True, False
B) False, True
C) True, True
D) False, False

5. ....................... package in java contents language utility classes such as vectors, hash tables, random numbers date etc.
A) java.util
B) java.awt
D) java.lang

6. .......................... package in java contents set of classes for implementing graphical user interface, which includes classes for windows, buttons, lists, menus and so on.
A) java.util
B) java.awt
D) java.lang

7. State whether the following statements are True or False.
i) When present, package must be the first non-comment statement in the file. 
ii) When we implement an interface method, it should be declared as public.
A) True, False
B) False, True
C) True, True
D) False, False

8. Which keyword can protect a class in a package from accessibility by the classes outside the package.
i) private              ii) protected                 iii) final
A) i only
B) ii only
C) iii only
D) None of the above

9. A package is a collection of
A) Classes
B) interfaces
C) editing tools
D) classes and interfaces

10. Package P1 contains the following code
package P1;
public class student {Body of Student}
Class Test {Body of Test}
Now consider the following code;
import P1.*;
Class Result{
student S1;
Test t1;
This code compile because
A) Class result should be declared public.
B) Student class is not available
C) Test class is not available
D) Result body is not fully defined

Read More »

Top 20 MCQ Questions On Strings And Vectors In Java

This set of multiple choice question includes collection of top 20 MCQ questions on most commonly used string methods in Java, commonly used StringBuffer methods, vector class and wrapper classes. It also includes MCQs on different methods of wrapper classes like constructor methods, typeValue() method, String() method, valueOf() method and parsing method along with enumerated types, annotations, auto boxing and unboxing features in Java.

1. What is the output of the following code?
     String S;
     System.Out.println("S =  "+S);
A) null
B) error
C) = S
D) S =

2. Which of the following are the wrapper classes?
i) Random           ii) Byte                iii) Vector            
iv) Integer           v) Short
A) i, ii and iv only
B) ii, iii and v only
C) ii, iv and v only
D) i, ii and iii only

3. Given the code
String S1="yes"
String S2="yes"
String S3=new String(S1);
Which of the following would equal to True?
i) S1 = = S2                ii) S1 = S2
iii) S3 = = S1             iv) S1.equals(S2)
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iv only

4. Which of the following method call returns negative if S1<S2, positive if S1>S2 and zero if S1 is equal to S2.
A) S2.compareTo(S1)
B) S1.compareTo(S2)
C) compare S1 To S2

5. The method .................................. sets the length of the string S1 to n. If n<S1.length() S1 is truncated. If n>S1.length() zeros are added to S1.
A) S1.setLength(n)
B) S1.AddLength(n)
C) S1.LengthAdd(n)
D) S1.Append(n)

6. Java compiler provides restrictions to perform which of the following conversions.
i) Convert from null type to any primitive type
ii) Convert to the null type other than the identify conversion.
iii) Convert from any class type C to any array type if C is not object.
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

7. We can use .......................... feature to convert primitive data types to wrapper class types automatically.
A) auto boxing
B) unboxing
C) annotations
D) Both A and B

8. Which of the following is/are the advantages over arrays.
i) It is convenient to use vectors to store objects
ii) A vector can be used to store a list of objects that may vary in size
iii) We can add and delete objects from the list as and when required
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

9. Primitive data types may be converted into object types by using the contained in the java.lang types by using the ..................... contained in the java.lang package.
A) parsing methods
B) wrapper classes
C) constructor methods
D) abstract classes

10. You can convert sting objects to numeric objects using the static method .................
A) String()
B) valueOf()
C) typeValue()
D) getValue()

Read More »

Top 20 MCQ Questions On Arrays And Strings In Java

Here are the collections of top 20 multiple choice questions on Arrays and Strings in Java, which includes MCQ questions on different types of arrays like one dimensional arrays and two dimensional arrays, declaring the array, creating memory locations and putting values into the memory locations. It also includes MCQs on different types of string methods like toSting(), ValueOf(), CharAt(), getChars(), getBytes(), toCharArray(), indexOf() and lastindexOf().

1. Which of the following declaration of the array contains error?

A) int x[ ]= int[10];
B) int [ ] y=new int[5];
C) float d[ ]= {1,2,3};
D) int a[ ] = {1, 2,3; int b[ ]; b=a;

2. What will be the content of array variable table after executing the following code?

A) 0    0    0                          B)  1    0    0
     0    0    0                                1    1    0
     0    0    0                                1    1    1

C) 0    0    1                         D)  1    0    0
     0    1    0                               0    1    0
     1    0    0                               0    0    1

3. Consider the following code.
 int number[ ]=new int[5];
After execution of this statement which of the following are true.
i) number [0] is undefined       ii) number[5] is undefined
iii) number [4] is null              iv) number.length() is 5
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iv only

4. There is a companion class to string called ......................., whose objects contain strings that can be modified after they are created.
A) stringBuffer
B) stringClass
C) toString( )
D) stringChar

5. Which of the following classes are available in the java.lang package?
i) Stack                                 ii) Object
iii) Math                              iv) Random
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iv only

6. Consider the following code,
string s=new String(); will create an instance of string with
A) at least one character
B) a default character
C) no characters in it
D) number of characters in it

7. ...................... returns a sting that contains the human-readable equivalent of the value with which it is called.
A) toValue()
B) value()
C) valueOf()
D) getValue()

8. ........................ method simply return a string that appropriately describes an object of your class.
A) getChars()
B) toString()
C) toCharArray()
D) getString()

9. To extract a single character from a sting, you can refer directly to an individual character via the ........................ method.
A) charAt()
B) getChars()
C) getCharAt()
D) getAt()

10. If you need to extract more than one character at a time, you can use the ............................... .
A) getBytes()
B) charAt()
C) getChars()
D) getString()

Read More »

MCQ Questions On Control Flow Statements In Java

This set of multiple choice question includes objective questions on control flow statements which are used to control the flow of execution in a program. It includes MCQ question from decision making statements like if-else and switch statements, looping statements like for loop, while loop and do-while loop along with other statements like break, continue and label statements.

1. .......................... statement provides an easy way to dispatch execution to different parts of your code based on the value of an expression.
A) if-else
B) switch
C) if
D) while

2. State whether the following statements about switch statement are correct.
i) Switch statement often provides a better alternative than a large series of if-else-if statements.
ii)The break statement is used inside the switch to terminate a statement sequence.
A) True, False
B) False, True
C) True, True
D) False, False

3. The conditional statement, ................... can only test for equality, whereas ...................  can evaluate any type of Boolean expression.
A) if, switch
B) switch, if
C) while, if
D) if, while

4. What will be the output of the following code snippet?
int a=15;
int b=25;
if ((a<b) || (a=5)>15)
A) Error
B) 15
C) 25
D) No output

5. What will be the output of the following code.
int x, y;
x=15; y=20;
if (x>15)
           system.ptintln("y is  "+y);
         system.out.ptintln("x is "+x);
A) Error
B) y is 20
C) x is 15
D) No output

6. In while and do-while loops, a ..................... statement causes control to be transferred  directly to the conditional  expression that controls the loop.
A) break
B) pause
C) start
D) continue

7. State whether the following statements about switch statement are True or False.
i) No two case constants in the same switch can have identical values.
ii) A switch statement is usually more efficient than a set of nested ifs.
A) True, False
B) False, True
C) True, True
D) False, False

8. State whether the following statements about conditional statements are True or False.
i) The break statement is required in the default case of a switch selection structure.
ii) A variable declared inside the for loop control cannot be reference outside the loop.
A) True, False
B) False, True
C) True, True
D) False, False

9. Which of the following control expressions are valid for an if statement?
A) an integer expression
B) a Boolean expression
C) either A or B
D) Neither A or B

10. In the following code snippet, which lines of code contain error?
1. int j=0;
2. while (j<10){
3. j++;
4. if (j==5) continue loop;
5. system.out.ptintln("j is " +j);}
A) Line 2
B) Line 3
C) Line 4
D) Line 5

Read More »

Top 20 Objective Questions On Operators In Java

Here are the collection of top 20 objective type multiple choice questions on different types of operators used in Java. It includes MCQ questions on arithmetic operators, relational operators, logical operators, assignment operators, increment decrements operators, conditional operators, bitwise operators, dot operator(.) and instance of operators. 

1. When the operator ++ is placed after the variable name, first assignment of the value of the variable takes place and then the value of the variable is incremented, this operation is also called ................................ .
A) pre increment
B) post increment
C) left to right increment
D) right to left increment

2. When the operators are having the same priority, they are evaluated from ................................ in the order they appear in the expression.
A) left to right
B) right to left
C) any of the above
D) none of the above

3. To change the order in which expressions are evaluated ...................... are placed around the expression that are to be evaluated first.
A) ampersand
B) equals
C) parentheses
D) greater than

4. What will be the result of the expression of 8|8.
A) 16
B) 1
C) 8
D) 64

5. What will be the values of x, y and z after execution of the following statements?
int x, y, z;
x=9, y=10;
A) z=21, x=11, y=11
B) z=20, x=10, y=11
C) z=21, x=11, y=10
D) z=20, x=10, y=10

6. If j and k are int type variables, what will be the result of the expression j%k when j=10 and k=3?
A) 0
B) 1
C) 2
D) 3

7. Which of the following operators are overloaded for string objects?
i) -                   ii) +                         iii) +=                   iv) &
A) i and ii only
B) ii and iii only
C) iii and iv only
D) ii, iii and iv only

8. When a=9, b=12 and c=3 what will be the value of x for the expression x=9-12/3+3*2-1
A) 10
B) 11
C) 7
D) 8

9. If int x=15; y=20; what will be the value of x after executing the following statement
x=(x<y) ? (y+x) : (y-x);
A) 5
B) 15
C) 25
D) 35

10. State  whether the following statement for evaluating the expression (x== y && a<b) are True or False.
i) The Boolean expression x==y is evaluated first and then a<b is evaluated.
ii) The expression (x==y && a<b) is true if either x==y is true or a<b is true.
A) True, False
B) False, True
C) False, False
D) True, True

Read More »

Local Ranking Factors That Can be Useful For Your Local Business' SEO

As a small business owner, you understand that running your own shop can be a struggle at times. How does a local coffee shop compete with coffee giants like Dunkin’ Donuts and Starbucks? How can a cafe rival Panera Bread and Corner Bakery?

Through grit, determination, and local SEO.

You have the grit and determination down pat, but local SEO? What’s that?

It’s a way to help current and potential customers to find information about you online—and then patronize your business.

The What and Why of Local SEO

SEO is “search engine optimization,” a practice that is meant to help grow your company’s visibility through organic (or non-paid) research. Local SEO focuses on optimize local search, meaning they focus only on ranking in the specific geographic area in which they conduct business. This type of internet marketing helps current and potential customers find information about local businesses online. Local SEO helps:
● Make sure your business details (name, address, phone number) are correct
● Build your client base through other customers’ reviews
● Provide current and potential customers convenience
● Push your business’ visibility ahead of competitors

Considering that about 64% of local customers utilize the Internet to find information about local businesses and 78% of online mobile searches result in a purchase offline, local SEO has become more important than ever.

Ranking Factors for Local SEO

Ranking ahead of other local competitors is going to take some work. Here are some of the top ways to make sure that you rank ahead of your competitors.

# 1. Utilize Online Local Directories

Directories like Yellow Pages, Whitepages, Superpages, and Dex Media are a great place to start. Make a list of online business directories that you want to optimize. This list will be long, as you want to target every possible listing site that a potential customer may visit. Once you have your list, go through each and make sure that your information is correct; if not, go through the information and update it. This information should be consistent across all platforms. If any information changes in the future, such as location or phone number, update it immediately.

# 2. Claim Your Pages Online

Search engines Google and Bing offer their own type of online directory by providing listings for almost any business. These pages—Google My Business and Bing Places—can help you rank high in local searches. Claim your page now so your listing is accurate when people search for your business or similar business. Benefits of these online listings include:
● Provide information about specials or in-store offers
● Add photos of menu, menu options, interior, and more
● Respond to customer reviews
● Gain insight into how customers look for your business

You’ll want to claim as many of these online listings as possible to target all current and potential customers no matter where (or how) they search.

# 3. Write Localized Headlines and Content

If you have a business website (and you should!), you’ll want to write localized headlines and content for each page. Writing localized headlines means you include the city and state in an article’s title. A coffee shop may have a headline that reads, “Cuppa Joe’s CafĂ© in San Bernardino, California.”

The same applies to your content: You’ll want to include at least one mention of your city and stop in proximity to your business name or details of your business (clothing boutique, coffee shop, spa). Don’t over-saturate your content by constantly referencing your business’s location. A handful of times will do.

Read More »

How To Install Apache And PHP On Windows Platform

PHP is a programming language that can be used to build powerful websites and web applications. A web server application is required to be installed on your computer in order to develop and run a PHP applications. In this tutorial, we are going to discuss about the methods of installing Apache server and PHP on your computer.

For installing Apache and PHP on your computer, you have to download their installation packages and installation manuals from their respective websites at first. I have already published an article with discussing about the methods of downloading and installing Apache server on windows platform, you can refer it from there.

After you have installed Apache server successfully on your computer, you can download required PHP distribution package from PHP website and install it on your computer. You can found three types of installation packages on the page of PHP for windows, which includes source package and windows zip package.With source package, you can compile from source for windows platform.

The windows installer version of PHP offers a convenient windows installer interface for installing and configuring PHP, which automatically configures the Apache, IIS, PWS and Xitami servers.In this tutorial, we will discuss in detail about downloading, installing and configuring PHP with windows zip package.

Downloading PHP Manual

All of the PHP projects offer truly explanatory documentation with covering every expect of the respective technology in detail. PHP documentation is available on online along with downloadable files on different formats in various languages, which are single HTML file (html.gz), many HTML file (tar.gz), HTML help file (chm) and HTML help files with user notes (chm).

Downloading PHP Package

You can download latest released version of PHP for windows from the page which are dedicated to supporting PHP on Microsoft windows. The installation packages are available either with source code or without source codes. The latest versions of PHP are available along with supporting for windows having 64 bits.

Read More »

How To Install Apache Server On Windows Platform

If you want to install Apache server for installing PHP and other web development platforms on your computer having windows operating system, you have to search and download the latest stable version of Apache from it's website or from any third parity websites at first.

You will find downloadable Apache server windows applications from At this page two types of installer files can be found one is "apache_x.x.xx-win32-x86-no_ssl.msi", which is a non SSL Apache installer and another is "apache_x.x.x-win32-x86-openssl-x.x.xx" called SSL Apache installer. Use the following steps for installing Apache server on windows platform after download completes.
1. Run the executable ".msi" file, which you have downloaded just earlier. You will see the following welcome screen, click on next to start the installation wizard.

2. On the next screen, you will see the license agreement documentation. After reading the license agreement carefully, select the option "I accept the terms in the license agreement" then go on next.

3. After accepting the license agreement, you have to fill-up some server information on the as given on the following screenshot. Give some network domain name and server name as given on the example, if you don't have, you can also write "localhost" on both fields. Write any email address on administrator email address field then select on the option for installing Apache HTTP server programs and shortcuts for All users, on port 80, as a service and go to the next wizard.

4. On the next wizard, you have to select setup type either Typical or custom according to your needs. On the "Typical" option most of the default program features will be installed without installing headers and libraries for compiling modules. The next option "Custom" will allows you to choose which program features you want installed and where they will be installed. I would recommend to select the Typical installation option at this time.
Read More »