Interview Question For C language

Category : News

Interview Questions
&
Answers

C Language Interview questions and Answers

250 + C Language Question and Answer

1.what are static blocks and static initalizers in Java ?

Static blocks or static initializers are used to initalize static fields in java. we declare static blocks when we want to intialize static fields in our class. Static blocks gets executed exactly once when the class is loaded . Static blocks are executed even before the constructors are executed.

2) How to call one constructor from the other constructor ?

With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called.

Restrictions for using this method :

1) this must be the first statement in the constructor

2)we cannot use two this() methods in the constructor

3) What is method overriding in java ?

If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by superclass.

When to use overriding in java If we want same method with different behaviour in superclass and subclass then we go for overriding. When we call overridden method with subclass reference subclass method is called hiding the superclass method.

4) What is super keyword in java ?

Variables and methods of super class can be overridden in subclass . In case of overriding , a subclass object call its own variables and methods. Subclass cannot access the variables and methods of superclass because the overridden variables or methods hides the methods and variables of super class. But still java provides a way to access super class members even if its members are overridden. Super is used to access superclass variables, methods, constructors.

Super can be used in two forms :

1) First form is for calling super class constructor.

2) Second one is to call super class variables,methods.

Super if present must be the first statement.

5) Difference between method overloading and method overriding in java ?

Method Overloading

  •  Method Overloading occurs with in the same class
  • Since it involves with only one class inheritance is not involved.                                        
  • In overloading return type need not be the same
  • Parameters must be different when we do overloading
  • Static polymorphism can be acheived using method overloading
  • In overloading one method can’t hide the another

Method Overriding​

  • Method Overriding occurs between two classes superclass and subclass
  • Since method overriding occurs between superclass and subclass inheritance is involved.
  • In overriding return type must be same.          
  • Parameters must be same.                              
  • Dynamic polymorphism can be acheived using method overriding
  • In overriding subclass method hides that of the superclass method.

6) Difference between abstract class and interface ?

Interface

  • Interface contains only abstract methods       
  • Access Specifiers for methods in interface must be public
  • Variables defined must be public , static final
  • Multiple Inheritance in java is implemented using interface
  • To implement an interface we use implements keyword

Abstract Class

  • Abstract class can contain abstract methods, concrete methods or both
  • Except private we can have any access specifier for methods in abstract class.
  • Except private variables can have any access specifiers
  • We cannot achieve multiple inheritance using abstract class
  • To implement an interface we use implement keyword

7) Why java is platform independent?

The most unique feature of java is platform independent. In any programming language soruce code is compiled in to executable code . This cannot be run across all platforms. When javac compiles a java program it generates an executable file called .class file.

class file contains byte codes. Byte codes are interpreted only by JVM’s . Since these JVM’s are made available across all platforms by Sun Microsystems, we can execute this byte code in any platform. Byte code generated in windows environment can also be executed in linux environment. This makes java platform independent.

8) What is method overloading in java ?

A class having two or more methods with same name but with different arguments then we say that those methods are overloaded. Static polymorphism is achieved in java using method overloading. Method overloading is used when we want the methods to perform similar tasks but with different inputs or values. When an overloaded method is invoked java first checks the method name, and the number of arguments ,type of arguments; based on this compiler executes this method. Compiler decides which method to call at compile time. By using overloading static polymorphism or static

binding can be achieved in java.

Note : Return type is not part of method signature. we may have methods with different return types but return type alone is not sufficient to call a method in java.

9) What is difference between c++ and Java ?

Interface

  •  Java is platform independent
  • There are no pointers in java
  • There is no operator overloading in java
  • There is garbage collection in java
  • Supports multithreading
  • There are no templates in java
  • There are no global variables in java

Abstract Class

  • C++ is platform dependent.
  • There are pointers in C++
  • C ++ has operator overloading.
  • There is no garbage collection
  • Does’nt support multithreading
  • There are templates in java
  • There are global variables in c++

10) What is bytecode in java ?

JIT compiler stands for Just in time compiler. JIT compiler compiles byte code in to executable code . JIT a part of JVM .JIT cannot convert complete java program in to executable code it converts as and when it is needed during execution.

11) What is bytecode in java ?

When a javac compiler compiler compiles a class it generates .class file. This .class file contains set of instructions called byte code. Byte code is a machine independent language and contains set of instructions which are to be executed only by JVM. JVM can understand this byte codes.

12) Difference between this() and super() in java ?

this() is used to access one constructor from another with in the same class while super() is used to access superclass constructor. Either this() or super() exists it must be the first statement in the constructor.

13) What is a class ?

Classes are fundamental or basic unit in Object Oriented Programming .A class is kind of blueprint or template for objects. Class defines variables, methods. A class tells what type of objects we are creating. For example take Department class tells us we can create department type objects. We can create any number of department objects.

All programming constructs in java reside in class. When JVM starts running it first looks for the class when we compile. Every Java application must have atleast one class and one main method. Class starts with class keyword. A class definition must be saved in class file that has same as class name. File name must end with .java extension.

public class FirstClass

{public static void main(String[] args)

{System.out.println(“My First class”);

}

}

If we see the above class when we compile JVM loads the FirstClass and generates a .class file(FirstClass.class). When we run the program we are running the class and then executes the main method.

14) What is an object ?

An Object is instance of class. A class defines type of object. Each object belongs to some class.Every object contains state and behavior. State is determined by value of attributes and behavior is called method. Objects are alos called as an instance.                                 

To instantiate the class we declare with the class type.

public classFirstClass {public static voidmain(String[] args)

{

FirstClass f=new FirstClass();

System.out.println(“My First class”);

}

}

To instantiate the FirstClass we use this statement

FirstClass f=new FirstClass();

f is used to refer FirstClass object              

15) What is an object ?

It contains the executable body that can be applied to the specific object of the class.

Method includes method name, parameters or arguments and return type and a body of executable code.

Syntax : type methodName(Argument List){

}

ex : public float add(int a, int b, int c) methods can have multiple arguments. Separate with commas when we have multiple arguments.

16) What is encapsulation ?

The process of wrapping or putting up of data in to a single unit class and keeps data safe from misuse is called encapsulation .

Through encapsulation we can hide and protect the data stored in java objects.Java supports encapsulation through access control. There are four access control modifiers in java public , private ,protected and default level.

For example take a car class , In car we have many parts which is not required for driver to know what all it consists inside. He is required to know only about how to start and stop the car. So we can expose what all are required and hide the rest by using encapsulation.

17) Why main() method is public, static and void in java ?

public : “public” is an access specifier which can be used outside the class. When main method is declared public it means it can be used outside class.

static : To call a method we require object. Sometimes it may be required to call a method without the help of object. Then we declare that method as static. JVM calls the main() method without creating object by declaring keyword static. 

void : void return type is used when a method does’nt return any value . main() method does’nt return any value, so main() is declared as void.

Signature : public static void main(String[] args) {

18) Explain about main() method in java ?

Main() method is starting point of execution for all java applications.

public static void main(String[] args) {}

String args[] are array of string objects we need to pass from command line arguments.

Every Java application must have atleast one main method.

19)What is constructor in java ?

A constructor is a special method used to initialize objects in java.

we use constructors to initialize all variables in the class when an object is created. As and when an object is created it is initialized automatically with the help of constructor in java. We have two types of constructors
Default Constructor
Parameterized Constructor
Signature : public classname()
{
}
Signature : public classname(parameters list)
{
}

20) What is difference between length and length() method in java ?

length() : In String class we have length() method which is used to return the number of characters in string.
Ex : String str = “Hello World”;
System.out.println(str.length());
Str.length() will return 11 characters including space.
length : we have length instance variable in arrays which will return the number of values or objects in array.
For example :
String days[]={” Sun”,”Mon”,”wed”,”thu”,”fri”,”sat”};
Will return 6 since the number of values in days array is 6.

21) What is ASCII Code?

ASCII stands for American Standard code for Information Interchange. ASCII character range is 0 to 255. We can’t add more characters to the ASCII Character set. ASCII character set supports only English. That is the reason, if we see C language we can write c language only in English we can’t write in other languages because it uses ASCII code.

22) What is Unicode ?

Unicode is a character set developed by Unicode Consortium. To support all languages in the world Java supports Unicode values. Unicode characters were represented by 16 bits and its character range is 0-65,535.

Java uses ASCII code for all input elements except for Strings,identifiers, and comments. If we want to use Punjabi we can use Punjabi characters for identifiers.We can enter comments in Punjabi

23) What is Unicode ?

Character constant is enclosed in single quotes. String constants are enclosed in double quotes. Character constants are single digit or character. String Constants are collection of characters.

Ex :’2’, ‘A’

Ex : “Hello World”

24) What are constants and how to create constants in java?

Constants are fixed values whose values cannot be changed during the execution of program. We create constants in java using final keyword.

Ex : final int number =10;

final String str=”java-interview –questions”

25) Difference between ‘>>’ and ‘>>>’ operators in java?

>> is a right shift operator shifts all of the bits in a value to the right to a specified number of times.

int a =15;

a= a >> 3;

The above line of code moves 15 three characters right.

>>> is an unsigned shift operator used to shift right. The places which were vacated by shift are filled

with zeroes.


Php interview question

Category : News

Interview Questions
&
Answers

PHP Interview questions and Answers

100 + PHP Question and Answer

1. Who is the father of PHP ?

 Rasmus Lerdorf is known as the father of PHP.

2. What is the difference between $name and $$name?

$name is variable where as $$name is reference variable like $name=sonia and $$name=singh so $sonia value is singh

3) How can we submit a form without a submit button?

Java script submit() function is used for submit form without submit button on click call document.formname.submit() 

4)In how many ways we can retrieve the data in the result set of MySQL using PHP?

We can do it by 4 Ways 1. mysql_fetch_row. , 2. mysql_fetch_array , 3. mysql_fetch_object 4. mysql_fetch_assoc 

5.What is the difference between mysql_fetch_object and mysql_fetch_array?

mysql_fetch_object() is similar tomysql_fetch_array(), with one difference – an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names). 

6.What are the differences between Get and post methods.

There are some defference between GET and POST method  1. GET Method have some limit like only 2Kb data able to send for request  But in POST method unlimited data can we send  2. when we use GET method requested data show in url but  Not in POST method so POST method is good for send sensetive request 

7.How can we extract string "pcds.co.in " from a string "http://info@pcds.co.in using regular expression of PHP?

preg_match(“/^http:\/\/.+@(.+)$/”,”http://info@pcds.co.in”,$matc hes); echo $matches[1]; 

8.How can we create a database using PHP and MySQL?

We can create MySQL database with the use of mysql_create_db(“Database Name”) 

9.What are the differences between require and include?

Both include and require used to include a file but when included file not found  Include send Warning where as Require send Fatal Error . 

10. Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"?

 Yes we can use include(“xyz.php”) more than one time in any page. but it create a prob when xyz.php file contain some funtions declaration then error will come for already declared function in this file else not a prob like if you want to show same content two time in page then must incude it two time not a prob  

11. What are the different tables(Engine) present in MySQL, which one is default?

 Following tables (Storage Engine) we can create 

1. MyISAM(The default storage engine IN MYSQL Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension. ) 

2. InnoDB(InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data.)

 3. Merge

 4. Heap (MEMORY)(The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility. ) 

5. BDB (BerkeleyDB)(Sleepycat Software has provided MySQL with the Berkeley DB transactional storage engine. This storage engine typically is called BDB for short. BDB tables may have a greater chance of surviving crashes and are also capable of COMMITand ROLLBACK operations on transactions)  

6. EXAMPLE  

7. FEDERATED (It is a storage engine that accesses data in tables of remote databases rather than in local tables. ) 

8. ARCHIVE (The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint. ) 

9. CSV (The CSV storage engine stores data in text files using comma-separated values format.)

 10. BLACKHOLE (The BLACKHOLE storage engine acts as a “black hole” that accepts data but throws it away and does not store it. Retrievals always return an empty result)   

 

12. What is use of header() function in php ?

The header() function sends a raw HTTP header to a client.We can use herder()  function for redirection of pages. It is important to notice that header() must be called before any actual output is seen.. 

13. How can I execute a PHP script using command line?

Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. 

14.Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?

In php.ini file: set short_open_tag=on to make PHP support 

15.Shopping cart online validation i.e. how can we configure Paypal, etc.?

Nothing more we have to do only redirect to the payPal url after submit all information needed by paypal like amount,adresss etc. 

16. What is meant by nl2br()?

Inserts HTML line breaks (<BR />) before all newlines in a string. 

17.What is htaccess? Why do we use this and Where?

.htaccess files are configuration files of Apache Server which provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all  subdirectories thereof. 

18.How we get IP address of client, previous reference page etc ?

By using $_SERVER[‘REMOTE_ADDR’],$_SERVER[‘HTTP_REFERER’] etc

19.What are the reasons for selecting lamp (Linux, apache, MySQL, PHP) instead of combination of other software programs, servers and operating systems?

All of those are open source resource. Security of Linux is very very more than windows. Apache is a better server that IIS both in functionality and security. MySQL is world most popular open source database. PHP is more faster that asp or any other scripting language. 

20.How can we encrypt the username and password using PHP?

AES_ENCRYPT () and AES_DECRYPT () 

21. What are the features and advantages of object-oriented programming?

One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system 

22.What are the differences between procedure-oriented languages and object-oriented languages?

There are lot of difference between procedure language and object oriented like below 1>Procedure language easy for new developer but complex to understand whole software as compare to object oriented model 2>In Procedure language it is difficult to use design pattern mvc , Singleton pattern etc but in OOP you we able to develop design pattern 3>IN OOP language we able to ree use code like Inheritance ,polymorphism etc but this type of thing not available in procedure language on that our Fonda use COPY and PASTE .

 

23. What is the use of friend function?

Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class. A friend declaration is essentially a prototype for a member function,but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match. 

24.What are the differences between public, private, protected, static, transient, final and volatile?

Public: Public declared items can be accessed everywhere. 

Protected: Protected limits access to inherited and parent classes (and to the class that defines the item). 

Private: Private limits visibility only to the class that defines the item. 

Static: A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope.

 Final: Final keyword prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended. 

transient: A transient variable is a variable that may not be serialized.  

volatile: a variable that might be concurrently modified by multiple threads should be declared volatile. Variables declared to be volatile will not be optimized by the compiler because their value can change at any time

25.What are the different types of errors in PHP?

Three are three types of errors:1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although, as you will see, you can change this default behavior.2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place. 

26.What is the functionality of the function strstr and stristr?

strstr Returns part of string from the first occurrence of needle(sub string that we finding out ) to the end of string.  $email= ‘sonialouder@gmail.com’; $domain = strstr($email, ‘@’); echo $domain; // prints @gmail.com here @ is the needle  stristr is case-insensitive means able not able to diffrenciate between a and A  

 

27.What are the differences between PHP 3 and PHP 4 and PHP 5?

There are lot of difference among these three version of php

 1>Php3 is oldest version after that php4 came and current version is php5 (php5.3) where php6 have to come 

 2>Difference mean oldest version have less functionality as compare to new one like php5 have all OOPs concept now where as php3 was pure procedural language constructive like C  In PHP5 

1. Implementation of exceptions and exception handling 

2. Type hinting which allows you to force the type of a specific argument 

3. Overloading of methods through the __call function 

4. Full constructors and destructors etc through a __constuctor and __destructor function 

5. __autoload function for dynamically including certain include files depending on the class you are trying to create. 

6 Finality : can now use the final keyword to indicate that a method cannot be overridden by a child. You can also declare an entire class as final which prevents it from having any children at all.

 7 Interfaces & Abstract Classes

 8 Passed by Reference : 

 9 An __clone method if you really want to duplicate an object 

10 Numbers of Functions Deprecated in php 5.x like ereg,ereg_replace,magic_quotes_runtime, session_register,register_globals, split(), call_user_method() etc 

28.How can we convert asp pages to PHP pages?

there are lots of tools available for asp to PHP conversion. you can search Google for that. the best one is available athttp://asp2php.naken.cc./ 

29. What is the functionality of the function htmlentities?

Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities. 

30.How can we get second of the current time using date function?

$second = date(“s”);

31.How can we convert the time zones using PHP?

 By using date_default_timezone_get and  date_default_timezone_set function on PHP 5.1.0 

 <?php // Discover what 8am in Tokyo relates to on the East Coast of the US     

 

// Set the default timezone to Tokyo time: date_default_timezone_set(‘Asia/Tokyo’);     

 

// Now generate the timestamp for that particular timezone, on Jan 1st, 2000 $stamp = mktime(8, 0, 0, 1, 1, 2000);     

 

// Now set the timezone back to US/Eastern date_default_timezone_set(‘US/Eastern’);     

 

// Output the date in a standard format (RFC1123), this will print: 

// Fri, 31 Dec 1999 18:00:00 EST

 echo ‘<p>’, date(DATE_RFC1123, $stamp) ,'</p>’;?> 

32.What is meant by urlencode and urldocode?

URLencode returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in  application/x-www-form-urlencoded media type.  

urldecode decodes any %## encoding in the given string

33.What is the difference between the functions unlink and unset?

unlink() deletes the given file from the file system. unset() makes a variable undefined. 

34.How can we register the variables into a session?

$_SESSION[‘name’] = “sonia”; 

35.How can we get the properties (size, type, width, height) of an image using PHP image functions

To know the Image type use exif_imagetype () function

 To know the Image size use getimagesize () function

 To know the image width use imagesx () function 

To know the image height use imagesy() function t 

36.How can we get the browser properties using PHP?

By using  $_SERVER[‘HTTP_USER_AGENT’] variable. 

37.What is the maximum size of a file that can be uploaded using PHP and how can we change this?

By default the maximum size is 2MB. and we can change the following setup at php.iniupload_max_filesize = 2M 

38. How can we increase the execution time of a PHP script?

by changing the following setup at php.inimax_execution_time = 30 ; Maximum execution time of each script, in seconds 

39.How can we take a backup of a MySQL table and how can we restore it. ?

To backup: BACKUP TABLE tbl_name[,tbl_name…] TO 

‘/path/to/backup/directory’ RESTORE TABLE tbl_name[,tbl_name…] FROM ‘/path/to/backup/directory’mysqldump: Dumping Table Structure and DataUtility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table. -t, –no-create-info Don’t write table creation information (the CREATE TABLE statement). -d, –no-data Don’t write any row information for the table. This is very useful if you just want to get a dump of the structure for a table! 

 

40. How can we optimize or increase the speed of a MySQL select query?

• first of all instead of using select * from table1, use select column1, column2, column3.. from table1

 • Look for the opportunity to introduce index in the table you are querying. 

• use limit keyword if you are looking for any specific number of rows from the result set. 

41.How many ways can we get the value of current session id?

session_id() returns the session id for the current session.

42.How can we destroy the session, how can we unset the variable of a session?

session_unregister — Unregister a global variable from the current session session_unset — Free all session variables

43.How can we set and destroy the cookie n php

By using setcookie(name, value, expire, path, domain); function we can set the cookie in php ; Set the cookies in past for destroy. like  setcookie(“user”, “sonia”, time()+3600); for set the cookie  setcookie(“user”, “”, time()-3600); for destroy or delete the cookies; 

44.How many ways we can pass the variable through the navigation between the pages?

• GET/QueryString 

• POST 

45.What is the difference between ereg_replace() and eregi_replace()?

eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters. 

46. What are the different functions in sorting an array?

Sort(), arsort(), 

asort(), ksort(),

 natsort(), natcasesort(), 

rsort(), usort(),

 array_multisort(), and

 uksort(). 

47. How can we know the count/number of elements of an array?

2 ways 

a) sizeof($urarray) This function is an alias of count()

 b) count($urarray) 

