What Is PDF Reader And What It Does

A PDF reader is a software that serves as an ultimate solution for people who want to read, edit or organize PDF files. A PDF reader can be used on various devices including a PC, smartphone or a tablet. There are many types of PDF readers that you can download from the internet and enjoy reading and editing PDF files.

What Does PDF Reader


That’s not all, PDF readers not only let you read and edit PDF files but you can do a lot more than that. PDF reader also allows you to create, merge, compress, split, manipulate, print and convert pdf files. The pdf reader software will do the following tasks as given below.
 Adobe Acrobat Reader

Read E-Books


A PDF reader’s speciality is eBook reading. People who love reading eBooks on devices have the luxury to do it using PDF readers. The reading experience that a PDF reader provides is something you won’t find on any other type of software.

When you have a PDF reader, you won’t have to buy an eBook reader separately because a PDF reader not only does all the tasks that a simple eBook reader does, but it can do more than that.

With a PDF reader, you can adjust the size of the font as you like, highlight quotes or your favorite sentences etc. Moreover, you can also leave comments on individual pages.

Different people love reading eBooks in different ways. Some want enhanced text while some want their page to fit on the entire screen so that they won’t have to adjust the page until they've read it whole. A PDF readers let’s you read in any way you like because its aim is to give you the best experience when it comes to reading eBooks.

Create, Convert, Edit And Organize Files


Almost every PDF reader lets you create new PDF files or edit existing ones. This is the reason why PDF readers are being used in the corporate world by employees to share, edit and create PDF files

Sometimes, employees are asked to make duplicate files on various platforms, such as the PDF format for security or usability purpose. In this case, PDF readers make it easy for employees by saving them the hassle of writing entire files in PDF format.
PDF readers give them the option to convert files of different extensions into PDF format without making any changes to the contents of the file. After doing so, you can edit those files if you like or keep them as they are for reading purpose.

Is A PDF Reader Secure?


Firstly, consider if PDF documents are secure. Well, according to reports they are among the most secure file types thanks to added layers of security.

When it comes to PDF readers‘ security, they are quite secured as well. Thanks to the password protected file option, you can put passwords on important files to control who can read those files and maintain security.

Some Examples Of PDF Readers


Here we have listed some pdf readers that helps you to read pdf e-books along with the functions of creating, editing and converting pdf files.

 Soda PDF Reader

Adobe Acrobat Reader

Adobe acrobat reader is the most popular pdf reader software developed by Adobe that lets you view create, manipulate, print and manage PDF files. This software is available for free to use on several platforms like desktop, mobile etc. 

Soda PDF

Soda pdf is another breakthrough software that lets you read, write and edit new files for absolutely free of cost. It can convert, edit and manage any pdf files on any platforms. 

Foxit Reader:

There is another most popular pdf reader called foxit reader, that allows you to create, edit, merge, compress, split and convert pdf files. It is available on free along with the premium product for business purpose.
Read More »

How To Start PHP With Basic Coding Scripts

In order to start coding with PHP, you have to install PHP and the web server on your computer at first. We have already discussed on the previous posts about the methods of installing Apache Server and PHP on your computer. Now we are going to discuss on how you can start writing basic coding scripts in order to display some dynamic data on the browser screen. In this tutorial you will learn about the basic syntax for writing PHP code along with the ways of using short code tags. You will also get some knowledge on different ways of writing comments and learn about the different statements like print( ), echo( ), printf( ) and sprintf( ) that can be used for displaying dynamic output to the browser. 

Basic Syntax for Writing PHP Code


Following are the basic syntax for writing PHP code in order to display data output on the browser.

Writing With Default Syntax

In the default syntax, every PHP code begins with <?php and concludes with ?>. Following are the syntax and the examples of writing basic PHP scripts.

Syntax: <?php ........... PHP code will be written here ........ ?>
Example:
<!DOCTYPE html>
<html>
<head>
<title>Basic Syntax for Writing PHP Code</title>
</head>
<body>
<h1>Basic Syntax for Writing PHP Code</h1>
<p>Writing With Default Syntax</p>
<?php
          echo "<p>Here is the sample output</p>";
