"nextInt()" gets the next integer entered by the user.
here is a simple code-
import java.util.Scanner
public class {
bhal bhal
Scanner in = new Scanner (System.in)
int x;
System.out.println ("enter a number");
x=in.nextInt();
}
here "in" is an object of the "Scanner" class and "nextInt()" gets the next integer from the user for "in" object and assigns it to "x" variable which is declared as int variable before.
What are the uses of Boolean algebra?
One use of Boolean algebra is to minimize any function or logic gate.
How do you make a program that counts how many times each digit occured in the integer?
To count the number of times a digit occurs in an integer, start by initializing an array of ten counts of digits, such as int digits[10];
Then, in a loop while the number is non zero, increment the element in the digits array that corresponds to the units digit, and then divide the number by ten, such as digits[number%10]++ and number/=10;
int digits[10];
int i;
int number = some number;
for (i=0; i<10; i++) digits[i]=0;
do (digits[number%10]++; number/=10) while (number != 0);
What is the difference between Imperative object-oriented functional and logic programming?
These are all programming paradigms; they describe the "style" used to build the structure and elements of a computer program.
Imperative programming is typically contrasted with declarative programming because they are mutually-exclusive (you won't find any programming languages that are both imperative and declarative), in the same way that you won't find any languages that have both a structured paradigm and a non-structured paradigm. The main difference between the two is that imperative programming describes how a result is to be achieved without specifying what is to be achieved, whereas declarative programming describes what is to be achieved without specifying how it is to be achieved.
Another key difference is that imperative programming makes extensive use of changing-state and mutable data whereas declarative programming does not. Put simply, there are no assignment operations or side-effects in declarative programming.
Given that the object-oriented programming (OOP) paradigm is based upon objects with member methods that can mutate the object's attributes, OOP is based upon the imperative paradigm.
The functional programming paradigm is not to be confused with function calls which are based upon the procedural programming paradigm, which is itself based upon the structured programming paradigm, both of which are imperative. By "functional" we really mean mathematical functions, which are declarative. Although there are some imperative languages that do allow a type of functional programming style, at best they are a grey area because of the side-effects.
Logical programming is also declarative and is based on relations.
Technically
The algorithm has a greater chance of hash collisions than other, similar hashing algorithms. This means it is less computationally expensive to crack than similar ones (such as SHA-1) and is thus less secure.
For the Layman, briefly:
MD5 is insecure because computer attackers have figured out a way to trick the MD5 security system into verifying that no tampering has occurred, when in fact the attacker has injected malicious code. It's like purchasing a lock for your bike that has a 5 buttons. Pressing one button will open the lock. The criminal can just try every possible combination in a short time, and thus the lock is considered insecure.
Why is MD5 Insecure? Technical answer:
Bob owns some web space on blue host, and he uploads an executable there that he intends other people to download and run so they can install his video game: angry_birds_installer.exe.
Bob uploads angry_birds_installer.exe to blue host and has allowed other people to download it through the browser and install the game so they can install/play it. Bob generates profit by people buying the unlocked version of the game, therefore Bob wants to make absolutely sure that the attacker doesn't use the installer to install malware on the customers who install the game.
Description of the security problem:
Bob's executable is super-insecure now because suppose an attacker breaks in to his blue host account and somehow gets the ability to make a change to angry_birds_installer.exe. The attacker could drop in the new executable, and nobody is the wiser. Now, users who install angry_birds_installer.exe also install Conficker, a malicious bot-net on the customer's computer.
Why would an attacker go to all this trouble?
Answer: profit. The attacker wants to get in between Bob and his customers so he can install Conficker. With that, he can do the following things:
Bob has a lot to be worried about on behalf of his customers who don't know the difference between browser security, antivirus software and a hole in the ground.
Bob increases security with MD5 Sums
Bob has a plan, he will protect his executable by taking an MD5 check sum on angry_birds_installer.exe and store the result somewhere else (say on his go daddy web space) that has a different security system. The security conscious users who want to run angry_birds_installer.exe will also run an MD5 check sum against the executable they downloaded, and make sure that the check sums exactly match. If they do match, we can be relatively certain that the attacker has not modified the original angry_birds_installer.exe.
Security problem solved?
No. Mal-ware creators are clever, they were able to figure out that MD5 is insecure. They were able to find a way to break the algorithm for MD5 in order to run trillions of MD5 sums every second and find a "hash collision" between the original angry_birds_installer.exe and the modified: angry_birds_with_malware.exe. The attacker only has to compromise the blue host security and can drop-in the new executable that generates the SAME MD5 sum as the original, and the users who do check sums declare that the executable is safe, when it contains malware to install Conficker.
MD5 sum is insecure because Bob thinks he is protecting the users from evil mal ware creators, but in reality, the mal ware creators have figured out a way to completely bypass the security model. MD5 Sums do not deliver any significant security enhancements as it was originally envisioned to be.
What is the significance of test condition in a loop?
The test condition in a loop is what's used to determine when the loop should end.
Why is the Bubble Sort algorithm also referred ro as Sink Sort?
Bubble sort got its name because if you could watch the way your data was changing, on each iteration you would see the greatest number "bubble" to the top.
Similarly, you could said that you would see the lowest number "sink" to the bottom.
What is the purpose of the fast link pulse?
The purpose of the fast link pulse (FLP) burst is to "advertise" one computer's capabilities to another computer before a link is established between them. The FLP burst sends information to the other computer telling it, for example, how fast it is. The other computer then checks to see if this is an upgrade and, if it is, decides to use it when a link is established. The computer sending out the FLP then clocks itself at the same speed as the normal link pulse of the other computer, establishing a link with it. This process is called autonegotiation.
Why you call as cousins of compiler?
"Cousins" of the compiler are those things related to the compiler, and may or may not be part of the compiler. This includes: preprocessors, assemblers, linkers, and interpreters.
What are high level programming languages?
A '''high level language''' is a computer language that is more easily understood by a human being than a computer. As opposed to low and intermediate languages (like assembler or binary) a high level language has to be translated or compiled into a format that can be understood by the processor. Examples of high level languages are BASIC, ForTran and CoBOL.
The term high-level language is merely an indication of the level of abstraction between the programming language and the architecture.
Machine code (a specific sequence of 1s and 0s) is the native language of the computer, and is specific to each architecture (PC, Mac, mobile phone, tablet, PIC, etc). Before there were any computer languages, all computer programs were input as a sequence of machine code, which was prone to error and extremely difficult to debug.
Assembly language was, arguably, the first computer language, and is extremely low level. Every architecture requires its own assembler, where every CPU instruction is mapped to an easy to remember mnemonic. This made programs easier to read and therefore maintain. Since there was no abstraction between the symbolic language and the resulting machine code, assembly is considered to be a low-level language.
After the introduction of assembly instructions, high-level languages began to appear. These added another level of abstraction between the language and the architecture, such that a single symbolic instruction could easily produce dozens of assembly instructions. This simplified programming making it all the more easier to read and maintain.
Although all symbolic languages apart from assembly are considered to be high-level languages, there are differences in the degree of abstraction. C/C++ and its variants have a relatively low degree of abstraction because they have low-level features such as direct memory access and can access the specific architectural features of the CPU. They also compile to native machine code which can be further tweaked with assembly to produce highly-efficient machine code specific to the intended architecture. By contrast, Java has a high degree of abstraction because it compiles to byte code which must be translated by the Java virtual machine (JVM) within which the byte code executes. Although this makes Java code highly-portable (code will run on any platform with a JVM, without the need for any code changes), the need for the JVM itself adds an extra level of abstraction, which means there is very little interaction between the original code and the architecture itself. In other words, a Java program cannot compete with C++ for performance.
How do you write a c code for memory allocation algorithms?
#include<stdio.h>
typedef struct hole
{
int id,size,inf,ef,filled,pid,psize;
}hole;
typedef struct process
{
int id,size,comp;
}process;
hole h[50];
process p[50];
int m,n,intfrag,exfrag;
void output()
{
int i;
intfrag=exfrag=0;
printf("\n\n\nHole Process IF EF\n");
for(i=0;i<m;i++)
{
printf("\n%d %d %d %d",h[i].size,h[i].psize,h[i].inf,h[i].ef);
intfrag=intfrag+h[i].inf;
exfrag=exfrag+h[i].ef;
}
}
void final()
{
int i;
for(i=0;i<n;i++)
{
if(p[i].comp==0)
{
printf("There is no memory for the process of size %d\n",p[i].size);
}
}
}
void input()
{
int i,max,flag;
max=flag=0;
printf("\nEnter total no of holes:\n");
scanf("%d",&m);
for(i=0;i<m;i++)
{
h[i].id=i;
printf("\nEnter size of hole %d:\n",i+1);
scanf("%d",&h[i].size);
h[i].inf=0;
h[i].ef=h[i].size;
h[i].filled=0;
h[i].pid=0;
h[i].psize=0;
}
for(i=0;i<m;i++)
{
if(h[i].size<0)
{
printf("\nInvalid input as hole size is negative");
flag=1;
}
if(h[i].size>max)
{
max=h[i].size;
}
}
printf("\nEnter total no of processes:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
p[i].id=i;
printf("\nEnter size of process %d:\n",i+1);
scanf("%d",&p[i].size);
p[i].comp=0;
}
for(i=0;i<n;i++)
{
if(p[i].size<0)
{
printf("\nInvalid input as process size is negative");
flag=1;
}
if(p[i].size>max)
{
printf("\nInvalid input as process size is greater than max size of hole\n");
flag=1;
}
}
if(flag==0)
{
output();
}
}
void first()
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(p[i].size<=h[j].size && p[i].comp==0 && h[j].filled==0)
{
p[i].comp=1;
h[j].filled=1;
h[j].psize=p[i].size;
h[j].id=p[i].id;
h[j].inf=h[j].size-p[i].size;
h[j].ef=0;
output();
}
}
}
printf("\n\n\nInternal Fragmentation:%d",intfrag);
printf("\n\n\nExternal Fragmentation:%d\n\n",exfrag);
final();
}
void best()
{
int min,i,j,sub,var;
for(i=0;i<n;i++)
{
min=999;
sub=0;
for(j=0;j<m;j++)
{
if(p[i].size<=h[j].size && p[i].comp==0 && h[j].filled==0)
{
sub=h[j].size-p[i].size;
if(min>sub)
{
min=sub;
var=j;
}
}
}
p[i].comp=1;
h[var].filled=1;
h[var].psize=p[i].size;
h[var].id=p[i].id;
h[var].inf=h[var].size-p[i].size;
h[var].ef=0;
output();
}
printf("\n\n\nInternal Fragmentation:%d",intfrag);
printf("\n\n\nExternal Fragmentation:%d\n\n",exfrag);
final();
}
void next()
{
int i,j,a;
a=j=0;
for(i=0;i<n;i++)
{
for(j=a;j<m;j++)
{
if(p[i].size<=h[j].size && p[i].comp==0 && h[j].filled==0)
{
p[i].comp=1;
h[j].filled=1;
h[j].psize=p[i].size;
h[j].id=p[i].id;
h[j].inf=h[j].size-p[i].size;
h[j].ef=0;
output();
a=(j+1)%m;
}
}
}
printf("\n\n\nInternal Fragmentation:%d",intfrag);
printf("\n\n\nExternal Fragmentation:%d\n\n",exfrag);
final();
}
void main()
{
int ch;
printf("\n\n\n**********MEMORY ALLOCATION**********\n\n");
printf("\n1.First Fit Algorithm\n2.Best Fit Algorithm\n3.Next Fit Algorithm");
printf("\nEnter your choice:\n");
scanf("%d",&ch);
switch(ch)
{
case 1: input();
first();
break;
case 2: input();
best();
break;
case 3: input();
next();
break;
}
}
Written by: Fabianski Benjamin
Who invented the cobol language?
It was largely a product of Grace Hopper, although she wasn't the only person responsible.
What are the limitations of finite automata?
The defining characteristic of FA is that they have only a finite number of states. Hence, a finite automata can only "count" (that is, maintain a counter, where different states correspond to different values of the counter) a finite number of input scenarios.
There is no finite automaton that recognizes these strings:
The 'pumping lemma' can be used to prove that no such FA exists for these examples.
why using k map the rule is that the extra overlapping should not done .But in some case this may cause the problem in combinational logic that problem are called 'Hazards' and it can only overcome by using overlapping of k-map.
What are the advantage and disadvantage of coding standards?
Advantages
Disadvantages
What is the scope in computer science engineering and what will it be in four years?
Computer software engineers apply the principles of computer science and mathematical analysis to the design, development, testing, and evaluation of the software and systems that make computers work. The tasks performed by these workers evolve quickly, reflecting new areas of specialization or changes in technology, as well as the preferences and practices of employers. (A separate section on computer hardware engineers appears in the engineers section of the Handbook.)
Software engineers can be involved in the design and development of many types of software, including computer games, word processing and business applications, operating systems and network distribution, and compilers, which convert programs to machine language for execution on a computer.
Computer software engineers begin by analyzing users' needs, and then design, test, and develop software to meet those needs. During this process they create the detailed sets of instructions, called algorithms, that tell the computer what to do. They also may be responsible for converting these instructions into a computer language, a process called programming or coding, but this usually is the responsibility of computer programmers. (A separate section on computer programmers appears elsewhere in the Handbook.) Computer software engineers must be experts in operating systems and middleware to ensure that the underlying systems will work properly.
Computer applications software engineers analyze users' needs and design, construct, and maintain general computer applications software or specialized utility programs. These workers use different programming languages, depending on the purpose of the program. The programming languages most often used are C, C++, and Java, with Fortran and COBOL used less commonly. Some software engineers develop both packaged systems and systems software or create customized applications.
Computer systems software engineers coordinate the construction, maintenance, and expansion of an organization's computer systems. Working with the organization, they coordinate each department's computer needs-ordering, inventory, billing, and payroll recordkeeping, for example-and make suggestions about its technical direction. They also might set up the organization's intranets-networks that link computers within the organization and ease communication among various departments.
Systems software engineers also work for companies that configure, implement, and install the computer systems of other organizations. These workers may be members of the marketing or sales staff, serving as the primary technical resource for sales workers. They also may help with sales and provide customers with technical support. Since the selling of complex computer systems often requires substantial customization to meet the needs of the purchaser, software engineers help to identify and explain needed changes. In addition, systems software engineers are responsible for ensuring security across the systems they are configuring.
Computer software engineers often work as part of a team that designs new hardware, software, and systems. A core team may comprise engineering, marketing, manufacturing, and design people, who work together to release a product.
Job Outlook
Job prospects should be excellent, as computer software engineers are expected to be among the fastest-growing occupations through the year 2016.
Employment change. Employment of computer software engineers is projected to increase by 38 percent over the 2006 to 2016 period, which is much faster than the average for all occupations. This occupation will generate about 324,000 new jobs, over the projections decade, one of the largest employment increases of any occupation.
Employment growth will result as businesses and other organizations adopt and integrate new technologies and seek to maximize the efficiency of their computer systems. Competition among businesses will continue to create incentive for sophisticated technological innovations, and organizations will need more computer software engineers to implement these changes.
Demand for computer software engineers will also increase as computer networking continues to grow. For example, expanding Internet technologies have spurred demand for computer software engineers who can develop Internet, intranet, and World Wide Web applications. Likewise, electronic data-processing systems in business, telecommunications, government, and other settings continue to become more sophisticated and complex. Implementing, safeguarding, and updating computer systems and resolving problems will fuel the demand for growing numbers of systems software engineers.
New growth areas will also continue to arise from rapidly evolving technologies. The increasing uses of the Internet, the proliferation of Web sites, and mobile technology such as wireless Internet have created a demand for a wide variety of new products. As individuals and businesses rely more on hand-held computers and wireless networks, it will be necessary to integrate current computer systems with this new, more mobile technology.
In addition, information security concerns have given rise to new software needs. Concerns over "cyber security" should result in businesses and government continuing to invest heavily in software that protects their networks and vital electronic infrastructure from attack. The expansion of this technology in the next 10 years will lead to an increased need for computer engineers to design and develop the software and systems to run these new applications and integrate them into older systems.
As with other information technology jobs, outsourcing of software development to other countries may temper somewhat employment growth of computer software engineers. Firms may look to cut costs by shifting operations to foreign countries with lower prevailing wages and highly educated workers. Jobs in software engineering are less prone to being offshored than are jobs in other computer specialties, however, because software engineering requires innovation and intense research and development.
Source: U.S. Department of Labor
Why parenthesis are never needed in prefix or postfix notation?
Because there is not an "order of operations" in prefix or postfix notation. The order in which you put the numbers and operators is the order in which calculation occurs.
Java was developed in the early 1990's by James Gosling at Sun Microsystems. Java was introduced to the public in 1995.
What year was the first computer invented?
The very first computer was the Abacus, invented in 3,000 B.C. For a history of the modern computer, use Google Search and type in Computer History.
What is the difference between deterministic finite automata and non deterministic finite automata?
A deterministic Finite Automata)DFA will have a single possible output for a given input.The answer is deterministic because you can always feel what the output will be.
A (Nondeterministic Finite Automata)NFA will have at least one input which will cause a "choice" to be made during a state transition,unlike a (deterministic Finite Automata)DFA one input can cause multiple outputs for a given (Nondeterministic Finite Automata)NFA.
Why is zero important in computers?
zero is important in computer because computer runs on binary language that is 0s and 1s it means that computer is off