Similarities and differences of multitasking and multithreading?
Both terms are used to describe a computer process known as multi-tasking, where a single CPU core switches between tasks periodically to reduce inefficiency and wasted time, and to allow the user to perform multiple tasks at the same time. The difference between the two are technical distinctions, rather than a difference in their intended effect.
Multiprogramming was the first form of multi-tasking, and introduced in the the concept of yielding. When an instruction could not be completed immediately (such as when reading from a disk or other slowperipheral, the current task was set aside, and another task would run until the data from the paused task was ready.
Some time later, time sharing was introduced to allow more fine-grained control over the yielding process. The first form was known as cooperative time sharing. In this model, a program would run for a while and then willingly relinquish control so that another process could have a chance. This was referred to as cooperative time sharing. This model had some drawbacks, as programs could be written incorrectly and fail to yield in a timely manner, causing the system to become slow and unresponsive. Additionally, programs cooperated in the same unprotected memory space, so a crash of one program meant that the entire system could be brought down by a single fault.
Advances in hardware allowed for the processes to be interrupted by the operating system. This brought about the next generation of time sharing, known as preemptive time sharing. Along with this model came advances in virtual memory that allowed each program to run in its own virtual memory space. No longer would a single program cause a systemic crash, and a program could no longer fail to yield (in theory, at least).
What is java compound statement?
A compound statement is a group of statements enclosed in braces, i.e curly brackets. A compound statement is a group of statements enclosed in braces, i.e curly brackets.
What is a finite and infinite set?
A set which containing $and pi are the end blocks are the finite and without these are infinite
What is the difference between exe and class files?
in .exe file it contains
machine understandable code. but in .class file it contain only byte code which is not understadable by the microprocessor it will understud by the jvm only . we con't execute .class file without jvm . but we can execute .exe file without c-compiler .
How many objects of a given class can there be in a program?
It depends on the size of the object and the amount of (virtual) memory available. However, the size of an object is not determined by the amount of memory it physically occupies, but by the amount of memory it consumes. For example, a resource handle object occupies at least one word of memory, but the resource it refers to consumes additional memory. The sizeof operator only returns the size of memory occupied by the object itself, not the total memory consumed by the object.
Where do you type in HTML code to make a page?
The place in which you place JavaScript codes for a website depends entirely on what the code is doing.
If you're going to place the code directly in the website, it is generally advisable to use <SCRIPT> tags to surround the code, and place that code into the HEAD section of the document.
In the old days, we also used the HEAD section for includes ( <script src="blahblahblah.js"...> ) and this is still done if you want to be sure that the script is loaded before the page starts.
However, if the script loading a little later, it's good Search Engine Optimization practice to instead include the script tags at the bottom of the BODY section, just prior to closing.
How do you write a simple JAVA program to print the letter A in asterisks?
/**
* Prints a pyramid of asterisks of the specified height.
*
* Will print in the form: printStars(3) =
*
***
*****
*/
public static final void printStars(final int height) {
// perform calculations once
final int totalLength = (height * 2) - 1;
final int totalLength_2 = totalLength / 2;
StringBuilder str = new StringBuilder(totalLength);
// fill with spaces
for (int i = 0; i < totalLength; ++i) {
str.append(' ');
}
// fill in levels
for (int i = 0; i <= totalLength_2; ++i) {
str.setCharAt(totalLength_2 + i, '*');
str.setCharAt(totalLength_2 - i, '*');
System.out.println(str);
}
}
/**
* Prints a pyramid of asterisks of the specified height.
*
* Will print in the form: printStars(3) =
*
* *
* *
*/
public static final void printStars(final int height) {
// perform calculations once
final int totalLength = (height * 2) - 1;
final int totalLength_2 = totalLength / 2;
StringBuilder str = new StringBuilder(totalLength);
// fill with spaces
for (int i = 0; i < totalLength; ++i) {
str.append(' ');
}
// fill in levels
for (int i = 0; i <= totalLength_2; ++i) {
if ((totalLength_2 + i - 1) >= 0) {
str.setCharAt(totalLength_2 + i - 1, ' ');
}
if ((totalLength_2 - i + 1) < totalLength) {
str.setCharAt(totalLength_2 - i + 1, ' ');
}
str.setCharAt(totalLength_2 + i, '*');
str.setCharAt(totalLength_2 - i, '*');
System.out.println(str);
}
} OR second method and easier package javaapplication12; /**
*
* @author Dexy86
*/
public class Main {
public static void main(String[] args) {
for(int i=0; i<5; i++){
for(int v=0;v<i; v++){
System.out.print("*");
}
System.out.println();
}
}
}
How many keywords in java 1.6?
As of Java 1.5, there are 50 keywords defined, 48 of which are used (const and goto are unusable keywords).
What is a graphical interface?
A graphical interface usually known as a GUI (Graphic User Interface) is things such as menus and icons in an operating system. It represents the UI (User Interface) the things you interact with in a graphic form.
Hope I could help ;)
java.awt is a standard package of Java. It is a GUI(Graphical User Interface) package, which has classes in it such as Frame, Panel, and Button. Most of the package was later replaced with the javax.swing package, which has most of the same classes, only with a J prepended to them (JFrame, JPanel, JButton). However the java.awt package still includes some event handlers that are considered standard in java (java.awt.event).
What is the difference between coffee and java?
The language was originally called 'Green' but was renamed after Java coffee due to the large amounts of it consumed by the developers.
What are the benefits of multidimensional arrays?
Multi-dimensional arrays are accessed using more than one index: one for each dimension. Multidimensional indexing can be reduced internally to linear indexing; for example, a two-dimensional array with 6 rows and 5 columns is typically represented by a one-dimensional array of 30 elements.
What is the difference between friend function and inheritance in c plus plus?
There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.
How many days preparation is enough for scjp?
hello friend, scjp is the internationaly rcognized certification program conducted world wide 24*7 and whole year.as there is no time limit for this xam but if u r familiar with java then i would take approx 1 month to pass with a good score but if u r new to java then in that case it can take even 2 and half month.these are ideal facts but generally it depends on the time that u r giving to ur studies.exam code for scjp 1.4 is 310-035.best books are keithy sierra AND KHALID MOUGHAL.best of luck for the exam.you can cotact me at nrapendralsharma@gmail.com.
I have prepared only 7 days and got 93 percentile .. I have purchased preparation kit from http://www.techfaq360.com/mocktest.jsp
This kit is too good ... you can attend mock exams and easily pass
Write a program in Java to print the numbers 1 to 100?
class sum
{
void main ()
{
int sum = 0;
int n = 1;
while ( n <= 100 )
{
sum = sum + n;
n++ ;
}
System.out.println("Sum is = " + sum );
}}
How do you use subscripts with an array?
An array is a list of several related elements. You use the subscript to specify which element you want to access. For example, in Java you might have an array called myArray, with 10 elements (numbered from 0 to 9); myArray[3] would access the fourth element in the array. A variable may be used instead of a constant.
Difference between static methods and static variables?
A static variable can be declared module-wide, and thus be accessed by all functions defined within the same source file. Such a static variable cannot be directly accessed from other modules, but inner-module API can pass pointers to static variables and modify those through pointers.
A static variable can also be declared within a function body, where the usual scope rules apply. A static variable declared within a function is only initialized when the module is initialized (typically when the application loads), and preserves its values over multiple invocations of the function that contains the definition.
In C++, a static variable can also be a member of a class definition. Access to a static member variable is governed by the standard access modifiers (private, public, protected), but all instances of this class share the same static variable, and share the same value. Modifying the value of this variable affects all objects of the class.
VolatileThe volatile keyword is something all together different, and not in any way an opposite to static. A static variable may or may not be declared volatile, just as a global or local variable can be.
The volatile keyword is a hint informing the compiler that the variable's value might change without the compiler's knowledge. Therefore, the compiler's code optimizer cannot make assumptions about the variable's current value, and must always (re-) read the variable's content.
Volatile variables are sometimes used in context with interrupt handlers (although those normally benefit from more sophisticated synchronization methods such as semaphores, mutexes or locks). Most typically, volatile variables are used to model hardware registers through variables.
For example, consider a hardware register at address 0x1234, containing a single byte. The value of this byte is hardware driven and contains, for example, the current ambient light level in a range of 0..255. Such a register could be modeled with this construct:
unsigned char *const volatile lux = (unsigned char *)0x1234;
unsigned char firstReading = *lux;
unsigned char secondReading = *lux;
In this example, the volatile keyword ensures that the second reading is taken from the hardware register again. Without, a good compiler will read the memory address once and assign the same value to both variables.
Member functions must always be declared inside a class declaration, however they may be defined either inside or outside of the class. A definition is simply the implementation of a function, the code that is executed when the function is called.
When a function is defined inside a class declaration then it is implicitly inline expanded. When it is defined outside of a class declaration, it is not inline expanded but you may explicitly declare it to be inline expanded, if desired. Note that inline expansion should only be utilised when the function has but a few simple statements, preferably just one or two statements at most.
The following example demonstrates the definition of a typical class accessor (a getter) defined within a class declaration (where inline expansion is implied and desired):
class A {
public: int get_data()const{return(m_data);}
private: int m_data;
};
The following example shows the same function defined outside of the class. This time the function will not be inline expanded.
class A {
public: int get_data()const;
private: int m_data;
};
int A::get_data()const{return(m_data);}
Note that the definition may appear in a different file. Generally, classes are designed with a header file and a source file, where the header contains the declarations and the source contains the definition. The source file must include the header file.
Since it is often desirable to inline expand simple class accessors that merely return values, the inline keyword can be used when the definition is external to the class declaration, like so:
class A {
public: inline int get_data()const;
private: int m_data;
};
int A::get_data()const{return(m_data);}
Note that declaring a function inline (implicitly or explicitly) is no guarantee that it will actually be inline expanded, you are merely signalling to the compiler that the function is a candidate for expansion. The compiler is still free to veto the promotion if its inline optimisers deem that such an expansion would compromise performance due to the increased code size that inline expansion incurs. Functions that are called in only one place in your code, regardless of how complex they are, are generally good candidates for expansion. Although you could manually inline expand such functions, if the function call makes your calling code easier to read and maintain, then it's better to retain the function in your code.
Note also that while some compilers allow you to force an inline expansion (such as Microsoft's __forceinline keyword), effectively bypassing the compiler's optimisers, this should be done sparingly as the increased code size can easily outweigh any performance gained by removing the function call. Also note that some functions cannot be inline expanded, even by force. In particular, the compiler cannot inline expand any of the following:
* Some recursive functions can be inline expanded up to a predetermined depth, usually 16 calls at most (thereafter, the calls are treated as calls to new instances of the function). The predetermined depth generally cannot be increased, but it can typically be reduced with a pragma.
For more specific information on inline expansion within your compiler or IDE, consult the compiler's documentation regarding the inline keyword.
What are the applications of Class B Power Amplifier?
Its used in collector amplitude modulation,Radio frequency recievers ..etc
Abstraction encapsulation and inheritance with examples?
Abstract classes are a conceptual means of classifying objects. For instance, humans, gorillas, zebras, cats and dogs are all different types of animal but the one thing they all have in common is that they all have mammaries. Thus they are all classified as being mammals in the animal kingdom. The terms "animal" and "mammal" are entirely conceptual, thus they are abstractions. By the same token, circles, squares and triangles are all types of shape, where "shape" is the abstraction.
In computer programming, we use abstract classes to classify objects. Thus if our program utilised collections of shapes, we'd define an abstract class named shape and derive our specific types of shape from that class.
An abstract class is also known as an abstract data type or ADT. Ideally, an ADT has no data associated with it. The main function of an ADT is to provide a common interface to all its derivatives, typically though a pure-virtual interface. A pure-virtual method is a method that is common to all derivatives but one that must be implemented by those derivatives. For instance, if we wish to rotate all of our shapes, we can declare a pure-virtual rotate() method in the ADT shape class. Each derived class must then implement that method otherwise it, too, becomes an ADT.
In order for an instance of an ADT to exist, a derived class must implement all the pure-virtual methods inherited from its ADT. In so doing, we are assured that if an ADT exists, we can invoke any of its pure-virtual methods even if we do not know the specific type of the ADT. The specifics are handled by the derivative itself. Thus if we invoke the shape::rotate() method upon a square, the square::rotate() method will be invoked automatically. Thus we get the correct behaviour, automatically, without having to perform a runtime check to determine what type of shape is actually being rotated.
Purpose of marker interface in java?
Generally, they are used to give additional information about the behaviour of a class.It is just used to "mark" Java classes which support a certain capability . Examples: java.util.RandomAccess
java.io.Serializable
java.rmi.Remote
java.util.EventListner
javax.servlet.SingleThreadModel
java.lang.Clonable
javax.ejb.EnterpriseBean
Is string is primitive or user defined data type?
String - is primitive data type
string - is user defined data type
What is the use of import in java?
First, it's an error; it should be import java.util.*;
That will make all classes in the java.util package availabe for use in your Java class definition. Java is divided up into packages. Each package can hold classes and other packages. java.util is a package.
What is the difference between binary file and text file in java?
HI... When you access a file from within C or C++ you have a choice between treating the file as a binary file or as a text file. C uses the fopen(file,mode) statement to open a file and the mode identifies whether you are opening the file to read, write, or append and also whether the file is to be opened in binary or text mode. C++ opens a file by linking it to a stream so you don't specify whether the file is to be opened in binary or text mode on the open statement. Instead the method that you use to read and/or write to the file determines which mode you are using. If you use the <<operator to read from the file and the >> operator to write to the file then the file will be accessed in text mode. If instead you use the put() and get() or read()and write() functions then the file will be accessed in binary mode. So what exactly is the difference between text and binary modes? Well the difference is that text files contain lines (or records) of text and each of these has an end-of-line marker automatically appended to the end of it whenever you indicate that you have reached the end of a line. There is an end of line at the end of the text written with the C fwrite() function or in C++ when you <. Binary files are not broken up into separate lines or records so the end-of line marker is not written when writing to a binary file. Reading from a text file or binary file is different too as a text file is automatically broken up into separate records as it read in based on the location of the end-of-line markers. So what is this end-of-line marker? Well that depends on the operating system that you are using. The Apple Macintosh computers use a single carriage return as the end-of-line marker (x'0D') while Unix based operating systems including Linux use a single line-feed character (x'0A'). Most PC based systems including DOS, all versions of windows, and OS/2 use a carriage return/line feed combination (x'0D0A') as the end-of-line marker. C and C++ terminate strings with a low value character (x'00'). So what happens when we read from a text file is that the end-of-line character for the operating system that we are using gets converted into a low value end-of-string indicator and when we write to a file the appropriate end-of-line character(s) get written when we indicate the end of the line. This makes the reading and writing of text files much easier because the appropriate end-of-line markers are handled for us. With a binary file none of these conversions take place. When we read a binary file the end-of-line characters for our operating system will be read into the string and treated no different than any other character. When we write to a binary file the only end-of-line markers that are written will be those that we code into the output ourselves and hence will be exactly as we code it regardless of the operating system that we are running on. This makes it much easier for us when the file does not contain straight text and the end-of-line marker does not separate lines of text but rather appears as part of the non-text data content of the file. A binary file can contain text but the text that it contains is not considered to be broken up into a number of lines by the occurrence of end-of-line markers. A binary file may alternatively contain information that contains no text whatsoever. It is up to the program reading the file to make sense of the data contained in a binary file and convert it into something meaningful (eg. an image or a series of fixed length records). Regards Neelagiri
List some dbms and rdms software?
The name of few DBMS are FOXPRO, MS-ACCESS, SQL Server, My SQL, ORACLE, etc.