48. what is session_set_save_handler in PHP?

session_set_save_handler() sets the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other than those supplied by PHP sessions is preferred. i.e. Storing the session data in a local database. 

49.How can I know that a variable is a number or not using a JavaScript?

bool is_numeric ( mixed var) Returns TRUE if var is a number or a numeric string, FALSE otherwise.or use isNaN(mixed var)The isNaN() function is used to check if a value is not a number. 

  

50.List out some tools through which we can draw E-R diagrams for mysql.

Case Studio

 Smart Draw 

51.How can I retrieve values from one database server and store them in other database server using PHP?

we can always fetch from one database and rewrite to another. here is a nice solution of it.$db1 = mysql_connect(“host”,”user”,”pwd”) 

mysql_select_db(“db1”, $db1); 

$res1 = mysql_query(“query”,$db1);$db2 = 

mysql_connect(“host”,”user”,”pwd”) 

mysql_select_db(“db2”, $db2); 

$res2 = mysql_query(“query”,$db2);At this point you can only fetch 

records from you previous ResultSet,

 i.e $res1 – But you cannot execute new query in $db1, even if you 

supply the link as because the link was overwritten by the new db.so 

at this point the following script will fail 

$res3 = mysql_query(“query”,$db1); //this will failSo how to solve that?  

take a look below. 

$db1 = mysql_connect(“host”,”user”,”pwd”)

 mysql_select_db(“db1”, $db1);

 $res1 = mysql_query(“query”,$db1); 

$db2 = mysql_connect(“host”,”user”,”pwd”, true) 

mysql_select_db(“db2”, $db2); 

$res2 = mysql_query(“query”,$db2); 

So mysql_connect has another optional boolean parameter which indicates whether a link will be created or not. as we connect to the $db2 with this optional parameter set to ‘true’, so both link will remain live. 

now the following query will execute successfully.

 $res3 = mysql_query(“query”,$db1); 

 

52.List out the predefined classes in PHP?

Directory 

stdClass 

__PHP_Incomplete_Class 

exception 

php_user_filter 

53.How can I make a script that can be bi-language (supports English, German)?

You can maintain two separate language file for each of the language. all the labels are putted in both language files as variables and assign those variables in the PHP source. on runtime choose the required language option. 

54.What are the difference between abstract class and interface?

 Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract.

 Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class. 

55.How can we send mail using JavaScript?

JavaScript does not have any networking capabilities as it is designed to work on client site. As a result we can not send mails using JavaScript. But we can call the client side mail protocol mailto via JavaScript to prompt for an email to send. this requires the client to approve it. 

56.How can we repair a MySQL table?

The syntex for repairing a MySQL table is REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended] This command will repair the table specified if the quick is given the MySQL will do a repair of only the index tree if the extended is given it will create index row by row 

57.What are the advantages of stored procedures, triggers, indexes?

A stored procedure is a set of SQL commands that can be compiled and stored in the server. Once this has been done, clients don’t need to keep re-issuing the entire query but can refer to the stored procedure. This provides better overall performance because the query has to be parsed only once, and less information needs to be sent between the server and the client. You can also raise the conceptual level by having libraries of functions in the server. However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side.Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that is invoked when a particular event occurs.

 For example, you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a customer table when all his transactions are deleted.Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially. If you need to access most of the rows, it is faster to read sequentially, because this minimizes disk seeks.   

58.How many values can the SET function of MySQL take?

MySQL set can take zero or more values but at the maximum it can take 64 values 

59.What are the other commands to know the structure of table using MySQL commands except explain command?

describe Table-Name; 

60. How many tables will create when we create table, what are they?

The ‘.frm’ file stores the table definition. 

The data file has a ‘.MYD’ (MYData) extension. 

The index file has a ‘.MYI’ (MYIndex) extension, 

61.What is the purpose of the following files having extensions 1) .frm 2) .myd 3) .myi? What do these files contain?

In MySql, the default table type is MyISAM. 

Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. 

The ‘.frm’ file stores the table definition. 

The data file has a ‘.MYD’ (MYData) extension. 

The index file has a ‘.MYI’ (MYIndex) extension, 

62. What is maximum size of a database in MySQL?

If the operating system or filesystem places a limit on the number of files in a directory, MySQL is bound by that constraint.The efficiency of the operating system in handling large numbers of files in a directory can place a practical limit on the number of tables in a database. If the time required to open a file in the directory increases significantly as the number of files increases, database performance can be adversely affected. 

The amount of available disk space limits the number of tables.

 MySQL 3.22 had a 4GB (4 gigabyte) limit on table size. With the MyISAM

 storage engine in MySQL 3.23, the maximum table size was increased 

to 65536 terabytes (2567 – 1 bytes). With this larger allowed table size, 

the maximum effective table size for MySQL databases is usually determined by operating system constraints on file sizes, not by MySQL 

internal limits.The InnoDB storage engine maintains InnoDB tables within a tablespace

 that can be created from several files. This allows a table to exceed the maximum individual file size. The tablespace can include raw

 disk 

partitions, which allows extremely large tables. The maximum tablespace size is 64TB.

 The following table lists some examples of operating system file-size limits. This is only a rough guide and is not intended to be definitive. For the most up-to-date information, be sure to check the documentation

 specific to your operating system.

 Operating System File-size LimitLinux 2.2-Intel 32-bit 2GB (LFS: 4GB) 

Linux 2.4+ (using ext3 filesystem) 4TB 

Solaris 9/10 16TB

 NetWare w/NSS filesystem 8TB 

Win32 w/ FAT/FAT32 2GB/4GB 

Win32 w/ NTFS 2TB (possibly larger)

 MacOS X w/ HFS+ 2TB 

63. Give the syntax of Grant and Revoke commands?

 The generic syntax for grant is as following

 > GRANT [rights] on [database/s] TO [username@hostname] 

IDENTIFIED BY

 [password] 

now rights can be 

a) All privileges 

b) combination of create, drop, select, insert, update and delete 

etc.We can grant rights on all 

databse by using *.* or some specific database by database.* or a specific table by database.table_name

 username@hotsname can be either username@localhost, username@hostname

 and username@% 

where hostname is any valid hostname and % represents any name, the *.* 

any condition password is simply the

 password of userThe generic syntax for 

revoke is as following 

> REVOKE [rights] on [database/s] FROM [username@hostname] 

now rights can be as explained above 

a) All privileges

b) combination of create, drop, select, insert, update and delete etc. username@hotsname can be either username@localhost, username@hostname and username@% 

where hostname is any valid hostname and % represents any name, the *.* any condition 

 

64.Explain Normalization concept?

The normalization process involves getting our data to

 conform to three progressive normal forms, and a higher level of normalization 

cannot be achieved until the previous levels have been achieved

 (there 

are actually five normal forms, but the last two are mainly academic 

and

 will not be discussed).First Normal FormThe First Normal Form (or

1NF) involves removal of redundant data 

from horizontal rows. We want to ensure that there is no duplication

 of

 data in a given row, and that every column stores the least amount 

of

 information possible (making the field atomic).Second Normal 

FormWhere the First Normal Form deals with redundancy of data

 across a 

horizontal row, Second Normal Form (or 2NF) deals with redundancy 

of

 data in vertical columns. As stated earlier, the normal forms are

 progressive, so to achieve Second Normal Form, your tables must

 already 

be in First Normal Form.Third Normal Form  

I have a confession

 to make; I do not often use Third Normal Form.

 In

 Third Normal Form we are looking for data in our tables that is not 

fully dependant on the primary key, but dependant on another value

 in

 the table 

65.How can we find the number of rows in a table using MySQL?

Use this for mysql

 >SELECT COUNT(*) FROM table_name;

66.How can we find the number of rows in a result set using PHP?

$result = mysql_query($sql, $db_link);

 $num_rows = mysql_num_rows($result); 

echo “$num_rows rows found”; 

67.How many ways we can we find the current date using MySQL?

SELECT CURDATE();

 CURRENT_DATE() = CURDATE() 

for time use

 SELECT CURTIME(); 

CURRENT_TIME() = CURTIME() 

68. What are the advantages and disadvantages of Cascading Style Sheets?

External Style SheetsAdvantagesCan control styles for multiple documents at once. Classes can be created for use on multiple HTML element types in many documents.Selector and grouping methods can be used to apply styles under complex contextsDisadvantagesAn extra download is required to import style information for each document The rendering of the document may be delayed until the external style sheet is loaded Becomes slightly unwieldy for small quantities of style definitionsEmbedded Style Sheets  

Advantages 

Classes can be created for use on multiple tag types in the document. Selector and grouping methods can be used to apply styles under complex contexts. No additional downloads necessary to receive style information 

Disadvantages 

This method can not control styles for multiple documents at once 

Inline Styles 

Advantages 

Useful for small quantities of style definitions. Can override other style specification methods at the local level so only exceptions need to be listed in conjunction with other style methods 

Disadvantages 

Does not distance style information from content (a main goal of 

SGML/HTML). Can not control styles for multiple documents at once. 

Author can not create or control classes of elements to control 

multiple

 element types within the document. Selector grouping methods can 

not be

 used to create complex element addressing scenarios  

69. What type of inheritance that PHP supports?

In PHP an extended class is always dependent on a single base 

class,

 that is, multiple inheritance is not supported. Classes are extended 

using the keyword ‘extends’. 

70. What is the difference between Primary Key and Unique key?

 Primary Key: A column in a table whose values uniquely identify the rows in the table. A primary key value cannot be NULL.  

Unique Key: Unique Keys are used to uniquely identify each row in the table. There can be one and only one row for each unique key value. So NULL can be a unique key.There can be only one primary key for a table but there can be more than one unique for a table. 

71.what is garbage collection? default time ? refresh time?

Garbage Collection is an automated part of PHP , If the Garbage Collection process runs, it then analyzes any files in the /tmp for any session files that have not been accessed in a certain amount of time and physically deletes them. Garbage Collection process only runs in the default session save directory, which is /tmp. If you opt to save your sessions in a different directory, the Garbage Collection process will ignore it. the Garbage Collection process does not differentiate between which sessions belong to whom when run. This is especially important note on shared web servers. If the process is run, it deletes ALL files that have not been accessed in the directory. There are 3 PHP.ini variables, which deal with the garbage collector: PHP ini value name default session.gc_maxlifetime 1440 seconds or 24 minutes session.gc_probability 1 session.gc_divisor 100  

 

72. What are the advantages/disadvantages of MySQL and PHP?

Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP. 

73.What is the difference between GROUP BY and ORDER BY in Sql?

ORDER BY [col1],[col2],…,[coln]; Tels DBMS according to what 

columns

 it should sort the result. If two rows will hawe the same value in col1

 it will try to sort them according to col2 and so on.GROUP BY

 [col1],[col2],…,[coln]; Tels DBMS to group results with same value 

of 

column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with 

it, if 

you want to count all items in group, sum all values or view average 

74. What is the difference between char and varchar data types?

Set char to occupy n bytes and it will take n bytes even if u r 

storing a value of n-m bytes 

Set varchar to occupy n bytes and it will take only the required

 space 

and will not use the n bytes

 eg. name char(15) will waste 10 bytes if we store ‘romharshan’,

 if each char 

takes a byte 

eg. name varchar(15) will just use 5 bytes if we store ‘romharshan’,

 if each 

char takes a byte. rest 10 bytes will be free. 

75. What is the functionality of md5 function in PHP?

Calculate the md5 hash of a string. The hash is a 32-character hexadecimal number. I use it to generate keys which I use to identify users etc. If I add random no techniques to it the md5 generated now will be totally different for the same string I am using. 

76.How can I load data from a text file into a table?

you can use LOAD DATA INFILE file_name; syntax to load data from a text file. but you have to make sure thata) data is delimited b) columns and data matched correctly 

77. How can we know the number of days between two given dates using MySQL?

SELECT DATEDIFF(“2007-03-07″,”2005-01-01”); 

78. How can we know the number of days between two given dates using PHP?

$date1 = date(“Y-m-d”); 

$date2 = “2006-08-15”;

 $days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24); 

79. How we load all classes that placed in different directory in one PHP File , means how to do auto load classes

by using spl_autoload_register(‘autoloader::funtion’); 

Like below  

 

class autoloader 

 

 

public static function moduleautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/modules/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

public static function daoautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/dataobjects/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

public static function includesautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/includes/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

 

spl_autoload_register(‘autoloader::includesautoloader’); 

 

spl_autoload_register(‘autoloader::daoautoloader’); 

 

spl_autoload_register(‘autoloader::moduleautoloader’); Like below  

 

class autoloader 

 

 

public static function moduleautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/modules/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

public static function daoautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/dataobjects/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

public static function includesautoloader($class) 

 

 

$path = $_SERVER[‘DOCUMENT_ROOT’] . “/includes/{$class}.php”; 

 

if (is_readable($path)) require $path; 

 

 

 

spl_autoload_register(‘autoloader::includesautoloader’); 

 

spl_autoload_register(‘autoloader::daoautoloader’); 

 

spl_autoload_register(‘autoloader::moduleautoloader’); 

 

80. How many types of Inheritances used in PHP and how we achieve it

As far PHP concern it only support single Inheritance in scripting. we can also use interface to achieve multiple inheritance. 

81.PHP how to know user has read the email?

Using Disposition-Notification-To: in mailheader we can get read

 receipt. 

Add the possibility to define a read receipt when sending an email.

 It’s quite straightforward, just edit email.php, and add this at 

vars definitions:

 var $readReceipt = null;

 And then, at ‘createHeader’ function add: 

if (!empty($this->readReceipt)) {  

$this->__header .= ‘Disposition-Notification-To: ‘ . $this

>__formatAddress($this->readReceipt) . $this->_newLine; 

 } 

82. What are default session time and path?

default session time in PHP is 1440 seconds or 24 minutes Default session save path id temporary folder /tmp   

83.how to track user logged out or not? when user is idle ?

By checking the session variable exist or not while loading th page. As the session will exist longer as till browser closes. The default behaviour for sessions is to keep a session open indefinitely and only to expire a session when the browser is closed. This behaviour can be changed in the php.ini file by altering the line session.cookie_lifetime = 0 to a value in seconds. If you wanted the session to finish in 5 minutes you would set this to session.cookie_lifetime = 300 and restart your httpd server. 

84.how to track no of user logged in ?

whenever a user logs in track the IP, userID etc..and store it in a DB with a active flag while log out or sesion expire make it inactive. At any time by counting the no: of active records we can get the no: of visitors. 

85. in PHP for pdf which library used?

The PDF functions in PHP can create PDF files using the PDFlib library With version 6, PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4. There is also the » Panda module. FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5. 

86.for image work which library?

we will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with. 

87.what is design pattern? singleton pattern?

A design pattern is a general reusable solution to a commonly occurring problem in software design. The Singleton design pattern allows many parts of a program to share a single resource without having to work out the details of the sharing themselves.  

 

88.what are magic methods?

Magic methods are the members functions that is available to all the instance of class Magic methods always starts with “__”. Eg. __construct All magic methods needs to be declared as public To use magic method they should be defined within the class or program scope Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone()  

 

89.what is magic quotes?

Magic Quotes is a process that automagically escapes ncoming data to the PHP script. It’s preferred to code with magic quotes off and to instead escape the data at runtime, as needed. This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.  

 

90.what is cross site scripting? SQL injection?

Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. Examples of such code include HTML code and client-side scripts. SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed 

91.what is URL rewriting?