?>
</body>
</html>
 Output: Copy the code given above and paste it on a text editor application i.e. Notepad then save it on the root directory of your web server where the "phpinfo.php" file is located. When you open the file from your browser as seen on the image below, you will see the following output on your browser. 

 Default Syntax for Writing PHP Code

Writing With Short Tags


There is another option also available who don't wants to type longer texts while coding, it is known as short-tags. It enables you to write codes without using default syntax. In order to use this feature, you have to enable PHP's short_open_tag directive at first.

Here is an example with sample codes written using short tags.
<!DOCTYPE html>
<html>
<head>
<title>Basic Syntax for Writing PHP Code</title>
</head>
<body>
<h1>Basic Syntax for Writing PHP Code</h1>
<p>Writing With Short Tags</p>
<? echo "It is the sample code using one short-tag."; ?>
<br/>
<?=  "It is another sample code using another short-tag."; ?>
</body>
</html>
Following is the output of the PHP code given above.

 Short Tag Syntax for Writing PHP Code

Commenting The Code


Writing comments are very important in order to organize and maintain the code while coding in any programming language. PHP offers three types of syntax for commenting your code, which are given below.

Single Line Syntax

PHP supports C++ style single-line comment syntax. It can be done using double slash (//) symbol at the beginning of each lines of code as given on the example below.
<?php
           // Title: commenting the PHP code
          // Author: Shuseel Baral
         echo "This is the single line syntax of PHP comment";
?>

Shell Syntax

PHP also supports another single-line C++ style syntax called shell syntax. It can be written using hash marks (#) the beginning of each lines of code as given on the example below.
<?php
          # Title: commenting the PHP code
          # Author: Shuseel Baral
         echo "This is the single line shell syntax of PHP comment";
?>

Multiple Line Syntax

You can also use multiple line commenting syntax on PHP. This type of comment begins with /* and concludes with */ sign, which is logically warrants numerous lines.
<?php
          /* Title: commenting the PHP code
              Author: Shuseel Baral */
         echo "This is the multiple line syntax of PHP comment";
?>

Outputting The Data To The Browser


Event for creating a simplest dynamic website, you have to generate data output to the browser. PHP offers several methods for displaying the data to the browser. You can generate data output to the browser using the statements like print( ), echo( ), printf( ) and sprintf( ).

The print( ) Statement

The print( ) statement generates output what data you have passed to it. Following is an example including the possible used of print( ) statement in PHP.
<?php
        print("<p> Outputting The Data To The Browser Using print( ) </p>");
?>
<?php
        $statement = "print( )";
        print("<p> Outputting The Data To The Browser Using $statement </p>");
?>
<?php
        print("<p> Outputting The Data To The Browser
        Using print( ) </p>");
?>
 The statements written above produces the following outputs to the browser.
Outputting The Data To The Browser Using print( )
Outputting The Data To The Browser Using print( )
Outputting The Data To The Browser Using print( )

The echo( ) Statement

You can also use the echo( ) statement in the place of print( ) statement in order to display data output to the browser. The echo( ) statement can be implemented just like the print( ) statement given below.
<?php
        echo "<p> Outputting The Data To The Browser Using echo( ) </p>";
?>
 The echo( ) statement is capable of displaying data generated through multiple arguments. Following is an example of showing that feature of echo( ) statement.
<?php
          $color1= "Red";
          $color2= "Green";
          echo $color1, "and", $color2, "are the colors.";
?>
The statements written above produces the following outputs to the browser.
Red and Green are the colors.

The printf( ) Statement

If  you want to generate data output both of the static text and dynamic data on the single line that are stored in one or several variables, the printf( ) statement can be used. The printf( ) statement allows you to control how the dynamic information is rendered to the screen in terms of its type, precision, alignment and position.

Here is an example that allows to insert a single dynamic integer value along with the static text.
<?php
          printf("There are %d pages on the book", 300);
?>
In the above code % d is the placeholder which is known as type specifier that can be presented as a signed decimal number. 

The sprintf( ) Statement

The speintf( ) statement is very similar to the print( ) statement but the output is assigned to a string rather than rendering to the browser.

Here is an example that shows the output generated using sprintf( ) statement.
<?php
           Total $cost of the Books = sprintf("$%2f", 93.2);
?>
The output of the code given above will be as follows.
Total $cost of the Books = 93.20
 
Read More »

Multiple Choice Questions On PHP Basis Part-2

This set of multiple choice objective questions on PHP language basis includes MCQ questions on PHP  variables and identifiers declaration, superglobal variables, uploading files using POST in PHP and errors occurring on it. It also includes MCQ on define( ), include( ) and require( ) functions used in PHP, operator associativity, examples of expressions and loops, Heredoc and Newdoc syntax used in PHP.

1. Which of the following is/are the valid identifiers
i) !sum             ii) Size                 iii) _variable            iv) 4count
A) i and ii only
B) ii and iii only
C) iii and iv only
D) i, ii and iii only