Using URL rewriting we can convert dynamic URl to static URL Static URLs are known to be better than Dynamic URLs because of a number of reasons 1. Static URLs typically Rank better in Search Engines. 2. Search Engines are known to index the content of dynamic pages a lot slower compared to static pages. 3. Static URLs are always more friendlier looking to the End Users. along with this we can use URL rewriting in adding variables [cookies] to the URL to handle the sessions.  

 

92. what is the major php security hole? how to avoid?

1. Never include, require, or otherwise open a file with a filename based on user input, without thoroughly checking it first. 

 2. Be careful with eval() Placing user-inputted values into the eval() function can be extremely dangerous. You essentially give the malicious user the ability to execute any command he or she wishes! 

3. Be careful when using register_globals = ON It was originally designed to make programming in PHP easier (and that it did), but misuse of it often led to security holes  

4. Never run unescaped queries

  5. For protected areas, use sessions or validate the login every time. 

 6. If you don’t want the file contents to be seen, give the file a .php extension.  

 

93. whether PHP supports Microsoft SQL server ?

The SQL Server Driver for PHP v1.0 is designed to enable reliable, scalable integration with SQL Server for PHP applications deployed on the Windows platform. The Driver for PHP is a PHP 5 extension that allows the reading and writing of SQL Server data from within PHP scripts. using MSSQL or ODBC modules we can access Microsoft SQL server. 

94. what is MVC? why its been used?

Model-view-controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model. WHY ITSNEEDED IS 1 Modular separation of function 2 Easier to maintain 3 View-Controller separation means: A — Tweaking design (HTML) without altering code B — Web design staff can modify UI without understanding code    

95 .what is framework? how it works? what is advantage?

In general, a framework is a real or conceptual structure intended to serve as a support or guide for the building of something that expands the structure into something useful. Advantages : Consistent Programming Model Direct Support for Security Simplified Development Efforts Easy Application Deployment and Maintenance 

96.what is CURL?

CURL means Client URL Library curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks. CURL allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.  

 

97.what is PDO ?

The PDO ( PHP Data Objects ) extension defines a lightweight, consistent interface for accessing databases in PHP. if you are using the PDO API, you could switch the database server you used, from say PgSQL to MySQL, and only need to make minor changes to your PHP code.  

WhilePDO has its advantages, such as a clean, simple, portable API but its main disadvantage is that it doesn’t allow you to use all of the advanced features that are available in the latest versions of MySQL server. For example, PDO does not allow you to use MySQL’s support for Multiple Statements. 

Just need to use below code for connect mysql using PDO

 try { 

$dbh = new 

PDO(“mysql:host=$hostname;dbname=databasename”, $username,

 $password); 

$sql = “SELECT * FROM employee”; 

foreach ($dbh->query($sql) as $row) {

 print $row[’employee_name’] .’ – ‘. $row[’employee_age’] ; 

catch(PDOException $e)

 { 

echo $e->getMessage();

 }  

98. What is PHP's mysqli Extension?

The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.  

The mysqli extension has a number of benefits, the key enhancements over the mysql extension being:  

=>Object-oriented interface 

 =>Support for Prepared Statements  

=>Support for Multiple Statements  

=>Support for Transactions  

=>Enhanced debugging capabilities  

=>Embedded server support  

 

99. How can we encrypt the username and password using PHP?

encryption

AES_ENCRYT()  

ENCODE() 

DES_ENCRYPT() 

ENCRYPT()

MD5() 

OLD_PASSWORD()

PASSWORD() 

SHA() or SHA1()

Not available 

decryption

 AES_DECRYPT() 

DECODE() 

DES_DECRYPT() 

 Not available 

Not available 

Not available 

 Not available 

Not available 

UNCOMPRESSED_LENGTH() 


The top accounting interview

Category : News

Interview Questions
&
Answers

Top accounting Interview Questions

In simple way Meaning of Analogy is “Similarity ” or compassion between one thing and other thing base d on some similarity 

250 + Accounting Question and Answer

Q1. How many types of business transactions are there in accounting?

Ans.There are two types of business transactions in accounting – revenue and capital.

Q2. Explain real and nominal accounts with examples.

Ans. A real account is an account of assets and liabilities. E.g. land account, building account, etc.

A nominal account is an account of income and expenses. E.g. salary account, wages account, etc.

Q3. Which accounting platforms have you worked on? Which one do you prefer the most?

Ans. Describe the accounting platforms (QuickBooks, Microsoft Dynamic GP, etc.) that you have worked with and which one you liked the most.

Q4. What is double entry bookkeeping? What are the rules associated with it?

Ans.Double entry bookkeeping is an accounting principle where every debit has a corresponding credit. Thus, the total debit is always equal to the total credit. In this system, when one account is debited then another account gets credited at the same time.

Q5. What is working capital?

Ans. Working capital is calculated as current assets minus current liabilities, which is used in day-to-day trading.

Q6. How do you maintain accounting accuracy?

Ans. Maintaining the accuracy of an organisation’s accounting is an important activity as it can result in a huge loss. There are various tools and resources which can be used to limit the potential for errors to creep in and address quickly if any errors do arise.

Q7. What is TDS? Where do you show TDS on a balance sheet?

Ans. TDS (Tax Deducted at Source) is a concept aimed at collecting tax at every source of income. In a balance sheet, it is shown in the assets section, right after the head current asset.

Q8. What is the difference between ‘accounts payable (AP)’ and ‘accounts receivable (AR)’?

Accounts Payable

  • The amount a company owes because it purchased goods or services on credit from a vendor or supplier.
  • Accounts payable are liabilities                                      

Accounts Receivable

  • The amount a company has right to collect because it sold goods or services on credit to a customer
  • Accounts receivable are assets.

Q9. What is the difference between a trial balance and a balance sheet?

Ans. A trial balance is the list of all balances in a ledger account and is used to check the arithmetical accuracy in recording and posting.  A balance sheet, on the other hand, is a statement which shows the assets, liabilities and equity of a company and is used to ascertain its financial position on a particular date.

 

Q10. Is it possible for a company to show positive cash flows and still be in grave trouble?

Ans. Yes, if it shows an unsustainable improvement in working capital and involves lack of revenue going forward in the pipeline.

Q11. What are the common errors in accounting?

Ans.The common errors in accounting are – errors of omission, errors of commission, errors of principle and compensating error.

Q12. What is the difference between inactive and dormant accounts?

Ans. Inactive accounts are which that are closed and will not be used in the future. Dormant accounts are not currently functional but may be used in the future.

Q13. Are you familiar with the Accounting Standards? How many accounting standards are there in India?

Ans.There are currently 41 Accounting Standards which are usually issued by the Accounting Standards Board (ASB)

Q14. Why do you think Accounting Standards are mandatory?

Ans. Accounting Standards play an important role in preparing a good and accurate financial report. It ensures reliability and relevance in financial reports.

Q15. Have you ever helped your company to save money or use their available financial resources effectively?

Ans.Explain if you have proposed an idea which has affected the company’s finances positively. Tell how you have optimised the process and how you came to such a decision through historical data reviewing.

Q16. If our organisation has three bank accounts for processing payments, what is the minimum number of ledgers it needs?

Ans.Three ledgers for each account for proper accounting and reconciliation processes.

Q17. What are some of the ways to estimate bad debts?

Ans.Some of the popular ways of estimating bad debts are – percentage of outstanding accounts, aging analysis and percentage of credit sales.

Q18. What is a deferred tax liability?

Ans.Deferred tax liability signifies that a company may pay more tax in the future due to current transactions.

Q19. What is a deferred tax asset and how is the value created?

Ans. A deferred tax asset is when the tax amount has been paid or has been carried forward but has still not been recognized in the income statement. The value is created by taking the difference between the book income and the taxable income

Q20. What is the equation for Acid-Test Ratio in accounting?

Ans.The equation for Acid-Test Ratio in accounting

Acid-Test Ratio = (Current assets – Inventory) / Current Liabilities

Q21. What are the popular accounting applications?

Ans.. I am familiar with accounting apps like CGram Software, Financial Force, Microsoft Accounting Professional, Microsoft Dynamics AX and Microsoft Small Business Financials.

Q22. Which accounting application you like the most and why?

Ans.. I find Microsoft Accounting Professional the best as it offers reliable and fast processing of accounting transactions, thereby saving time and increasing proficiency.

Q23. Tell me something about GST.

Ans.GST is the acronym for Goods and Service Tax and it is an indirect tax other than the income tax. The seller charges it to the customer on the value of the service or product sold. The seller then deposits the GST to the government.

Q24. What is bank reconciliation statement?

Ans.A bank reconciliation statement or BRS is a form that allows individuals to compare their personal bank account records to that of the bank. BRS is prepared when the passbook balance differs from the cashbook balance.

Q25. What is tally accounting?

Ans.It is an accounting software used by small business and shops to manage routine accounting transactions.

Q26. What are fictitious assets?

Ans. Fictitious assets are intangible assets and their benefit is derived over a longer period, for example good will, rights, deferred revenue expenditure, miscellaneous expenses, preliminary expenses, and accumulated loss, among others.

Q27. Can you explain the basic accounting equation?

Ans.Yes, since we know that accounting is all about assets, liabilities and capital. Hence, its equation can be summarized as:

Assets = Liabilities + Owners Equity.

Q28. What are the different branches of accounting?

Ans.There are three branches of accounting –

  • Financial Accounting
  • Management Accounting
  • Cost Accounting

Q29. What is the meaning of purchase return in accounting?

Ans.As the name suggests, purchase return is a transaction where the buyer of merchandise, inventory or fixed assets returns these defective or unsatisfactory products back to the seller.

Q30. What is retail banking?

Ans.Retail banking or consumer banking involves a retail client, where individual customers use local branches of larger commercial banks.

 

Q31. What is offset accounting?

Ans.Offset accounting is a process of canceling an accounting entry with an equal but opposite entry. It decreases the net amount of another account to create a net balance.

Q32. What are trade bills?

Ans.These are the bills generated against each transaction. It is a part of documentation procedure for all types of transactions.

Q33. What is fair value accounting?

Ans. As per fair value accounting, a company has to show the value of all of its assets in terms of price on balance sheet on which that asset can be sold.

Q34. What happens to the cash, which is collected from the customers but not recorded as revenue?

Ans.It goes into “Deferred Revenue” on the balance sheet as a liability if no revenue has been earned yet.

Q35. Why did you choose accounting as your profession?

Ans.. I was good at numbers and accounting since my school days, but it was during my 10+2; I decided to adopt this field as a profession and did Bachelor’s and then Master’s in Accounting

Q36. What is a MIS report, have you prepared any?

Ans.Yes, I have prepared MIS reports. It is an acronym for Management Information System, and this report is generated to identify the efficiency of any department of a company.

Q37. What is a company’s payable cycle?

Ans.. It is the time required by the company to pay all its account payables.

Q38. What is Scrap Value in accounting?

Ans.. Scrap Value is the residual value of an asset that any asset holds after its estimated lifetime

Q39. Which account is responsible for interest payable?

Ans. Current liability account is responsible for interest payable.

Q40. What is departmental accounting system?

Ans.It is a type of accounting information system that records all the financial information and activities of the department. This financial information can be used to check profitability and efficiency of every department.

Q41. What is a perpetual inventory system?

Ans.Perpetual inventory is a methodology that involves recording the sale or purchase of inventory immediately using enterprise asset management software and computerized point-of-sale systems.

Q42. What do you mean when you say that you have negative working capital?

Ans.When a company’s current liabilities exceed its current assets, it is named as negative working capital. It is a common terminology in certain industries like retail and restaurant businesses.

Q43. What are the major constraints that can hamper relevant and reliable financial statements?

Ans.

  1. Delay, which leads to irrelevant information
  2. No balance between costs and benefits
  3. No balance between the qualitative characteristics
  4. No clarity in true and fair view presentation

Q44. Tell me the golden rules of accounting, just mention the statements.

Ans.There are three golden rules of accounting –

  • Debit the receiver, credit the giver
  • Debit what comes in, credit what goes out
  • Debit all expenses and losses, credit all incomes and gains

Q45. Please elaborate, what this statement means – “Debit the Receiver, Credit the Giver”.

Ans.So, this is among the most frequently asked accounting interview questions. Your reply should be –

This principle is used in the case of personal accounts. If a person is giving any amount either in cash or by cheque to an organization, it becomes an inflow and thus that person must be credited in the books of accounts. Therefore, when an organization received the money or cheque, it needs to credit the person who is paying and debit the organization.

Q46. Any idea what is ICAI?

Ans.Of course, it is the abbreviation of Institute of Chartered Accountants in India

Q47. What do you mean by premises?

Ans.Premises refer to fixed assets presented on a balance sheet.

Q48. What is Executive Accounting?

Ans.Executive Accounting is specifically designed for the service-based businesses. This term is popular in finance, advertising and public relations businesses.

Q49. What are bills receivable?

Ans.Bills receivable are the proceeds or payments, which a merchant or a company will be receiving from its customers.

When replying to accounting interview questions, be very specific and don’t speak up generic stuff.

Q50. Define Balancing.

Ans.Balancing means equating or balancing both debit and credit sides of a T-account.

Q51. What is Marginal Cost?

Ans.If there is any increase in the number of units produced, the total cost of output is changed. Marginal cost is that change in the cost of an additional unit of output.

Q52. What are Trade Bills?

Ans.Every transaction is documented and the trade bills are those documents, generated against each transaction.

Q53. Can you define the term Material Facts?

Ans.Yes, these are the documents such as vouchers, bills, debit and credit notes, or receipts, etc. They serve as the base of every account book.

Q54. What are the different stages of Double Entry System?

Ans.There are three different stages of double entry system, which are –

  • Recording transactions in the accounting systems
  • Preparing a trial balance in respective ledger accounts
  • Preparing final documents and closing the books of accounts

Q55. What are the disadvantages of a Double Entry System?

Ans.

  • Difficult to find the errors, especially when transactions are recorded in the books
  • In case of any error, extensive clerical labor is required
  • You can’t disclose all the information of a transaction, which is not properly recorded in the journal

Q56. What is Assets Minus Liabilities?

Ans.It stands for an owner’s or a stockholder’s equity.

Q57. What is GAAP?

AnsGAAP is the abbreviation for Generally Accepted Accounting Principles (GAAP) issued by the Institute of Chartered Accountants of India (ICAI) and the provisions of the Companies Act, 1956.  It is a cluster of accounting standards and common industry usage, and it is used by organizations to:

  • Record their financial information properly
  • Summarize accounting records into financial statements
  • Disclose information whenever required

Q58. Can you tell me some examples for liability accounts?

Ans.Some popular examples of liability accounts are –

  • Accounts Payable
  • Accrued Expenses
  • Bonds Payable
  • Customer Deposits
  • Income Taxes Payable
  • Installment Loans Payable
  • Interest Payable
  • Lawsuits Payable
  • Mortgage Loans Payable
  • Notes Payable
  • Salaries Payable
  • Warranty Liability

Q59. What is the difference between accounts receivable and deferred revenue?

Ans.Accounts receivable is yet-to be received cash from products or services that are already sold/delivered to customers, whereas, deferred revenue is the cash received from customers for services or goods not yet delivered.

Q60. Where should you record a cash discount in journal entry?

Ans.A cash discount should be recorded as a reduction of expense in cash account.

Q61. Explain ‘financial modelling’.

Ans. . Financial modelling is a quantitative analysis commonly used for either asset pricing or general corporate finance.

 

Q62. Walk me through a ‘cash flow statement.’

Ans.You’ll have to be well-prepared for this question. Start with the net income and go line by line explaining all major adjustments to arrive at cash flow from operating activities. Mention all the necessary parts that are associated with it.

Q63. Is it possible for a company to have positive cash flow but still be in serious financial trouble?

Ans.

Q64. What do you think is the best evaluation metric for analysing a company’s stock?

Ans.  Yes. There are two examples –

(i) a company that is selling off inventory but delaying payables will show positive cash flow for a while even though it is in trouble.
(ii) A company has strong revenues for the period but future forecasts show that revenues will decline.

Q65. What is ‘working capital’?

Ans. Working capital is the best defined as current assets minus current liabilities.

Q66. Explain quarterly forecasting and expense models?

Ans.The analysis of expenses and revenue which is predicted to be produced or incurred in future is called quarterly forecasting.

An expense model tells what expense categories are allowed on a particular type of work order.

Q67. What is the difference between a journal and a ledger?

Ans.The journal is a book where all the financial transactions are recorded for the first time. The ledger is one which has particular accounts taken from the original journal.

Q68. Mention one difference between a P&L statement and a balance sheet?

AnsThe balance sheet summarises the financial position of a company for a specific point in time. The P&L (profit and loss) statement shows revenues and expenses during a set period of time.

 

Q69. What is ‘cost accountancy’?

Ans.Cost accountancy is the application of costing and cost accounting principles, methods and techniques to the science, art and practice of cost control and the ascertainment of profitability as well as the presentation of information for the purpose of managerial decision making.

Q70. What is NPV? Where is it used?

AnsNet Present Value (NPV) is the difference between the present value of cash inflows and the present value of cash outflows. NPV is used in capital budgeting to analyse the profitability of a projected investment or project.

Q71. How many financial statements are there? Name them

Ans.There are four main financial statements – 1) balance sheets, 2) income statements, 3) cash flow statements, and 4) statements of shareholders’ equity.

Q72. What are ‘adjustment entries’?

Ans. Adjustment entries are accounting journal entries that convert a company’s accounting records to the accrual basis of accounting.

Q73. Do you follow the stock market? Which stocks in particular?

Ans. You need to be very careful in answering this question. As a financial analyst, following the stock market proves to be beneficial. Also, always be up-to-date with the stocks.

Q74. What is a ‘composite cost of capital’?

Ans. Also known as the weighted average cost of capital (WACC), a composite cost of capital is a company’s cost to borrow money given the proportional amounts of each type of debt and equity a company has taken on.

WACC= Wd (cost of debt) + Ws (cost of stock/RE) + Wp (cost of pf. Stock

Q75. What is ‘capital structure’?

Ans.The capital structure is how a firm finances its overall operations and growth by using different sources of funds.

Q76. What is a ‘goodwill’?

Ans.Goodwill is an asset that captures excess of the purchase price over fair market value of an acquired business.

Q77. Why did you select accounting as your profession?

Ans.Well, I was quite good at accounting throughout, but in my masters, when I got a distinction, I decided to adopt this field as a profession.

Q78. Do you have any professional experience in this field?

Ans.Yes, I have worked as an accountant at two different places.

Q79. Did you use accounting applications at your previous companies or prefer working manually??

Ans. Yes, I have used Advanced Business Solutions and AME Accounting Software in my previous jobs.

Q80 Can you name any other accounting application?

Ans.Yes, I am familiar with CGram Software, Financial Force, Microsoft Accounting Professional, Microsoft Dynamics AX and Microsoft Small Business Financials.

Q81 Which accounting application you prefer most and why?

Ans.I think all are good though, but Microsoft Accounting Professional is best because it offers reliable and fast processing of accounting transactions that saves time and increases proficiency. It helps with financial analysis as well.

Q82 What is the abbreviation for the accounting terms debit and credit?

Ans.The debit abbreviation is “dr” and credit abbreviation is “cr”.

Q83 How many types of business transactions are there in accounting?

Ans.There are two types of transactions in accounting, i.e. revenue and capital.

Q84 What is the balance sheet?

Ans.It is a statement that states all the liabilities and assets of the company at a certain point.

Q85 Have you ever heard about TDS, what it is?

Ans.Yes, TDS abbreviates Tax Deduction at Source.

Q86.Do you think there is any difference between inactive and dormant accounts?

Ans.Yes, both are different terms in accounting. Inactive accounts mean that accounts have been closed and will not be used in the future as well. While dormant accounts are those that are not functional today but may be used in the future.

Q87.What is tally accounting?

Ans.It is the software used for accounting in small business and shops for managing routine accounting transactions.

Q88. By saying, perpetual or periodic inventory system; what do we mean?

Ans.In the first one, i.e. the perpetual inventory system, the accounts are adjusted on a continual basis. In the periodic inventory system, the accounts are adjusted periodically.

Q89. In accounting, how do you define the premises?

Ans.Premises refer to fixed assets that are shown in the balance sheet.

Q90. What is a CPA?

Ans.CPA stands for Certified Public Accountant. To become a CPA, one should have to do many other qualifications as well. It is a qualification with a 150-hour requirement. It means that one should complete 150 credit hours at an accredited university.

Q91 Define Public accounting?

Ans. Public accounting offers audits and CPAs to review company financial records to ensure accountability. It is for the general public.

Q92.Define Executive accounting?

Ans.It is a type of accounting that is specifically designed for the business that offers services to users.

Q93. Differentiate Accounting and Auditing?

Ans.Accounting is all about recording daily business activities while auditing is the checking that whether all these events have been noted down correctly or not.

Q94 What do we mean by purchase return in accounting?

Ans.It is the term introduced in the records for every defective or unsatisfactory good returned back to its supplier.

Q95. Define the term material facts in accounting?

Ans.Material facts are the bills or any document that becomes the base of every account book. It means that all those documents, on which account book is prepared, are called material facts.

Q96.Have you ever made MIS reports and what are they?

Ans.Yes, I have prepared a few MIS reports during my previous jobs. MIS reports are created to identify the efficiency of any department of a company.

Q97. Define a company's payable cycle?

Ans.It is the time required by the company to pay all its account payables.

Q98. How much mathematics knowledge is necessary or required in accounting?

Ans.Not much knowledge but basic mathematical background is required in accounting for operations like addition, subtraction, multiplication, and division.

Q99. Differentiate between consignor and consignee?

Ans.Consigner is the owner of the goods, or you can say he is the person who delivers the goods to the consignee. The consignee is the person who receives the goods.

Q100. Define Partitioning in accounting?

Ans.It is a kind of groups made on the basis of the same responses by a system.

Q101. Differentiate Accounting and Auditing?

Ans.Accounting is all about recording daily business activities while auditing is the checking that whether all these events have been noted down correctly or not.

Q102. Define Offset accounting?

Ans.Offset accounting is one that decreases the net amount of another account to create a net balance.

Q103.Define trade bills?

Ans.We know that all types of transactions need to be documented. The trade bills are the documents, generated against each transaction.

Q104.Under the accrual basis of accounting, when revenues are reported in the accounting period?

Ans.When service or goods have been delivered, then revenues are reported in the accounting period.

Q105. Explain what a deferred asset is and give an example?

Ans.A deferred asset refers to a deferred debit or a deferred charge. An example of a deferred charge is bond issue costs. These costs involve all of the fees or charges that an organization incurs in order to register and issue bonds. These fees are paid in a near time when the bonds are issued but it will not be expensed at that time.

Q106.What is "deposit in transit"?

Ans.A deposit in transit is a check or cash that have been received and recorded by an entity, but which have not yet been entered in the records of the bank where the funds are deposited.

Q107. What is an over accrual?

Ans.An over accrual is a condition where the estimate for an accrual journal entry is too high. This estimate may apply to the accrual of expense or revenue.

Q108.) What happens to the company's "Cash Account" if it borrows money from the bank by signing a note payable?

Ans.Due to double entry, the “cash account” will increase as such the liability account increases.

Q109. What is reversing journal entries?

Ans.Reversing journal entries are entries made at the beginning of an accounting period to cancel out the adjusting journal entries made at the end of the previous accounting period.

Q110.Deferred taxation is a part of which equity?

Ans.Deferred taxation is a part of the owner’s equity

Q111.What is the equation for Acid-Test Ratio in accounting?

Ans.The equation for Acid-Test Ratio in accounting

Acid-Test Ratio = (Current assets – Inventory) / Current Liabilities

Q112.Mention why some asset accounts have a credit balance?

Ans.Some asset accounts have a credit balance due to the following reasons,

  • Receiving and posting an amount that was higher than the recorded receivable
  • Expenses occurred faster than the agreed upon prepayments
  • An error caused by posting an amount to a wrong account
  • The amount of checks written exceeded the positive amount in the Cash account
  • Continuing to amortize or depreciate an asset after its balance has reached zero

Q113. What is the Master Account?

Ans.A Master Account has subsidiary accounts. A master account receivable could be anything, it could be account receivable for various individual receivable accounts.

Q114. What is Bad debt expense?

Ans.A Bad debt expense is the amount of an account receivable that is considered to NOT be collectible.

Q115.In which account does the unpresented cheque will get recorded?

Ans.The unpresented cheque will get recorded as a credit to the cash account in the company’s General ledger.

Q116.What knowledge should financial accountant have?

Ans.A certified financial accountant should have knowledge about

  • Accounting/Bookkeeping principles and practices
  • Reporting and analysis of financial data
  • Auditing practices and principles
  • Account management
  • Budgets
  • Software knowledge dealing with Accounting
  • Knowledge of relevant laws, codes, and regulations
  • Good soft skills
  • Being a team player
  • Ability to learn quickly and up skill
  • Basic Technical skills

Q117.What are the three factors that can affect your cash flow and business profitability?

Ans.The three factors that can affect your cash flow and business profit includes

  • Cash flows from investing activities: It includes shares, bonds, physical property, machinery, etc.
  • Cash flows from operating activities: It does not include cash received from other sources like investments
  • Cash flow from financing activities: It includes any activities that involve dividend payments that the company made to its shareholders, any money that includes stock to the public, any money borrowed from the lender, etc. in other words, it is a report that tells the firm about the money borrowed and paid out in order to finance its activities.

Q118.Explain what is accrual accounting?

Ans.Accrual Accounting is a method for measuring the performance and position of the company by identifying economic events regardless of when the cash transaction happened. In this method, revenue is compared with the expenditures, at the time in which the transaction happens rather than when the payment is made.

Q119. Explain the term account payable?

Ans.Account payable is referred to as the amount the company owes to its suppliers, its employees, and its partners. In other words, it is the basic cost levied on the company to run a business process that is outstanding. Account payable for one company may be account receivable for another firm or company.

Q120.) Explain the meaning of long-term notes payable is or long term liabilities?

Ans.Long-term notes payable or liabilities are referred for that loan that is not supposed to due for more than a year. These are the loans from banks or financial institution that are secured against various assets on the balance sheet, such as inventories.

Q121.What does the financial statement of the company include?

Ans.Financial statement of the company includes various information like

  • Balance Sheet ( Assets, liabilities, and equity)
  • Income statement ( Profit or Loss statement)
  • Equity statement
  • Cash flow statement

Q122. Explain what is GAAP?

AnsGAAP means Generally Accepted Accounting Principle; it is a framework of accounting, standards, procedures & rules determined by the professional accounting industry and practiced by publicly traded U.S companies all over the U.S.A.

Q123. Mention the types of ledgers?

Ans.There are three types of ledger

  • General ledger
  • Debtors ledger
  • Creditors ledger

Q124.Explain what is double-entry accounting? Explain with an example?

Ans.Double entry accounting is an accounting system that requires recording business transaction or event in at least two accounts. It is the same concept of accounting, where every debit account should be matched with a credit account.

For example, if a company takes a loan from a bank, it receives cash as an asset but at the same time, it creates a liability on a company. This single entry will affect both accounts, the asset accounts, and the liabilities accounts, such entry is referred to as double entry accounting.

Q125.. Explain What Is Cash Flow And Fund Flow?

Ans.Cash flow and funds flow: cash flow means direct entry of cash in your business and exit of the same funds flow means entry of funds (cash funds or non cash funds) and their exit non cash funds may mean rise in current assets or fall in current liabilities which was not due to any cash movement.

Q126. Is There A Difference Between Accounting For Conversion Of Bonds And Accounting For The Conversion Of Preferred Stock?

Ans.Bonds have discounts and premiums and accrued interest. Preferred Stock does not.

Q127.How Many Invoices On Average Do You Handle On A Weekly/monthly Basis?

Ans.Show your understanding of the invoice verification process. Go through each step in detail such as checking that goods have been received in proper condition or services rendered in a satisfactory manner. Explain the importance of each step.

Q128.Explain What Is Customer Account?

Ans.Debtors account and bills receivable account are theoretically same. Both are called as receivables. When we sold goods to debtors account is debited. If we receive a bill from that debtor, we open bills receivable account by closing that debtor account. Thus, bills receivable account is nothing but debtor account.

If the bill is dishonored on the due date, we again debit the debtor account in our books. For information and accounting purpose, we use both debtor account and bills receivable account.

Q129.Were You Happy With The Grades You Achieved At A-level?

Ans.Chartered Accountancy firms put a lot of weight on A-level grades as these have been found to be the best predictors of success in professional examinations.

If your A levels were not outstanding, this may sometimes depend more on the quality of the school you attended than your ability. In some inner-city schools it may be that a mediocre A-level performance that you achieved might have been the best in your school – if this is so, then make it clear. An average performance at a weak school academically may be the equivalent of a much better performance at some prestigious establishments.

Similarly, if there were any other external factors, such as illness, that may have affected your grades, tell the interviewers – but don’t sound as though you are making excuses.

Q130. What is the difference between depreciation and amortization?

Method Overloading

Depreciation

  • Depreciate means to lose the value of an asset due to their usage, wear and tear, outdated, etc.
  • The depreciation cost is calculated in terms of tangible assets like furniture, plant & machinery, building, etc.
  • The purpose of calculating depreciation costs recovery
  • The easiest way to calculate depreciation is to know the loss of value of an asset over its life.
  • For example, a car worth $30,000 has estimated the lifetime of 10 years after that it will have no value in the market. The cost or loss in value throughout these 10 years is known as depreciation
  • Various method for depreciation includes straight-line depreciation, declining balance method, group depreciation method, unit of     time/production depreciation method, etc.           

Method Overriding​

Amortization

  • Amortize means to write off or pay the debt over a period of time. Amortization can be for loans, or it can be for Intangible assets
  • Amortization cost is calculated in terms of intangible assets like goodwill, trademark, loans, patents, etc.
  • The purpose of calculating amortization is also for cost recovery
  • Amortization calculates the amount spent after the intangible assets throughout the life for that asset
  • For example, Pharmaceutical Company spent $20 million dollars on a drug patent with a useful life of 20 years. The amortization value for that company will be $1 million each year
  • Various method for amortization is negative amortization, zoning amortization, business amortization, etc.

Q131.Define the term material facts in accounting?

Ans.Material facts are the bills or any document that becomes the base of every account book. It means that all those documents, on which account book is prepared, are called material facts.

Q132. Define Offset accounting?

Ans.Offset accounting is one that decreases the net amount of another account to create a net balance.

Q133.What is the difference between accumulated depreciation and depreciation expense?

Ans.The difference between accumulated depreciation and depreciation expense is that

  • Accumulated depreciation: It is the total amount of depreciation that has been taken on a company’s assets up to the date of the balance sheet
  • Depreciation expense: It is the amount of depreciation that is reported on the income statement. Basically, it is the amount that corresponds only to the period of time indicated in the heading of the income statement.

Q134. Explain what a deferred asset is and give an example?

Ans.A deferred asset refers to a deferred debit or a deferred charge. An example of a deferred charge is bond issue costs. These costs involve all of the fees or charges that an organization incurs in order to register and issue bonds. These fees are paid in a near time when the bonds are issued but it will not be expensed at that time.

Q135.What is the Master Account?

Ans.A Master Account has subsidiary accounts. A master account receivable could be anything, it could be account receivable for various individual receivable accounts.

Q136.Tell Me What Is Accounting Normalization?

Ans.It is removing items from the income statement or balance sheet that do not normally occur during the course of business to better estimate the value of a company.

Q137.. Explain What Is Service Tax?

Ans.When any employer provides any service to his customer, which income is excess under the tax then company liable for the pay tax.In addition, service tax deposited of in under 5 days who you charged service tax to his customers.In the payment of Service tax amount you can Credit availed during of the month.

Q138. What is Wacc?

Ans.It denotes weighted average cost of capital. It is defined as the overall cost of capital computed by reference to the proportion of each component of capital as weights.

Q139. What is financial . Financial break-even point?

Ans.It denotes the level at which a firm’s EBIT is just sufficient to cover interest and preference dividend.

Q140.What i s Treasury management?

Ans.It means it is defined as the efficient management of liquidity and financial risk in business.

Q141. What is . Maximum permissible bank finance (MPBF)?

Ans.It is the maximum amount that banks can lend a borrower towards his working capital requirements.

Q142. What are Commercial paper?

Ans.A cp is a short term promissory note issued by a company, negotiable by endorsement and delivery, issued at a discount on face value as may be determined by the issuing company.

Q143. What is Bridge finance?

Ans.It refers to the loans taken by the company normally from commercial banks for a short period pending disbursement of loans sanctioned by the financial institutions.

Q144. What is ICD (Inter corporate deposits)?

Ans.Companies can borrow funds for a short period. For example 6 months or less from another company which have surplus liquidity? Such deposits made by one company in another company are called ICD.

Q145. What do you mean by certificate of deposits?

Ans. The CD is a document of title similar to a fixed deposit receipt issued by banks there is no prescribed interest rate on such CDs it is based on the prevailing market conditions.

Q146.What is Euro issues?

Ans.The euro issues means that the issue is listed on a European stock Exchange. The subscription can come from any part of the world except India.

Q147. What is Zero- base- budgeting?

Ans.It is a management tool which provides a systematic method for evaluating all operations and programmes, current of new allows for budget reductions and expansions in a rational inner and allows reallocation of source from low to high priority programs.

Q148. What is Hedging?

Ans.Hedging means minimize the risk.

Q149.What is Contingent liability?

Ans.An obligation to an existing condition or situation which may arise in future depending on the occurrence of one or more uncertain future events.

Q150. What is Contingency?

Ans.A condition (or) situation the ultimate out comes of which gain or loss will be known as determined only as the occurrence or non occurrence of one or more uncertain future events.

Q130. What is the difference between depreciation and amortization?

Method Overloading

Method Overriding​


Python Interview Questions and Answers

Category : News

Interview Questions
&
Answers

Python Interview questions and Answers

In simple way Meaning of Analogy is “Similarity ” or compassion between one thing and other thing base d on some similarity 

250 + Python interview Question and Answer

1. What type of a language is python? Interpreted or Compiled?

Beginner’s Answer:
Python is an interpreted, interactive, object­oriented programming language.
Expert Answer:
Python is an interpreted language, as opposed to a compiled one, though the
distinction can be blurry because of the presence of the bytecode compiler. This means
that source files can be run directly without explicitly creating an executable which is
then run.

2.What do you mean by python being an “interpreted language”? (Continues from previous question)

An interpreted language is a programming language for which most of its implementations execute instructions directly, without previously compiling a program into machine­ language instructions. In context of Python, it means that Python program runs directly from the source code.

3. What is python’s standard way of identifying a block of code?  

Indentation.   

4.Please provide an example implementation of a function called “my_func”  that returns the square of a given variable “x”. (Continues from previous  question) 

def my_func ( x ):  

 return x **2 

5. Is python statically typed or dynamically typed? 

  Dynamic.  

 In a statically typed language, the type of variables must be known (and usually  declared) at the point at which it is used. Attempting to use it will be an error. In a  dynamically typed language, objects still have a type, but it is determined at runtime.  You are free to bind names (variables) to different objects with a different type. So long  as you only perform operations valid for the type the interpreter doesn’t care what type  they actually are.   