2. State whether the following statements about identifiers are True or False.
i) Identifiers are case sensitive
ii) Identifiers can be any length
iii) An identifier name can be identical to any PHP's predefined keywords.
A) i-True, ii-False, iii-True
B) i-True, ii-True, iii-True
C) i-False, ii-True, iii-False
D) i-True, ii-True, iii-False

3. The ........................... is a superglobal variable that stores information passed into the script through HTTP cookies.
A) $COOKIE
B) $_COOKIE
C) $SET_COOKIE
D) $ADD_COOKIE

4. While uploading files using POST in PHP, an upload status code ..................... will be populated while the file size exceeds the maximum size imposed by the upload_max_file size directive.
A) UPLOAD_ERR_INI_SIZE
B) UPLOAD_ERR_FORM_SIZE
C) UPLOAD_ERR_OK
D) UPLOAD_ERR_PARTIAL

5. .................. error will occur when the file size exceeds the maximum size imposed by an optional MAX_FILE_SIZE hidden form field parameter.
A) UPLOAD_ERR_INI_SIZE
B) UPLOAD_ERR_FORM_SIZE
C) UPLOAD_ERR_OK
D) UPLOAD_ERR_PARTIAL

6. The ............................ superglobal is a catch all of sorts, recording variables passed to a script via the GET, POST and COOKIE  methods.
A) $GLOBALS
B) $_SESSION
C) $_ENV
D) $_REQUEST

7. The .......................... superglobal array can be through of as the superglobal super set and contains a comprehensive listing of all variables found in the global scope.
A) $GLOBALS
B) $_SESSION
C) $_ENV
D) $_REQUEST

8.  The ..................... function in PHP defines a constant by assigning a value to a name.
A) define( )
B) const( )
C) constant( )
D) define_constant( )

9. The optional parameter ...................... is included and assigned TRUE, subsequent references to the constant will be case insensitive.
A) non_sensitive
B) no_case
C) case_insensitive
D) non_case_sensitive

10. .................... are particularly useful when working with values that definitely will not require modification.
A) Constants
B) Variables
C) Expressions
D) Keywords

Read More »

Multiple Choice Questions On PHP Basis Part-1

Here are the collections of multiple choice objective questions on PHP language features, advantages and capabilities. It also includes MCQ on different ways of writing PHP code for web pages, printf( ) and echo( ) statements used in PHP, different data types supported by PHP, variable declaration and PHP's superglobal variables. 

1. State whether the following statements about about PHP are True or False.
i) A useful PHP script can consist of a little as one line; unlike c, there is no need for the mandatory inclusion of libraries.
ii) In PHP, you can effect numerous changes to a value on the same line by stacking functions in a particular order.
A) False, True
B) True, True
C) False, False
D) True, False

2. Which of the following are the advantages of PHP language.
i) There is no need to explicitly create, typecast or destroy a variable.
ii) It will automatically destroy variables and return resources to the system when the scripts completes.
iii) It allows the developer to concentrate almost exclusively on the final goal, namely a working application.
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

3. The commonly used type specifier ......................... is considered an integer which can be presented as a character corresponding to that ASCII value.
A) %c
B) %b
C) %d
D) %o

4. Which of the following is/are the correct ways to display a text with PHP code.
i) <? php echo "This text is generated with PHP"; ?>
ii) <? print "This text is generated with PHP"; ?>
iii) <? ="This text is generated with PHP"; ?>
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

5. State whether the following statements about print( ) and echo( ) statements are True or False.
i) print( ) is capable of outputting multiple strings.
ii) echo( ) function is faster because it returns noting, whereas print( ) will return 1 if the statement is successfully output.
A) False, True
B) True, False
C) False, False
D) True, True

6. Which of the following is/are the ways of commenting the code in PHP.
i) <? php //This is PHP comment ?>
ii) <? php #This is PHP comment ?>
iii) <? php /*This is PHP comment ?>
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

7. The .......................... statement is ideal when you want to output a blend of static text and dynamic information stored within one or several variables.
A) echo( )
B) printf( )
C) print( )
D) sprintf( )

8. ..................... is a commonly used type specifier which can be considered an integer and presented as a signed decimal number.
A) %c
B) %b
C) %d
D) %o

9. PHP can do which of the following
i) Create and manipulate Adobe Flash and Portable Document Format(PDF) files.
ii) Tightly integrate with a wide array of credit card processing solutions.
iii) Evaluate a password for guess-ability by comparing it to language dictionaries and easily broken patterns.
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii

10. Which of the following is/are the valid examples of integers used in PHP.
i) 52           ii) -6590                 iii) 4.23               iv) oxc3
A) i, ii and iii only
B i, ii and iv only
C) ii, iii and iv only
D) All i, ii, iii and iv

Read More »

Top 20 MCQ Questions On Exception Handling In Java

This set of objective questions on Exception Handling in Java includes MCQ questions on compile time and run-time errors occurred in java programming. It includes the collections of objective questions from definition of exception, exception classes, common java exceptions, different exception handling keywords such as try, catch and finally. 

1. Which of the following are the most common run-time errors in Java programming.
i) Missing semicolons                
ii) Dividing an integer by zero
iii) Converting invalid string to number
iv) Bad reference of objects
A) i and ii only
B) ii and iii only
C) iii and iv only
D) i and iv only

2. Which of the following are the most common compile time errors in Java programming.
i) Missing semicolons
ii) Use of undeclared variables
iii) Attempting to use a negative size for an array
iv) Bad reference of objects
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv

3. The unexpected situations that may occur during program execution are
i) Running out of memory
ii) Resource allocation errors
iii) Inability to find a file
iv) Problems in network
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv

4. The class at the top of the exception classes hierarchy is called ........................
A) throwable
B) catchable
C) hierarchical
D) ArrayIndexOutofBounds

5. ..................... exception is thrown when an exceptional arithmetic condition has occurred.
A) Numerical
B) Arithmetic
C) Mathematical
D) All of the above

6. ............................. exception is caused when an applet tries to perform an action not allowed by the browser's security setting.
A) Throwable
B) Restricted
C) Security
D) ArrayIndexOutofBounds

7.  .......................... exception is thrown when an attempt is made to access an array element beyond the index of the array.
A) Throwable
B) Restricted
C) Security
D) ArrayIndexOutofBounds

8. You can implement exception-handling in your program by using which of the following keywords.
i) Try                       ii) NestTry                    iii) Catch                     iv) Finally
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv
 
9.  When a ......................... block is defined, this is guaranteed to execute, regardless of whether or not in exception is thrown.
A) throw
B) catch
C) finally
D) try

10. The ......................... statement is passed a single parameter, which is reference to the exception object thrown.
A) throw
B) catch
C) finally
D) try

Read More »

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>
</applet>
B) <applet>
code=Test.class width=200 height=100>
</applet>
C) <applet
code=Test.class width=200 height=100>
</applet>
D) <applet
param=Test.class width=200 height=100>
</applet>

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
B) java.io
C) java.util
D) java.net

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
C) java.net
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
C) java.net
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
D) S1.compare(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 »