6. Is python strongly typed or weakly typed language? 

 Strong. 

 In a weakly typed language a compiler / interpreter will sometimes change the  type of a variable. For example, in some languages (like  JavaScript ) you can add  strings to numbers ‘x’ + 3 becomes ‘x3’. This can be a problem because if you have  made a mistake in your program, instead of raising an exception execution will continue  but your variables now have wrong and unexpected values. In a strongly typed  language (like Python) you can’t perform operations inappropriate to the type of the  object ­ attempting to add numbers to strings will fail. Problems like these are easier to  diagnose because the exception is raised at the point where the error occurs rather than  at some other, potentially far removed, place.   

7.Create a unicode string in python with the string “This is a test string”? 

some_variable = u ‘ This is a test string ‘  

Or

  some_variable = u ” This is a test string

8. What is the python syntax for switch case statements? 

Python doesn’t support switch­case statements. You can use if­else statements  for this purpose.  

9. What is a lambda statement? Provide an example. 

A lambda statement is used to create new function objects and then return them at  runtime. 

Example:  my_func = lambda x : x **2  

 creates a function called my_func that returns the square of the argument  passed.

10..What are the rules for local and global variables in Python? 

If a variable is defined outside function then it is  implicitly global . If variable is  assigned new value inside the function means it is local . If we want to make it global we need to explicitly define it as global. Variable referenced inside the function are implicit  global 

 

11..What is the output of the following program? 
#!/usr/bin/python   
  def fun1 ( a ): 
 print 'a:' , a 
 a = 33; 
  print 'local a: ' , a  
 a = 100  
 fun1 ( a)
 print 'a outside fun1:' , a      

#!/usr/bin/python    

 def fun1 ( a ): 

 print ‘a:’ , a   a = 33; 

  print ‘local a: ‘ , a 

   a = 100 

  fun1 ( a)  

 print ‘a outside fun1:’ , a    

 Ans. 

 Output:  a : 100

 local a : 33  

 a outside fun1 : 100

12..What is the output of the following program? 

#!/usr/bin/python

def fun2():

        global b

         print ‘b: ‘ , b 

         b   =  33

         print ‘global b:’ , b

b = 100

fun2()

print ‘b outside fun2’ , b

Output: 

 b : 100   global 

b : 33

b outside fun2 : 33 

13.What is the output of the following program? 

#!/usr/bin/python

def foo(x, y):

           global a

            a = 42

            x,y = y,x

            b  =33

            b  = 17

            c = 100

            print(a,b,x,y)

a,b,x,y=1,15,3,4foo

(

17

,

4)

print

(

a

,

b

,

x

,

y

Output: 

 b : 100   global 

b : 33

b outside fun2 : 33 

9) What is difference between c++ and Java ?

Interface

  •  Java is platform independent
  • There are no pointers in java
  • There is no operator overloading in java
  • There is garbage collection in java
  • Supports multithreading
  • There are no templates in java
  • There are no global variables in java

Abstract Class

  • C++ is platform dependent.
  • There are pointers in C++
  • C ++ has operator overloading.
  • There is no garbage collection
  • Does’nt support multithreading
  • There are templates in java
  • There are global variables in c++

12) Difference between this() and super() in java ?

this() is used to access one constructor from another with in the same class while super() is used to access superclass constructor. Either this() or super() exists it must be the first statement in the constructor.


java interview question and answers

Category : News

Interview Questions
&
Answers

Java Interview questions and Answers

In simple way Meaning of Analogy is “Similarity ” or compassion between one thing and other thing base d on some similarity 

250 + Java Question and Answer

1.what are static blocks and static initalizers in Java ?

Static blocks or static initializers are used to initalize static fields in java. we declare static blocks when we want to intialize static fields in our class. Static blocks gets executed exactly once when the class is loaded . Static blocks are executed even before the constructors are executed.

2) How to call one constructor from the other constructor ?

With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called.

Restrictions for using this method :

1) this must be the first statement in the constructor

2)we cannot use two this() methods in the constructor

3) What is method overriding in java ?

If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by superclass.

When to use overriding in java If we want same method with different behaviour in superclass and subclass then we go for overriding. When we call overridden method with subclass reference subclass method is called hiding the superclass method.

4) What is super keyword in java ?

Variables and methods of super class can be overridden in subclass . In case of overriding , a subclass object call its own variables and methods. Subclass cannot access the variables and methods of superclass because the overridden variables or methods hides the methods and variables of super class. But still java provides a way to access super class members even if its members are overridden. Super is used to access superclass variables, methods, constructors.

Super can be used in two forms :

1) First form is for calling super class constructor.

2) Second one is to call super class variables,methods.

Super if present must be the first statement.

5) Difference between method overloading and method overriding in java ?

Method Overloading

  •  Method Overloading occurs with in the same class
  • Since it involves with only one class inheritance is not involved.                                        
  • In overloading return type need not be the same
  • Parameters must be different when we do overloading
  • Static polymorphism can be acheived using method overloading
  • In overloading one method can’t hide the another

Method Overriding​

  • Method Overriding occurs between two classes superclass and subclass
  • Since method overriding occurs between superclass and subclass inheritance is involved.
  • In overriding return type must be same.          
  • Parameters must be same.                              
  • Dynamic polymorphism can be acheived using method overriding
  • In overriding subclass method hides that of the superclass method.

6) Difference between abstract class and interface ?

Interface

  • Interface contains only abstract methods       
  • Access Specifiers for methods in interface must be public
  • Variables defined must be public , static final
  • Multiple Inheritance in java is implemented using interface
  • To implement an interface we use implements keyword

Abstract Class

  • Abstract class can contain abstract methods, concrete methods or both
  • Except private we can have any access specifier for methods in abstract class.
  • Except private variables can have any access specifiers
  • We cannot achieve multiple inheritance using abstract class
  • To implement an interface we use implement keyword

7) Why java is platform independent?

The most unique feature of java is platform independent. In any programming language soruce code is compiled in to executable code . This cannot be run across all platforms. When javac compiles a java program it generates an executable file called .class file.

class file contains byte codes. Byte codes are interpreted only by JVM’s . Since these JVM’s are made available across all platforms by Sun Microsystems, we can execute this byte code in any platform. Byte code generated in windows environment can also be executed in linux environment. This makes java platform independent.

8) What is method overloading in java ?

A class having two or more methods with same name but with different arguments then we say that those methods are overloaded. Static polymorphism is achieved in java using method overloading. Method overloading is used when we want the methods to perform similar tasks but with different inputs or values. When an overloaded method is invoked java first checks the method name, and the number of arguments ,type of arguments; based on this compiler executes this method. Compiler decides which method to call at compile time. By using overloading static polymorphism or static

binding can be achieved in java.

Note : Return type is not part of method signature. we may have methods with different return types but return type alone is not sufficient to call a method in java.

9) What is difference between c++ and Java ?

Interface

  •  Java is platform independent
  • There are no pointers in java
  • There is no operator overloading in java
  • There is garbage collection in java
  • Supports multithreading
  • There are no templates in java
  • There are no global variables in java

Abstract Class

  • C++ is platform dependent.
  • There are pointers in C++
  • C ++ has operator overloading.
  • There is no garbage collection
  • Does’nt support multithreading
  • There are templates in java
  • There are global variables in c++

10) What is bytecode in java ?

JIT compiler stands for Just in time compiler. JIT compiler compiles byte code in to executable code . JIT a part of JVM .JIT cannot convert complete java program in to executable code it converts as and when it is needed during execution.

11) What is bytecode in java ?

When a javac compiler compiler compiles a class it generates .class file. This .class file contains set of instructions called byte code. Byte code is a machine independent language and contains set of instructions which are to be executed only by JVM. JVM can understand this byte codes.

12) Difference between this() and super() in java ?

this() is used to access one constructor from another with in the same class while super() is used to access superclass constructor. Either this() or super() exists it must be the first statement in the constructor.

13) What is a class ?

Classes are fundamental or basic unit in Object Oriented Programming .A class is kind of blueprint or template for objects. Class defines variables, methods. A class tells what type of objects we are creating. For example take Department class tells us we can create department type objects. We can create any number of department objects.

All programming constructs in java reside in class. When JVM starts running it first looks for the class when we compile. Every Java application must have atleast one class and one main method. Class starts with class keyword. A class definition must be saved in class file that has same as class name. File name must end with .java extension.

public class FirstClass

{public static void main(String[] args)

{System.out.println(“My First class”);

}

}

If we see the above class when we compile JVM loads the FirstClass and generates a .class file(FirstClass.class). When we run the program we are running the class and then executes the main method.

14) What is an object ?

An Object is instance of class. A class defines type of object. Each object belongs to some class.Every object contains state and behavior. State is determined by value of attributes and behavior is called method. Objects are alos called as an instance.                                 

To instantiate the class we declare with the class type.

public classFirstClass {public static voidmain(String[] args)

{

FirstClass f=new FirstClass();

System.out.println(“My First class”);

}

}

To instantiate the FirstClass we use this statement

FirstClass f=new FirstClass();

f is used to refer FirstClass object              

15) What is an object ?

It contains the executable body that can be applied to the specific object of the class.

Method includes method name, parameters or arguments and return type and a body of executable code.

Syntax : type methodName(Argument List){

}

ex : public float add(int a, int b, int c) methods can have multiple arguments. Separate with commas when we have multiple arguments.

16) What is encapsulation ?

The process of wrapping or putting up of data in to a single unit class and keeps data safe from misuse is called encapsulation .

Through encapsulation we can hide and protect the data stored in java objects.Java supports encapsulation through access control. There are four access control modifiers in java public , private ,protected and default level.

For example take a car class , In car we have many parts which is not required for driver to know what all it consists inside. He is required to know only about how to start and stop the car. So we can expose what all are required and hide the rest by using encapsulation.

17) Why main() method is public, static and void in java ?

public : “public” is an access specifier which can be used outside the class. When main method is declared public it means it can be used outside class.

static : To call a method we require object. Sometimes it may be required to call a method without the help of object. Then we declare that method as static. JVM calls the main() method without creating object by declaring keyword static. 

void : void return type is used when a method does’nt return any value . main() method does’nt return any value, so main() is declared as void.

Signature : public static void main(String[] args) {

18) Explain about main() method in java ?

Main() method is starting point of execution for all java applications.

public static void main(String[] args) {}

String args[] are array of string objects we need to pass from command line arguments.

Every Java application must have atleast one main method.

19)What is constructor in java ?

A constructor is a special method used to initialize objects in java.

we use constructors to initialize all variables in the class when an object is created. As and when an object is created it is initialized automatically with the help of constructor in java. We have two types of constructors
Default Constructor
Parameterized Constructor
Signature : public classname()
{
}
Signature : public classname(parameters list)
{
}

20) What is difference between length and length() method in java ?

length() : In String class we have length() method which is used to return the number of characters in string.
Ex : String str = “Hello World”;
System.out.println(str.length());
Str.length() will return 11 characters including space.
length : we have length instance variable in arrays which will return the number of values or objects in array.
For example :
String days[]={” Sun”,”Mon”,”wed”,”thu”,”fri”,”sat”};
Will return 6 since the number of values in days array is 6.

21) What is ASCII Code?

ASCII stands for American Standard code for Information Interchange. ASCII character range is 0 to 255. We can’t add more characters to the ASCII Character set. ASCII character set supports only English. That is the reason, if we see C language we can write c language only in English we can’t write in other languages because it uses ASCII code.

22) What is Unicode ?

Unicode is a character set developed by Unicode Consortium. To support all languages in the world Java supports Unicode values. Unicode characters were represented by 16 bits and its character range is 0-65,535.

Java uses ASCII code for all input elements except for Strings,identifiers, and comments. If we want to use Punjabi we can use Punjabi characters for identifiers.We can enter comments in Punjabi

23) What is Unicode ?

Character constant is enclosed in single quotes. String constants are enclosed in double quotes. Character constants are single digit or character. String Constants are collection of characters.

Ex :’2’, ‘A’

Ex : “Hello World”

24) What are constants and how to create constants in java?

Constants are fixed values whose values cannot be changed during the execution of program. We create constants in java using final keyword.

Ex : final int number =10;

final String str=”java-interview –questions”

25) Difference between ‘>>’ and ‘>>>’ operators in java?

>> is a right shift operator shifts all of the bits in a value to the right to a specified number of times.

int a =15;

a= a >> 3;

The above line of code moves 15 three characters right.

>>> is an unsigned shift operator used to shift right. The places which were vacated by shift are filled

with zeroes.

26) what are static blocks and static initalizers in Java ?

Static blocks or static initializers are used to initalize static fields in java. we declare static blocks when we want to intialize static fields in our class. Static blocks gets executed exactly once when the class is loaded . Static blocks are executed even before the constructors are executed.

27)How to call one constructor from the other constructor ?

With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called. Restrictions for using this method : 1) this must be the first statement in the constructor 2)we cannot use two this() methods in the constructor

28) What is method overriding in java ?

If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by superclass. When to use overriding in java If we want same method with different behaviour in superclass and subclass then we go for overriding. When we call overridden method with subclass reference subclass method is called hiding the superclass method

29) What is super keyword in java ?

Variables and methods of super class can be overridden in subclass . In case of overriding , a subclass object call its own variables and methods. Subclass cannot access the variables and methods of superclass because the overridden variables or methods hides the methods and variables of super class. But still java provides a way to access super class members even if its members are overridden. Super is used to access superclass variables, methods, constructors. Super can be used in two forms : 1) First form is for calling super class constructor. 2) Second one is to call super class variables,methods. Super if present must be the first statement.

30 Why java is platform independent?

The most unique feature of java is platform independent. In any programming language soruce code is compiled in to executable code . This cannot be run across all platforms. When javac compiles a java program it generates an executable file called .class file. class file contains byte codes. Byte codes are interpreted only by JVM’s . Since these JVM’s are made available across all platforms by Sun Microsystems, we can execute this byte code in any platform. Byte code generated in windows environment can also be executed in linux environment. This makes java platform independent.

31) What is method overloading in java ?

A class having two or more methods with same name but with different arguments then we say that those methods are overloaded. Static polymorphism is achieved in java using method overloading. Method overloading is used when we want the methods to perform similar tasks but with different inputs or values. When an overloaded method is invoked java first checks the method name, and the number of arguments ,type of arguments; based on this compiler executes this method. Compiler decides which method to call at compile time. By using overloading static polymorphism or static binding can be achieved in java. Note : Return type is not part of method signature. we may have methods with different return types but return type alone is not sufficient to call a method in java.

32) What is JIT compiler ?

JIT compiler stands for Just in time compiler. JIT compiler compiles byte code in to executable code . JIT a part of JVM .JIT cannot convert complete java program in to executable code it converts as and when it is needed during execution.

33) What is bytecode in java ?

When a javac compiler compiler compiles a class it generates .class file. This .class file contains set of instructions called byte code. Byte code is a machine independent language and contains set of instructions which are to be executed only by JVM. JVM can understand this byte codes.

34) Difference between this() and super() in java ?

this() is used to access one constructor from another with in the same class while super() is used to access superclass constructor. Either this() or super() exists it must be the first statement in the constructor.

35) What is a class ?

Classes are fundamental or basic unit in Object Oriented Programming .A class is kind of blueprint or template for objects. Class defines variables, methods. A class tells what type of objects we are creating. For example take Department class tells us we can create department type objects. We can create any number of department objects.

All programming constructs in java reside in class. When JVM starts running it first looks for the class when we compile. Every Java application must have atleast one class and one main method. Class starts with class keyword. A class definition must be saved in class file that has same as class name. File name must end with .java extension.

public class FirstClass {public static void main(String[] args)

{System.out.println(“My First class”);

}

}

If we see the above class when we compile JVM loads the FirstClass and generates a .class file(FirstClass.class). When we run the program we are running the class and then executes the main method.

 

36) What is an object ?

An Object is instance of class. A class defines type of object. Each object belongs to some class.Every object contains state and behavior. State is determined by value of attributes and behavior is called method. Objects are alos called as an instance. To instantiate the class we declare with the class type.

public classFirstClass {public static voidmain(String[] args)

{

FirstClass f=new FirstClass();

System.out.println(“My First class”);

}

}

To instantiate the FirstClass we use this statement FirstClass f=new FirstClass(); f is used to refer FirstClass object.

37)What is method in java ?

It contains the executable body that can be applied to the specific object of the class. Method includes method name, parameters or arguments and return type and a body of executable code.

Syntax : type methodName(Argument List){

}

ex : public float add(int a, int b, int c) methods can have multiple arguments. Separate with commas when we have multiple arguments.

38) What is encapsulation ?

The process of wrapping or putting up of data in to a single unit class and keeps data safe from misuse is called encapsulation .

Through encapsulation we can hide and protect the data stored in java objects.Java supports encapsulation through access control. There are four access control modifiers in java public , private ,protected and default level. 

For example take a car class , In car we have many parts which is not required for driver to know what all it consists inside. He is required to know only about how to start and stop the car. So we can expose what all are required and hide the rest by using encapsulation.

39) Why main() method is public, static and void in java ?

public : “public” is an access specifier which can be used outside the class. When main method is declared public it means it can be used outside class.

static : To call a method we require object. Sometimes it may be required to call a method without the help of object. Then we declare that method as static. JVM calls the main() method without creating object by declaring keyword static.

void : void return type is used when a method does’nt return any value . main() method does’nt return any value, so main() is declared as void.

Signature : public static void main(String[] args) {

40) Explain about main() method in java ?

Main() method is starting point of execution for all java applications. 

public static void main(String[] args) {} 

String args[] are array of string objects we need to pass from command line arguments. 

Every Java application must have atleast one main method.

41)What is constructor in java ?

we use constructors to initialize all variables in the class when an object is created. As and when an object is created it is initialized automatically with the help of constructor in java.

 We have two types of constructors 

Default Constructor

 Parameterized Constructor

 Signature : public classname()

 {

 } Signature : public classname(parameters list)

 {

 } 

42 )What is difference between length and length() method in java ?

length() : In String class we have length() method which is used to return the number of characters in string.

 Ex : String str = “Hello World”;

 System.out.println(str.length()); 

Str.length() will return 11 characters including space.

 length : we have length instance variable in arrays which will return the number of values or objects in array. 

For example : 

String days[]={” Sun”,”Mon”,”wed”,”thu”,”fri”,”sat”};

 Will return 6 since the number of values in days array is 6.

43) What is ASCII Code?

ASCII stands for American Standard code for Information Interchange. ASCII character range is 0 to 255. We can’t add more characters to the ASCII Character set. ASCII character set supports only English. That is the reason, if we see C language we can write c language only in English we can’t write in other languages because it uses ASCII code.   

44) What is Unicode ?

Unicode is a character set developed by Unicode Consortium. To support all languages in the world Java supports Unicode values. Unicode characters were represented by 16 bits and its character range is 065,535. 

Java uses ASCII code for all input elements except for Strings,identifiers, and comments. If we want to use telugu we can use telugu characters for identifiers.We can enter comments in telugu.

45) Difference between Character Constant and String Constant in java ?

Character constant is enclosed in single quotes. String constants are enclosed in double quotes. Character constants are single digit or character. String Constants are collection of characters.

Ex :’2’, ‘A’

Ex : “Hello World”

46) What are constants and how to create constants in java?

Constants are fixed values whose values cannot be changed during the execution of program. We create constants  in java using final keyword.

 Ex : final int number =10; 

final String str=”java-interview –questions” 

47) Difference between ‘>>’ and ‘>>>’ operators in java?

>> is a right shift operator shifts all of the bits in a value to the right to a specified number of times. int a =15; 

a= a >> 3; 

The above line of code moves 15 three characters right.

 >>>  is an unsigned shift operator used to shift right. The places which were vacated by shift are filled with zeroes.

48) Explain Java Coding Standards for classes or Java coding conventions for classes?

Sun has created Java Coding standards or Java Coding Conventions . It is recommended highly to follow java coding standards.

 Classnames should start with uppercase letter. Classnames names should be nouns. If Class name is of multiple words then the first letter of inner word must be capital letter.

 Ex : Employee, EmployeeDetails, ArrayList, TreeSet, HashSet 

49) Explain Java Coding standards for interfaces?

1)      Interface should start with uppercase letters

 2)      Interfaces names should be adjectives

 Example : Runnable, Serializable, Marker, Cloneable 

50) Explain Java Coding standards for Methods?

1)      Method names should start with small letters. 

2)      Method names are usually verbs 

3)      If method  contains multiple words, every inner word  should start with uppercase letter.

 Ex : toString()

 4)      Method name must be combination of verb and noun 

Ex : getCarName(),getCarNumber()   

51) Explain Java Coding Standards for variables ?

1)      Variable names should start with small letters. 

2)      Variable names should be nouns

 3)      Short meaningful names are recommended.

 4)   If there are multiple words every innerword should start with Uppecase character. Ex : string,value,empName,empSalary 

52)Explain Java Coding Standards for Constants?

Constants in java are created using static and final keywords.

 1)      Constants contains only uppercase letters. 

2)   If constant name is combination of two words it should be separated by underscore

3)      Constant names are usually nouns.

 Ex:MAX_VALUE, MIN_VALUE, MAX_PRIORITY, MIN_PRIORITY 

 

53) What is ‘IS-A ‘ relationship in java?

‘is a’ relationship is also known as inheritance. We can implement ‘is a’ relationship or inheritance in java using extends keyword. The advantage or inheritance or is a relationship is reusability of code instead of duplicating the code.

 Ex :  Motor cycle is a vehicle 

Car is a vehicle Both car and motorcycle extends vehicle. 

54) What is ‘HAS A’’ relationship in java?

‘Has a ‘ relationship is also known as “composition or Aggregation”. As in inheritance we have ‘extends’ keyword we don’t have any keyword to implement ‘Has a’ relationship in java.  The main advantage of ‘Has-A‘ relationship in java code reusability. 

55) Explain about instanceof operator in java?

Instanceof operator is used to test the object is of which type. Syntax : <reference expression> instanceof  <destination type> Instanceof returns true if  reference expression is subtype of destination type. Instanceof returns false if reference expression is null. 

Example :   public classInstanceOfExample {public static voidmain(String[] args) {Integer a = newInteger(5);if (a instanceof java.lang.Integer)

 { System.out.println(true);

 } else { 

System.out.println(false); 

}  

 }   Since a is integer object it returns true.

 There will be a compile time check whether reference expression is subtype of destination type. If it is not a subtype then compile time error will be shown as Incompatible types 

56) What does null mean in java?

When a reference variable doesn’t point to any value it is assigned null. Example : Employee employee; In the above example employee object is not instantiate so it is pointed no where 

57) Can we have multiple classes in single file ?

Yes we can have multiple classes in single file but it people rarely do that and not recommended. We can have multiple classes in File but only one class can be made public. If we try to make two classes in File public we get  following compilation error. “The public type must be defined in its own file”.   

58) What all access modifiers are allowed for top class ?

For top level class only two access modifiers are allowed. public and default. If a class is declared as public it is visible everywhere. If a class is declared default it is visible only in same package. 

If we try to give private and protected as access modifier to class we get the below compilation error. 

Illegal Modifier for the class only public,abstract and final are permitted.     

59) What are packages in java?

Package is a mechanism to group related classes ,interfaces and enums in to a single module. Package can be declared using the following statement :

 Syntax : package <package-name>

 Coding Convention : package name should be declared in small letters. 

package statement defines the namespace.

 The main use of package is 

1)      To resolve naming conflicts 

2)      For visibility control :  We can define classes and interfaces that are not accessible outside the class. 

60) Can we have more than one package statement in source file ?

We can’t have more than one package statement in source file.  In any java program there can be atmost only 1 package statement. We will get compilation error if we have more than one package statement in source file. 

61) Can we define package statement after import statement in java?

We can’t define package statement after import statement in java. package statement must be the first statement in source file. We can have comments before the package statement. 

62) What are identifiers in java?

Identifiers are names in java program. Identifiers can be class name, method name or variable name. Rules for defining identifiers in java: 

1)    Identifiers must start with letter,Underscore or dollar($) sign. 

2)    Identifiers can’t start with numbers .

 3)    There is no limit on number of characters in identifier but not recommended to have more than 15 characters 

4)    Java identifiers are case sensitive.

 5)    First letter can be alphabet ,or underscore and dollar sign. From second letter we can have numbers . 

6)    We should’nt use reserve words for identifiers in java.   

63) What are access modifiers in java?

The important feature of encapsulation is access control. By preventing access control we can misuse of class, methods and members. A class, method or variable can be accessed is determined by the access modifier. There are three types of access modifiers in java. public,private,protected. If no access modifier is specified then it has a default access. 

64) What is the difference between access specifiers and access modifiers in java?

In C++ we have access specifiers as public,private,protected and default and access modifiers as static, final. But there is no  such divison of access specifiers and access modifiers in java. 

In Java we have access modifiers and non access modifiers.

 Access Modifiers : public, private, protected, default 

Non Access Modifiers : abstract, final, stricfp. 

65) What access modifiers can be used for class ?

We can use only two access modifiers for class public and default. 

public: A class with public modifier can be visible 

1)    In the same class 

2)    In the same package subclass 

3)    In the same package nonsubclass 

4)    In the different package subclass

 5)    In the different package non subclass.   

default :  A class with default modifier can be accesed 

1)    In the same class 

2)    In the same package subclass

 3)    In the same package nonsubclass

 4)    In the different package subclass 

5)    In the different package non subclass. 

66) Explain what access modifiers can be used for methods?

We can use all access modifiers public, private,protected and default for methods. public :

 When a method is declared as public it can be accessed

 1)    In the same class

 2)    In the same package subclass

 3)    In the same package nonsubclass 

4)    In the different package subclass 

5)   In the different package non subclass

default : When a method is declared as default, we can access that method in 

1)    In the same class 

2)    In the same package subclass 

3)    In the same package non subclass We cannot access default access method in

 1)    Different package subclass

 2)    Different package non subclass.  

 protected : When a method is declared as protected it can be accessed

 1)    With in the same class

 2)    With in the same package subclass

 3)    With in the same package non subclass 

4)    With in different package subclass It cannot be accessed non subclass in different  package.  

  private : When a method is declared as private it can be accessed only in that class. It cannot be accessed in 

1)    Same package subclass

 2)    Same package non subclass

 3)    Different package subclass 

4)    Different package non subclass. 

67)Explain what access modifiers can be used for variables?

We can use all access modifiers public, private,protected and default for variables. public :  When a variables is declared as public it can be accessed 

1)  In the same class 

2)  In the same package subclass 

3  In the same package nonsubclass

 4) In the different package subclass 

5)  In the different package non subclass. 

default : When a variables is declared as default, we can access that method in

 1)    In the same class

 2)    In the same package subclass

 3)    In the same package non subclass We cannot access default access variables in

 4)    Different package subclass

 5)    Different package non subclass. 

  protected : When a variables is declared as protected it can be accessed 

1)    With in the same class

 2)    With in the same package subclass 

3)    With in the same package non subclass

 4)    With in different package subclass It cannot be accessed non subclass in different  package.  

  private : When a variables is declared as private it can be accessed only in that class. It cannot be accessed in

 1)    Same package subclass 

2)    Same package non subclass 

3)    Different package subclass 

4)    Different package non subclass.   

68) What is final access modifier in java?

final access modifier can be used for class, method and variables. The main advantage of final access modifier is security no one can modify our classes, variables and methods. The main disadvantage of final access modifier is we cannot implement oops concepts in java. Ex : Inheritance, polymorphism. 

final class : A final class cannot be extended or subclassed.  We ar e preventing inheritance by marking a class as final. But we can still access the methods of this class by composition. Ex: String class 

final methods:  Method overriding is one of the important features in java. But there are situations where we may not want to use this feature. Then we  declared method as final which will print overriding.  To allow a method from being overridden we use final access modifier for methods. 

final variables : If a variable is declared as final ,it behaves like a constant . We cannot modify the value of final variable. Any attempt to modify the final variable results in compilation error. The error is as follows “final variable cannot be assigned.”   

69) Explain about abstract classes in java?

Sometimes we may come across a situation where we cannot provide implementation  to all the methods in a class. We want to leave the implementation to a class that extends it. In such case we declare a class as abstract.To make a class abstract we use key word abstract. Any class that contains one or more abstract methods is declared as abstract. If we don’t declare class as abstract which contains abstract methods we get compile time error. We get the following error. 

“The type <class-name> must be an abstract class to define abstract methods.” Signature ; abstract class <class-name>

 {

 } For example if we take a vehicle class we cannot provide implementation to it because there may be two wheelers , four wheelers etc. At that moment we make vehicle class abstract. All the common features of vehicles are declared as abstract methods in vehicle class. Any class which extends vehicle will provide its  method implementation. It’s the responsibility of subclass to provide implementation. 

The important features of abstract classes are : 

1)    Abstract classes cannot be instantiated.

 2)    An abstract classes contains abstract methods, concrete methods or both. 

3)    Any class which extends abstract class must override all methods of abstract class. 4)    An abstract class can contain either 0 or more abstract methods. 

Though we cannot instantiate abstract classes we can create object references . Through superclass references we can point to subclass.   

70) Can we create constructor in abstract class ?

We can create constructor in abstract class , it does’nt give any compilation error. But when we cannot instantiate class there is no use in creating a constructor for abstract class. 

71) What are abstract methods in java?

An abstract method is the method which does’nt have any body.  Abstract method is declared with keyword abstract and semicolon in place of method body.

 Signature : public abstract void <method name>();

 Ex : public abstract void getDetails(); 

It is the responsibility of subclass to provide implementation to abstract method defined in abstract class. 

72) What is an exception in java?

In java exception is an object. Exceptions are created when an  abnormal situations are arised in our program. Exceptions can be created by JVM or by our application code. All Exception classes are defined in java.lang. In otherwords we can say Exception as run time error. 

73) State some situations where exceptions may arise in java?

1)    Accesing an element that does not exist in array. 

2) Invalid conversion of number to string and string to number. (NumberFormatException) 

3)    Invalid casting of class (Class cast Exception) 

4)    Trying to create object for interface or abstract class (Instantiation Exception) 

74) What is Exception handling in java?

Exception handling is a mechanism what to do when some abnormal situation arises in program. When an exception is raised in program it leads to termination of program when it is not handled properly. The significance of exception handling comes here in order not to terminate a program abruptly and to continue with the rest of program normally. This can be done with help of Exception handling. 

75) What is an eror in Java?

Error is the subclass of Throwable class in java.  When errors are caused by our program we call that as Exception, but some times exceptions are caused due to some environment issues such as running out of memory. In such cases we can’t handle the exceptions.  Exceptions which cannot be recovered are called as errors in java.

 Ex : Out of memory issues. 

76) What are advantages of Exception handling in java?

1)    Separating normal code from exception handling code to avoid abnormal termination of program. 

2)    Categorizing in to different types of Exceptions so that rather than handling all exceptions with Exception root class we can handle with specific exceptions. It is recommended to handle exceptions  with specific Exception instead of handling with Exception root class. 

3)    Call stack mechanism : If a method throws an exception and it is not handled immediately, then that exception is propagated or thrown to the caller of that method. This propogation continues till it finds an appropriate exception handler ,if it finds handler it would be handled otherwise program terminates abruptly. 

77) In how many ways we can do exception handling in java?

We can handle exceptions in either of the two ways : 

1)    By specifying try catch block where we can catch the exception.

 2)    Declaring a method with throws clause . 

78) List out five keywords related to Exception handling ?

1)    Try 

2)    Catch

 3)    throw 

4)    throws

 5)    finally 

79) Explain try and catch keywords in java?

In try block we define all exception causing code. In java try and catch forms a unit. A catch block catches the exception thrown by preceding try block. Catch block cannot catch an exception thrown by another try block. If there is no exception causing code in our program or exception is not raised in our code jvm ignores the try catch block. Syntax :

 try 

Catch(Exception e) 

{

 } 

80) Can we have try block without catch block?

Each try block requires atleast one catch block or finally block. A try block without catch or finally will result in compiler error. We can skip either of catch or finally block but not both. 

81) Can we have multiple catch block for a try block?

In some cases our code may throw more than one exception. In such case we can specify two or more catch clauses, each catch handling different type of exception. When an exception is thrown jvm checks each catch statement in order and the first one which matches the type of exception is execution and remaining catch blocks are skipped. 

Try with multiple catch blocks is highly recommended in java.

 If try with multiple catch blocks are present the order of catch blocks is very important and the order should be from child to parent. 

82) Explain importance of finally block in java?

Finally block is used for cleaning up of resources such as closing connections, sockets etc. if try block executes with no exceptions then finally is called after try block without executing catch block. If there is exception thrown in try block finally block executes immediately after catch block. 

If an exception is thrown,finally block will be executed even if the no catch block handles the exception.     

83) Can we have any code between try and catch blocks?

We shouldn’t declare any code between try and catch block. Catch block should immediately start after try block.

 try{

 //code 

System.out.println(“one line of code”);  // illegal 

catch(Exception e){ 

//

 } 

84) Can we have any code between try and finally blocks?

We shouldn’t declare any code between try and finally block. finally block should immediately start after catch block.If there is no catch block it should immediately start after try block.

 try{ 

//code

 }

 System.out.println(“one line of code”);  // illegal

 finally{

 //

 } 

85) Can we catch more than one exception in single catch block?

From Java 7, we can catch more than one exception with single catch block. This type of handling reduces the code duplication. 

Note : When we catch more than one exception in single catch block , catch parameter is implicity final.

 We cannot assign any value to catch parameter. 

Ex : catch(ArrayIndexOutOfBoundsException || ArithmeticException e) 

In the above example e is final we cannot assign any value or modify e in catch statement. 

86) What are checked Exceptions?

1)    All the subclasses of Throwable class except error,Runtime Exception and its subclasses are checked exceptions. 

2)    Checked exception should be thrown with keyword throws or should be provided try catch block, else the program would not compile. We do get compilation error. Examples : 

1)    IOException,

 2)    SQlException,

 3)    FileNotFoundException, 

4)    InvocationTargetException,

 5)    CloneNotSupportedException

 6)    ClassNotFoundException

 7)    InstantiationException 

87) What are unchecked exceptions in java?

All subclasses of RuntimeException are called unchecked exceptions. These are unchecked exceptions because compiler does not checks if a method handles or throws exceptions. Program compiles even if we do not catch the exception or throws the exception. If an exception occurs in the program,program terminates . It is difficult to handle these exceptions because there may be many places causing exceptions. Example : 

1) Arithmetic Exception 

3)    ArrayIndexOutOfBoundsException 

4)    ClassCastException 

5)    IndexOutOfBoundException 

6)    NullPointerException 

7)    NumberFormatException 

8)    StringIndexOutOfBounds

 9)    UnsupportedOperationException 

88) What is default Exception handling in java?

When JVM detects exception causing code, it constructs a new exception handling object by including the following information.

 1)    Name of Exception

 2)    Description about the Exception

 3)    Location of Exception. 

After creation of object by JVM it checks whether there is exception handling code or not. If there is exception handling code then exception handles and continues the program. If there is no exception handling code JVM give the responsibility of exception handling to default handler and terminates abruptly. 

Default Exception handler displays description of exception,prints the stacktrace and location of exception and terminates the program. 

Note : The main disadvantage of this default exception handling is program terminates abruptly.   

89) Explain throw keyword in java?

Generally JVM throws the exception and we handle the exceptions by using try catch block. But there are situations  where we have to throw userdefined exceptions or runtime exceptions. In such case we use throw keyword to throw exception explicitly. 

Syntax : throw throwableInstance; 

Throwable instance must be of type throwable or any of its subclasses. 

After the throw statement execution stops and subsequent statements are not executed. Once exception object is thrown JVM checks is there any catch block to handle the exception. If not then the next catch statement till it finds the appropriate handler. If appropriate handler is not found ,then default exception handler halts the program and prints the description and location of exception.

 In general we use throw keyword for throwing userdefined or customized exception. 

 

90) Can we write any code after throw statement?

After throw statement jvm stop execution and subsequent statements are not executed. If we try to write any statement after throw we do get compile time error saying unreachable code.   

91) Explain importance of throws keyword in java?

Throws statement is used at the end of method signature to indicate that an exception of a given type may be thrown from the method.

The main purpose of throws keyword is to delegate responsibility of exception handling to the caller methods, in the case of checked exception.

 In the case of unchecked exceptions, it is not required to use throws keyword. 

We can use throws keyword only for throwable types otherwise compile time error saying incompatible types.

 An error is unchecked , it is not required to handle by try catch or by throws. 

Syntax : Class Test{ 

Public static void main(String args[]) throws IE

 {

 }

 }

 Note : The method should throw only checked exceptions and subclasses of checked exceptions. It is not recommended to specify exception superclasses in the throws class when the actual exceptions thrown in the method are instances of their subclass.   

91) Explain the importance of finally over return statement?

finally block is more important than return statement when both are present in a program. For example if there is any return statement present inside try or catch block , and finally block is also present first finally statement will be executed and then return statement will be considered.   

93) Explain a situation where finally block will not be executed?

Finally block will not be executed whenever jvm shutdowns. If we use system.exit(0) in try statement finally block if present will not be executed. 

94)Can we use catch statement for checked exceptions?

If there is no chance of raising an exception in our code then we can’t declare catch block for handling checked exceptions .This raises compile time error if we try to handle checked exceptions when there is no possibility of causing exception. 

95)What are user defined exceptions?

To create customized error messages we use userdefined exceptions. We can create user defined exceptions as checked or unchecked exceptions.

 We can create user defined exceptions that extend Exception class or subclasses of checked exceptions so that userdefined exception becomes checked. 

Userdefined exceptions can extend RuntimeException to create userdefined unchecked exceptions.

 Note : It is recommended to keep our customized exception class as unchecked,i.e we need to extend Runtime Exception class but not Excpetion class. 

96) Can we rethrow the same exception from catch handler?

Yes we can rethrow the same exception from our catch handler. If we want to rethrow checked exception from a catch block we need to declare that exception. 

97) Can we nested try statements in java?

Yes try statements can be nested. We can declare try statements inside the block of another try statement. 

98) Explain the importance of throwable class and its methods?

Throwable class is the root class for Exceptions.  All exceptions are derived from this throwable class. The two main subclasses of Throwable are Exception and Error. The three methods defined in throwable class are : 

1)    void printStackTrace() : 

This prints the exception information in the following format : Name of the exception, description followed by stack trace.

 2)    getMessage() 

This method prints only the description of Exception. 

3)    toString(): 

It prints the name and description of Exception. 

99) Explain when ClassNotFoundException will be raised ?

When JVM tries to load a class by its string name, and couldn’t able to find the class classNotFoundException will be thrown. An example for this exception is when class name is misspelled and when we try to load the class by string name hence class cannot be found which raises ClassNotFoundException. 

100) Explain when NoClassDefFoundError will be raised ?

This error is thrown when JVM tries to load the class but no definition for that class is found NoClassDefFoundError will occur. The class may exist at compile time but unable to find at runtime. This might be due to misspelled classname at command line, or classpath is not specified properly , or the class file with byte code is no longer available. Java Interview questions on threads 

101) What is process ?

A process is a program in execution. 

 Every process have their own memory space.Process are heavy weight and requires their own address space. One or more threads make a process. 

102) What is thread in java?

Thread is separate path of execution in program.  Threads are

 1)    Light weight

 2)    They share the same address space. 

3) creating thread is simple when compared to process because creating thread requires less resources when compared to process 

4) Threads exists in process. A process have atleast one thread. 

103) What is multitasking ?

Multitasking means performing more than one activity at a time on the computer. Example Using spreadsheet and using calculator at same time. 

104)What are different types of multitasking?

There are two different types of multitasking : 

1)    Process based multitasking

 2)    Thread based multitasking

 Process based multitasking : It allows to run two or more programs concurrently. In process based multitasking a process is the smallest part of code . Example : Running Ms word and Ms powerpoint at a time. 

Thread based multitasking : It allows to run parts of a program to run concurrently. Example : Formatting the text and printing word document at same time . 

Java supports thread based multitasking  and provides built in support for multithreading.

 

105)What are the benefits of multithreaded programming?

Multithreading enables to use idle time of cpu to another thread which results in faster execution of program. In single threaded environment each task has to be completed before proceeding to next task making cpu idle. 

106) Explain thread in java?

1)    Thread is independent path of execution with in a program.

 2)    A thread consists of three parts Virtual Cpu, Code and data. 

3)    At run time threads share code and data i.e they use same address space. 

4)    Every thread in java is an object of java.lang.Thread class. 

107) List Java API that supports threads?

java.lang.Thread : This is one of the way to create a thread. By extending Thread class and overriding 

run() we can create thread in java.

java.lang.Runnable : Runnable is an interface in java. By implementing runnable interface and overriding 

run() we can create thread in java.

 java.lang.Object :  Object class is the super class for all the classes in java. In object class we have three methods wait(), notify(), notifyAll() that supports threads. 

java.util.concurrent : This package has classes and interfaces that supports concurrent programming. Ex : Executor interface, Future task class etc. 

108) Explain about main thread in java?

Main thread is the first thread that starts immediately after a program is started.

 Main thread is important because : 

1)    All the child threads spawn from main thread.

 2)    Main method is the last thread to finish execution. 

When JVM calls main method() it starts a new thread. Main() method is temporarily stopped while the new thread starts running. 

109) In how many ways we can create threads in java?

We can create threads in java by any of the two ways : 

1)    By extending Thread class 

2)    By Implementing Runnable interface. 

110) Explain creating threads by implementing Runnable class?

This is first and foremost way to create threads . By implementing runnable interface and implementing 

run() method we can create new thread. 

Method signature : public void run()

Run is the starting point for execution for another thread within our program. 

Example : 

public class MyClass implements Runnable {

 @Override

 public void run() { 

// T

 } 

}   

111) Explain creating threads by extending Thread class ?

We can create a thread by extending Thread class. The class which extends Thread class must override the run() method.

 Example : 

public class MyClass extends Thread { 

@Override public void run() { 

// Starting point of Execution 

}

 } 

112) Which is the best approach for creating thread ?

The best way for creating threads is to implement runnable interface. When we extend Thread class we can’t extend any other class. When we create thread by  implementing runnable interface we can implement Runnable interface. In both ways we have to implement run() method. 

113)Explain the importance of thread scheduler in java

Thread scheduler is part of JVM use to determine which thread to run at this moment when there are multiple threads. Only threads in runnable state are choosen by scheduler. Thread scheduler first allocates the processor time to the higher priority threads. To allocate microprocessor time in between the threads of the same priority, thread scheduler follows round robin fasion.

114) Explain the life cycle of thread?

A thread can be in any of the five states :

 1)    New : When the instance of thread is created it will be in New state.

 Ex : Thread t= new Thread(); 

In the above example t is in new state. The thread is created but not in active state to make it active we need to call start() method on it. 

2)    Runnable state : A thread can be in the runnable state in either of the following two ways : a) When the start method is invoked or b) A thread can also be in runnable state after coming back from blocked or sleeping or waiting state. 

3)    Running state : If thread scheduler allocates cpu time, then the thread will be in running state. 

4)    Waited /Blocking/Sleeping state: In this state the thread can be made temporarily inactive for a short period of time. A thread can be in the above state  in any of the following ways: 

1)    The thread waits to acquire lock of an object. 

2)    The thread waits for another thread to complete.

 3)    The thread waits for notification of other thread.  

 5)    Dead State : A thread is in dead state when thread’s run method execution is complete. It dies automatically when thread’s run method execution is completed and the thread object will be garbage collected. 

115) Can we restart a dead thread in java?

If we try to restart a dead thread by using start method we will get run time exception since the thread is not alive. 

116) Can one thread block the other thread?

No one thread cannot block the other thread in java. It can block the current thread that is running. 

117) Can we restart a thread already started in java?

A thread can be started in java using start() method in java. If we call start method second time once it is started it will cause RunTimeException(IllegalThreadStateException). A runnable thread cannot be restarted. 

118) What happens if we don’t override run method ?

If we don’t override run method .Then default implementation of Thread class run() method will be executed and hence the thread will never be in  runnable state. 

119) Can we overload run() method in java?

We can overload run method but Thread class start method will always cal run method with no arguments. But the overloaded method will not be called by start method we have to explicitly call this start() method. 

120) What is a lock or purpose of locks in java?

Lock also called monitor is used to prevent access to a shared resource by multiple threads. A lock is associated to shared resource. Whenever a thread wants to access a shared resource if must first acquire a lock . If already a lock has been acquired by other it can’t access that shared resource.  At this moment the thread has to wait until another thread releases the  lock on shared resource. To lock an object we use synchronization in java.

 A lock protects section of code allowing only one thread to execute at at a time. 

121) In how many ways we can do synchronization in java?

There are two ways to do synchronization in java: 

1)    Synchronized methods 

2)    Synchronized blocks To do synchronization we use synchronize keyword. 

122) What are synchronized methods ?

If we want a method of object to be accessed by single thread at a time we declare that method with synchronized keyword. 

Signature :

 public synchronized  void methodName(){} 

 To execute synchronized method first lock has to be acquired on that object. Once synchronized method is called lock will be automatically acquired on that method when no other thread has lock on that method. once lock has been acquired then synchronized method gets executed. Once synchronized method execution completes automatically lock will be released. The prerequisite to execute a synchronized method is to acquire lock before method execution. If there is a lock already acquired by any other thread it waits till the other thread completes.

123) When do we use synchronized methods in java?

If multiple threads tries to access a method where method can manipulate the state of object , in such scenario we can declare a method as synchronized. 

124) When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?

No it is not possible to execute synchronized methods by other threads when a thread is inside a synchronized method. 

125) When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

Yes it is possible for thread executing a synchronized method to execute another synchronized method of an object. 

public synchronized  void methodName()  

 {

 }   

To execute synchronized method first lock has to be acquired on that object. Once synchronized method is called lock will be automatically acquired on that method when no other thread has lock on that method. once lock has been acquired then synchronized method gets executed. Once synchronized method execution completes automatically lock will be released. The prerequisite to execute a synchronized method is to acquire lock before method execution. If there is a lock already acquired by any other thread it waits till the other thread completes.

126) What are synchronized blocks in java?

Synchronizing few lines of code rather than complete method with the help of synchronized keyword are called synchronized blocks.

 Signature : 

Synchronized (object reference){// code} 

127) When do we use synchronized blocks and advantages of using synchronized blocks?

If very few lines of code requires synchronization then it is recommended to use synchronized blocks. The main advantage of synchronized blocks over synchronized methods is it reduces the waiting time of threads and improves performance of the system. 

128) What is class level lock ?

Acquiring lock on the class instance rather than object of the class is called class level lock. The difference between class level lock and object level lock is in class level lock lock is acquired on class .class instance and in object level lock ,lock is acquired on object of class. 

129) Can we synchronize static methods in java?

Every class in java has a unique lock associated with it. If a thread wants to execute static synchronize method it need to acquire first class level lock. When a thread was executing static synchronized method no other thread can execute static synchronized method of class since lock is acquired on class. 

But it can execute the following methods simultaneously :

 1)    Normal static methods 

2)    Normal instance methods

 3)    synchronize instance methods 

Signature :

 synchronized(Classname.class){} 

130) Can we use synchronized block for primitives?

Synchronized blocks are applicable only for objects if we try to use synchronized blocks for primitives we get compile time error. 

131) What are thread priorities and importance of thread priorities in java?

When there are several threads in waiting, thread priorities determine which thread to run. In java programming language every thread has a priority. A thread inherits priority of its parent thread. By default thread has normal priority of 5. Thread scheduler uses thread priorities to decide when each thread is allowed to run. Thread scheduler runs higher priority threads first. 

132) Explain different types of thread priorities ?

Every thread in java has priorities in between 1 to 10. By default priority is 5 (Thread.NORM_PRIORITY).  The maximum priority would be 10 and minimum would be 1.Thread class defines the following constants(static final variables) to define properties. 

Thread. MIN_PRIORITY = 1; 

Thread.NORM_PRIORITY=5;

 Thread. MAX_PRIORITY=10; 

133) How to change the priority of thread or how to set priority of thread?

Thread class has a set method to set the priority of thread and get method to get the priority of the thread. 

Signature : final void setPriority(int value); 

The setPriority() method is a request to jvm to set the priority. JVM may or may not oblige the request. 

We can get the priority of current thread by using getPriority() method of Thread class. final int getPriority()

 {

 } 

134) If two threads have same priority which thread will be executed first ?

We are not guaranteed which thread will be executed first when there are threads with equal priorities in the pool. It depends on thread scheduler to which thread to execute. The scheduler can do any of the following things :

 1)    It can pick any thread from the pool and run it till it completes.

 2)    It can give equal opportunity for all the threads by time slicing. 

135) What all methods are used to prevent thread execution ?

There are three methods in Thread class which prevents execution of thread. 

1)    yield() 

2)    join() 

3)    sleep() 

136) Explain yield() method in thread class ?

Yield() method makes the current running thread to move in to runnable state from running state giving chance to remaining threads of equal priority which are in waiting state. yield() makes current thread to sleep for a specified amount of time.There is no guarantee that moving a current running thread from runnable to running state. It all depends on thread scheduler it doesn’t gurantee anything. 

Calling yield()  method on thread does not have any affect if object has a lock. The thread does’nt lose any lock if it has acquired a lock earlier.  

 Signature : 

public static native void yield()

 { 

  } 

137) Is it possible for yielded thread to get chance for its execution again ?

Yield() causes current thread to sleep for specified amount of time giving opportunity for other threads of equal priority to execute. Thread scheduler decides whether it get chance for execution again or not. It all depends on mercy of thread scheduler. 

138) Explain the importance of join() method in thread class?

A thread can invoke the join() method on other thread to wait for other thread to complete its execution.  Assume we have two threads, t1 and t2  threads . A running thread t1 invokes join() on thread t2 then t1 thread will wait in to waiting state until t2 completes. Once t2 completes the execution, t1 will continue. join() method throws Interrupted Exception so when ever we use 

join() method we should handle Interrrupted Exception by throws or by using try catch block. 

Signature : 

 public final void join() throws InterruptedException

 {  

 } 

  public final synchronized void join(long millis) throws InterruptedException

 {  

 }

 public final synchronized void join(long millis, int nanos)

 throws InterruptedException

 { 

  } 

139) Explain purpose of sleep() method in java?

sleep() method causes current running thread to sleep for specified amount of time . sleep() method is the minimum amount of the time the current thread sleeps but not the exact amount of time.  

 Signature :  

  public static native void sleep(long millis) throws InterruptedException

 {

   }     public static void sleep(long millis, int nanos) 

throws InterruptedException {  

   }   

140) Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

Calling sleep() method on thread which has lock does’nt affect. Lock will not be released though the thread sleeps for a specified amount of time. 

141) Can sleep() method causes another thread to sleep?

No sleep() method causes current thread to sleep not any other thread. 

142) Explain about interrupt() method of thread class ?

Thread class interrupt() method is used to interrupt current thread or another thread. It doesnot mean the current thread to stop immediately, it is polite way of telling or requesting to continue your present work. That is the reason we may not see the impact of interrupt call immediately.

 Initially thread has a boolean property(interrupted status) false. So when we call interrupt() method status would set to true. This causes the current thread to continue its work and does not have impact immediately. 

If a thread is in sleeping or waiting status (i.e thread has executed wait () or sleep() method) thread gets interrupted it stops what it is doing and throws an interrupted exception. This is reason we need to handle interrupted exception with throws or try/ catch block. 

143) Explain about interthread communication and how it takes place in java?

Usually threads are created to perform different unrelated tasks but there may be situations where they may perform related tasks. Interthread communication in java is done with the help of following three methods :

 1)    wait() 

2)    notify()

 3)    notifyAll() 

144) Explain wait(), notify() and notifyAll() methods of object class ?

wait() : wait() method()  makes the thread current thread sleeps and releases the lock until some other thread acquires the lock and calls notify(). 

notify() :notify() method wakes up the thread that called wait on the same object. notfiyAll() :notifyAll() method wakes up all the threads that are called wait() on the same object. The highest priority threads will run first.

 All the above three methods are in object class and are called only in synchronized context. 

All the above three methods must handle InterruptedException by using throws clause or  by using try catch clause. 

145) Explain why wait() , notify() and notifyAll() methods are in Object class rather than in thread class?

First to know why they are in object class we should know what wait(), notify(), notifyAll() methods do. wait() , notify(), notifyAll() methods are object level methods they are called on same object.wait(), notify(), notifyAll()  are called on an  shared object so to they are kept in object class rather than thread class. 

146) Explain IllegalMonitorStateException and when it will be thrown?

IllegalMonitorStateException is thrown when wait(), notify() and notifyAll() are called in non synchronized context. Wait(), notify(),notifyAll() must always be called in synchronized context other wise we get this run time exception

147) when wait(), notify(), notifyAll() methods are called does it releases the lock or holds the acquired lock?

wait(), notify(), notifyAll() methods are always called in synchronized context. When these methods are called in synchronized context. 

So when they enter first in synchronized context thread acquires the lock on current object. When wait(), notify(), notifyAll() methods are called lock is released on that object. 

148) What are thread groups?

Thread Groups are group of threads and other thread groups. It is a way of grouping threads so that actions can be performed on set of threads for easy maintenance and security purposes. For example we can start and stop all thread groups. We rarely use thread group class. By default all the threads that are created belong to default thread group of the main thread. Every thread belongs to a thread group. Threads that belong to a particular thread group cannot modify threads belonging to another thread group. 

149) What are thread local variables ?

Thread local variables are variables associated to a particular thread rather than object. We declare ThreadLocal object as private static variable in a class. Everytime a new thread accesses object by using getter or setter we are accesing copy of object.  Whenever a thread calls get or set method of ThreadLocal instance a new copy is associated with particular object.

150) What are daemon threads in java?

Daemon threads are threads which run in background. These are service threads and works for the benefit of other threads. Garbage collector is one of the good example for daemon threads. By default all threads are non daemon. Daemon nature of a thread can be inherited. If parent thread is daemon , child thread also inherits daemon nature of thread. 

)


Reasoning Classification

Category : News

Verbal Reasoning

  • Coding-Decoding
  • Analogy
  • Classification
  • Alphabet Test
  • Word Formation
  • Sitting Arrangement
  • Direction Sense Test
  • Number Ranking And Time Sequence Test
  • Puzzles
  • Number Series
  • Inserting the missing Character

Reasoning Classification

‘Classification’ means ‘to assort the items of a given group on the basis of certain common quality they possess and then spot the stranger out’. In this test, you are given a group of certain items, out of which all except one are similar to one another in some manner. The candidate is required to choose this one item which does not fit into the given group.

5 types of question Can Be Asked In Exam

Type 1 :- Chossing the odd Word

Direction: Choose the word which is least Like the other word in the group 

1. (a) Curd  (b) Butter  (c) Oil     (d) Cheese    (e) Cream

       Sol. Here, all except Oil are products obtained from milk. Hence, the answer is (c).

2. (a) Rose   (b) Lotus    (c) Marigold    (d) Lily    (e) Tylip

    Sol. Here, all except Lotus are flowers, which grow on land while lotus is a water flovyer. Hence,      the answer is 

3. (a) Pistol  (b) Sword  (c) Gun  (d) Rifle  (e) Cannon

         Sol. Here, all except Swoid are fire arms. Hence, the answer is (b).

4. (a) Cathedral (b) Mosque  (c) Church   (d) Monastery (e) Temple

          Sol. All except Monastery are places of worship, while monaster* is a place where monks                        stay.    Hence, the answer is (d).

 5. (a) Book   (b) Paper  (c) Pencil   (d) Pen   (e) Sharpener

           Sol. Here, all except Book are stationery items.

                  Hence, the answer is (a).

6. (a) Geometry   (6) Algebra   (c) Trigonometry .   (d) Mathematics   (e) Arithmetic

         Sol. Here, all except Mathematics are branches of Mathematics. 

               Hence, the answer is (d)

Type 2: Choosing the odd pair of group

 

 examples:

Ex. 1. (a) Blacksmith : Anvil                     (b) Carpenter : Saw      (c) Barber : Scissor

          (d) Goldsmith : Ornaments           (e) Sculptor : Chisel

           Sol. Clearly, the answer is (d). In all other pairs, second is the tool used by the first.

       2. (a) Painter : Gallery                        (b) Actor : Stage                     (c) Mason : Wall

          (d) Farmer : Field                             (e) Worker : Factory

         Sol. Clearly, the answer is (c). In all other pairs, second is the place where the first works.

       3. (a) Cow : Calf                                  (b) Dog : Bitch                         (c) Lion : Cub

           (d) Tortoise : Turtle                       (e) Insect : Larva

           Sol. Clearly, the answer is  (b). In all other pairs, second is the young one of the first while in                    (b), second is the female of the first.

       4. (a) Volume : Litre   (b)   Resistance : Ohm      (c ) Time : Seconds          (d) Length : Metre

            (e) Pressure : Barometer

           Sol. Clearly, the answer is (e). In all other pairs, second is the unit to measure the

                first. On the other hand, barometer is an instrument.

   

Type 3: Choosing the odd numeral

Ex. Sailors : Crew [a group of sailor is called crew]

other examples:

1. (a) 43             (b) 53                    (c) 63             (d)10   . (a) 51 (b) 26

(6) 144 <c)24

(c) 64 (d)

4. (6) 21 (c) 24 (d)

(a)

15

73

21

(d) 121

28

(e) 83

(Bank P.O. 1996)

(e) 18

(e) 256

(B.8.RJ*. 1995)

(e) 30 

4. Animal and Young one :

Ex. Cow  : Calf [Calf is young one of cow ]

other examples:

  • Dog : Puppy
  • hen : Chicken
  • Cat : Kitten
  • Horse : Pony 
  • Butterfly : Caterpillar 
  • Duck : Duckling 
  • inspect : Larva
  • Man : Child 

5. Male and Female :

Ex. Horse  : Mare [Mare is female of horse ]

other examples:

  • Dog : Bitch
  • stag : doe 
  • son : Daughter
  • Lion : Lioness
  • Drone : Bee
  • Tiger : Tigress

6. Indvidual and class :

Ex. Lizard  : Reptile [lizard belong to the class of reptile ]

other examples:

  •  Man : Bird
  • ostrich : Bird 
  • Snake : Reptile 
  • Rat :rodent 
  • Whale : mammal 
  • Butterfly insect

7. Individual and Dwelling Place :

Ex. Dog : Kennel [A dogs Live In Kennel ]

other examples:

  •  Bee : Apiary
  • cattle : Shed
  • Lion : Den
  • Poultry  : Farm
  • Horse : Stable 
  • Bird : Aviary
  • Fish : Aquarium
  • monk : Monastery

8.study and Topic:

Ex. ornithology : Bird   [Ornithology is study of bird ]

other examples:

  •  seismology : Earthquakes 
  • Zoology : Animals
  • Entomology : Insects 
  • Ontology : Reality 
  • Oology : Eggs
  • Virology : virus
  • occultism : Supernatural 

9.Worker and Tools:

Ex. Blacksmith : Anvil [Anvil is tool used by black smith ]

other examples:

  •  Chef : Knife 
  • Doctor : Stethoscope 
  • Farmer : Plough
  • Tailor : Needle 
  • Woodcutter : Axe 
  • Author : Pen 
  • Soldier : Gun
  • Gardener : Harrow

10.Tools and action :

Ex. Needle : Sew  [A needle is used to sewing ]

other examples:

  •  Knife : cut 
  • Gun : shoot 
  •  Pen : Write 
  • Spoon : Feed 
  • Shield : Guard 
  • Spoon : Feed

11.worker and wworking place :

Ex. Chef : Kitchen  [A Chef Work in Kitchen ]

other examples:

  •  Farmer : Field 
  • Warrior : Battlefield
  • Servant : House
  • Sailor : Ship

12.Worker and Product:

Ex. mason  : wall  [A Chef Work in Kitchen ]

other examples:

  • Farmer : Field 
  • Warrior : Battlefield
  • Servant : House

13. Product and Raw Material:

Ex. Prism : Glass [prism of made of Glass ]

other examples:

  • Wall : Bricks 
  • Furniture : Wood 
  • Shoes : Leather 
  • Pullover : Wool
  • Metal : Ore 
  • Cloth : Fiber
  • Road : Asphalt
  • Book : Paper
  • Sack : Jute
  • Omelette : Egg

14. Part and Whole Relationship:

Ex. Pen  : Nib[Nib Is part of pen]

other examples:

  • Pencil : Lead 
  • House : Kitchen 
  • Fan : Blade 
  • Class : Student
  • Room : Window 
  • Aeroplane  : Cockpit
  • Book : Chapter

15. Word and intensity :

Ex. Anger  : Range [range is higher intensity than anger]

other examples:

  • wish : Desire 
  • Famous : Renowned
  • unhappy : Sad
  • kindle : Burn
  • sink : Drown
  • crime : sin
  • moist : drench

16. Word Synonym :

Ex. Abode : Dwelling [Abode mean almo the same as Dwelling]

other examples:

  • Blend : Mix 
  • Ban : Prohibition
  • vacant : Empty 
  • Abduct : Kidnap
  •  Flaw : Defect 
  • Solicit : request
  • Fierce : Violent 

17 Word and Antonym:

Ex. Attack : Defend [Defend Mean Opposite of Attack]

other examples:

  • Advance : Retreat 
  • Sink : Float
  • Cruel : Kind 
  • Robust : Weak 
  • Best : Worst
  • Fresh : Stale 
  • ignore : Notice 
  • Deep : Shallow 
  • Cordial : Hostile 
  • Mourn : Rejoice 
  • Lend : Borrow 

Reasoning:analogy

Category : News

Verbal Reasoning

  • Coding-Decoding
  • Analogy
  • Classification
  • Alphabet Test
  • Word Formation
  • Sitting Arrangement
  • Direction Sense Test
  • Number Ranking And Time Sequence Test
  • Puzzles
  • Number Series
  • Inserting the missing Character

Reasoning: Analogy

In simple way Meaning of Analogy is “Similarity ” or compassion between one thing and other thing base d on some similarity 

Kind Of Relationships:

1. Instrument and Measurement

Ex. Barometer : Pressure [barometer is an instrument used to measure pressure]

other examples:

  • Thermometer : Temperature
  • Anemometer : Wind vane
  • Odometer : Speed 
  • Scale : Length
  •  Balance : Mass

 

2. Quantity and Unit

Ex. Length : Unit [Meter is the unit of Length]

other examples:

  • Mass : Kilogram
  • Force : Newton 
  • Energy : Joule 
  • Resistance : Ohm
  • Volume : Liter 
  • Pressure : Pascals 
  • Temperature : Degrees
  • Conductivity : Mho
  • Current : Ampere 
  • Time : Second 
  • Angle : Radians 
  • Power : Watt
  • Area : Hectare 

3. Indvidual and Group:​

Ex. Sailors : Crew [a group of sailor is called crew]

other examples:

  • cattle : Herd 
  • Flowers : Bouquet 
  • Grapes : Bunch
  • Singer : Chorus 
  • Artist : Troupe 
  • Fish : Shoal

4. Animal and Young one :

Ex. Cow  : Calf [Calf is young one of cow ]

other examples:

  • Dog : Puppy
  • hen : Chicken
  • Cat : Kitten
  • Horse : Pony 
  • Butterfly : Caterpillar 
  • Duck : Duckling 
  • inspect : Larva
  • Man : Child 

5. Male and Female :

Ex. Horse  : Mare [Mare is female of horse ]

other examples:

  • Dog : Bitch
  • stag : doe 
  • son : Daughter
  • Lion : Lioness
  • Drone : Bee
  • Tiger : Tigress

6. Indvidual and class :

Ex. Lizard  : Reptile [lizard belong to the class of reptile ]

other examples:

  •  Man : Bird
  • ostrich : Bird 
  • Snake : Reptile 
  • Rat :rodent 
  • Whale : mammal 
  • Butterfly insect

7. Individual and Dwelling Place :

Ex. Dog : Kennel [A dogs Live In Kennel ]

other examples:

  •  Bee : Apiary
  • cattle : Shed
  • Lion : Den
  • Poultry  : Farm
  • Horse : Stable 
  • Bird : Aviary
  • Fish : Aquarium
  • monk : Monastery

8.study and Topic:

Ex. ornithology : Bird   [Ornithology is study of bird ]

other examples:

  •  seismology : Earthquakes 
  • Zoology : Animals
  • Entomology : Insects 
  • Ontology : Reality 
  • Oology : Eggs
  • Virology : virus
  • occultism : Supernatural 

9.Worker and Tools:

Ex. Blacksmith : Anvil [Anvil is tool used by black smith ]

other examples:

  •  Chef : Knife 
  • Doctor : Stethoscope 
  • Farmer : Plough
  • Tailor : Needle 
  • Woodcutter : Axe 
  • Author : Pen 
  • Soldier : Gun
  • Gardener : Harrow

10.Tools and action :

Ex. Needle : Sew  [A needle is used to sewing ]

other examples:

  •  Knife : cut 
  • Gun : shoot 
  •  Pen : Write 
  • Spoon : Feed 
  • Shield : Guard 
  • Spoon : Feed

11.worker and wworking place :

Ex. Chef : Kitchen  [A Chef Work in Kitchen ]

other examples:

  •  Farmer : Field 
  • Warrior : Battlefield
  • Servant : House
  • Sailor : Ship

12.Worker and Product:

Ex. mason  : wall  [A Chef Work in Kitchen ]

other examples:

  • Farmer : Field 
  • Warrior : Battlefield
  • Servant : House

13. Product and Raw Material:

Ex. Prism : Glass [prism of made of Glass ]

other examples:

  • Wall : Bricks 
  • Furniture : Wood 
  • Shoes : Leather 
  • Pullover : Wool
  • Metal : Ore 
  • Cloth : Fiber
  • Road : Asphalt
  • Book : Paper
  • Sack : Jute
  • Omelette : Egg

14. Part and Whole Relationship:

Ex. Pen  : Nib[Nib Is part of pen]

other examples:

  • Pencil : Lead 
  • House : Kitchen 
  • Fan : Blade 
  • Class : Student
  • Room : Window 
  • Aeroplane  : Cockpit
  • Book : Chapter

15. Word and intensity :

Ex. Anger  : Range [range is higher intensity than anger]

other examples:

  • wish : Desire 
  • Famous : Renowned
  • unhappy : Sad
  • kindle : Burn
  • sink : Drown
  • crime : sin
  • moist : drench

16. Word Synonym :

Ex. Abode : Dwelling [Abode mean almo the same as Dwelling]

other examples:

  • Blend : Mix 
  • Ban : Prohibition
  • vacant : Empty 
  • Abduct : Kidnap
  •  Flaw : Defect 
  • Solicit : request
  • Fierce : Violent 

17 Word and Antonym:

Ex. Attack : Defend [Defend Mean Opposite of Attack]

other examples:

  • Advance : Retreat 
  • Sink : Float
  • Cruel : Kind 
  • Robust : Weak 
  • Best : Worst
  • Fresh : Stale 
  • ignore : Notice 
  • Deep : Shallow 
  • Cordial : Hostile 
  • Mourn : Rejoice 
  • Lend : Borrow 

Reasoning

Category : News

Verbal Reasoning

  • Coding-Decoding
  • Analogy
  • Classification
  • Alphabet Test
  • Word Formation
  • Sitting Arrangement
  • Direction Sense Test
  • Number Ranking And Time Sequence Test
  • Puzzles
  • Number Series
  • Inserting the missing Character

Coding-Decoding

Coding is System of signals.This is a method of transmitting information in the form of codes or signals without it being known by third person

Mock Test Reasoning: Coding And Decoding

Q1. If A = 1, PAT = 37, then TAP = ?

(1) 73

(2) 37

(3) 36

(4) 38                              ( SSC Combined Graduate Level  Prelim Exam. 04.07.1999)

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q2.If D = 4, BAD = 7, then what is the value of ANT = ?

(1) 8
(2) 17
(3) 35
(4) 37   ( SSC Combined Graduate Level Prelim Exam. 04.07.1999

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q3.If C = 3 and FEAR is coded as 30, then what will be the code number for HAIR ?

(1) 35
(2) 36
(3) 30
(4) 33             ( SSC Combined Graduate Level   Prelim Exam. 04.07.1999)

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q4.If Z = 26, NET = 39, then NUT = ?

(1) 50
(2) 53
(3) 55
(4) 56      ( SSC Combined Graduate Level  Prelim Exam.04.07.1999

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q5. If F = 6, MAT = 34, then how much is CAR ?

(1) 21
(2) 22
(3) 25
(4) 28    ( SSC Combined Graduate Level Prelim Exam.04.07.1999

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q6. If RAMAN is written 12325 and DINESH as 675489, how will HAMAM be written ?

(1) 92233
(2) 92323
(3) 93322
(4) 93232 (SSC Combined Matric Level (PRE) Exam. 24.10.1999

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q7. If ‘A’ = 26, SUN = 27, then CAT = ?

(1) 24
(2) 57
(3) 58
(4) 27

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q8. If A = 2, M = 26 and Z = 52, then BET = ?

(1) 44
(2) 54
(3) 64
(4) 72

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q9. If RED is coded as 6720, then how GREEN would be coded? (

(1) 9207716
(2) 1677199
(3) 1677209
(4)16717209

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.

Q.10 If KASHMIR is written as 8142753, how RIMSHAK can be written in that code?

(1) 3574218
(2) 3571842
(3) 3521478
(4) 3574812

2) A = 1 ® The position num-

ber in English alphabet.

P

A

T

 ̄

16 +1 +

 ̄  ̄

20 = 37

 ̄

Sum of Position Numbers of the

letters in English alphabet.


JNVU Jodhpur Bsc 3rd Year Question Paper

Category : News

JNVU Jodhpur Bsc 3rd year Question paper


JNVU Jodhpur Bsc 2nd year Question paper

Category : News

JNVU Jodhpur Bsc 2nd Year Question Paper