It is all 1's, no matter how many bits you have. The first 1 is for the negative sign, and you can think of the rest of the number being all 1's, because -1 is the highest negative whole number, then as you go down the negative whole numbers from there, (-2, -3, -4), etc you count backwards from there (always keeping the first 1 as a 1 for the negative sign).
Another way to get a negative number's two complement is to flip all the 1's and 0's, make the first bit a 1, and add 1 to the number
When you add a positive number and a negative form of that number, you get all 0's with a 1 carried to the far left of the number. If for example you have 2 eight bit numbers, one positive and one is 2's complement negative of the positive number
(eg: 2 + -2), it gets all 0's with 1 carried outside of the number - so in a computer it get represented as a 0 (because the 1 gets lost - since these are only 8 bit numbers each)
So the 2 compliment's system makes sense in more then one way.
What are the languages used in Application program?
The Java compiler is written in Java (fun), while the JRE is written in ANSI C.
There is no single answer to this question. A byte is universally defined as a tuple of 8 bits (sometimes bytes are also called octets, therefore).
However, a word commonly refers to the natural word for a given processor, that is the processor's preferred entity for arithmetic operations. The word is therefore typically defined by the processor's ALU width.
Typical 8, 16 or 32 bit processors have 8, 16 or 32 bit words (containing 1, 2 or 4 bytes), respectively. Other processors have another word size, such as 3 bytes per word, or 8.
In Windows programming, a word is often thought to refer to a 16 bit entity, mostly because the classic 32-bit Windows API makes frequent use of DWORD, a double-word, 32 bits or 4 bytes wide. However, these data types are not generally portable and are not recommended for use outside the specific context of this API.
How many compiler in c plus plus?
They are completely unrelated. Java was designed as an attempt to improve C++, and C# was designed as an attempt to improve Java, so they have many things in common. They are not, however, the same language.
Volatile variables are variables that may change value while they are being operated upon. For instance, a hardware clock is constantly updated by the operating system, thus its value is constantly changing. If you refer to the value, you must declare it volatile because the value is outwith the control of the program.
The inventor of Turbo Basic was Robert Zale. Borland bought the rights to it, but when they left the compiler market, they sold the rights back to Robert Zale, where he continued to develop it into an updated version, PowerBASIC.
256 MB = 1/4 of a GB. So there is a fourth of a gigabyte in 256 megabytes.
How do you write a program in C to swap two variables using a function?
#include<iostream>
void swap(int* x, int* x){
(*x)^=(*y)^=(*x)^=(*y);
}
int main()
{
int a, b;
a=10;
b=20;
std::cout<<"Before swap: a="<<a<<", b="<<b<<std::endl;
swap(&a,&b);
std::cout<<"After swap: a="<<a<<", b="<<b<<std::endl;
return(0);
}
Write a c program to determine the size of an array?
using sizeof operator the size of whole array can be calculated, then divide it with the zise of the datatype(E.g. for int =4, char =2....etc.)
Example:
#define Narray (sizeof(array)/sizeof(array[0]))
What is the definition of open source software?
Open source software (OSS) is defined as computer software for which the source code and certain other rights normally reserved for copyright holders are provided under a software license that meets the Open Source Definition or that is in the public domain. This permits users to use, change, and improve the software, and to redistribute it in modified or unmodified forms. It is very often developed in a public, collaborative manner. Open source software is the most prominent example of open source development and often compared to user-generated content. The term open source software originated as part of a marketing campaign for free software. A report by Standish Group states that adoption of open source software models has resulted in savings of about $60 billion per year to consumers.
The term open source ("OS") describes a type of production, dissemination and exploitation of software opposed to the so-called "proprietary" way of distribution. OS-software is usually produced in a collaborative process by a web-based community. The ultimate aim is to create stable, compatible and free software. In order to achieve this, the source code is "open" for anyone to see and distributed along with the software and the according license. By these means, any user of the software has access to the code, can learn about it and develop it further Free use, modification and distribution is the core concept of OS. Many, but not all OS-licenses are distributed with a so-called copyleft-clause. Copyleft licenses do not only license the aforementioned types of exploitation, they do so only under the condition of re-distribution under the same license. The Open Source Initiative awards a cachet to all licenses that are in compliance with its Open Source Definition, which is a worldwide acknowledged standard. OS-licenses have been successfully tested in courts.
How to write a program in C programming language to multiply two polynomials?
#include <stdio.h>
#include <conio.h>
#define MAX 10
struct term
{
int coeff ;
int exp ;
} ;
struct poly
{
struct term t [10] ;
int noofterms ;
} ;
void initpoly ( struct poly *) ;
void polyappend ( struct poly *, int, int ) ;
struct poly polyadd ( struct poly, struct poly ) ;
void display ( struct poly ) ;
void main( )
{
struct poly p1, p2, p3 ;
clrscr( ) ;
initpoly ( &p1 ) ;
initpoly ( &p2 ) ;
initpoly ( &p3 ) ;
polyappend ( &p1, 1, 4 ) ;
polyappend ( &p1, 2, 3 ) ;
polyappend ( &p1, 2, 2 ) ;
polyappend ( &p1, 2, 1 ) ;
polyappend ( &p2, 2, 3 ) ;
polyappend ( &p2, 3, 2 ) ;
polyappend ( &p2, 4, 1 ) ;
p3 = polymul ( p1, p2 ) ;
printf ( "\nFirst polynomial:\n" ) ;
display ( p1 ) ;
printf ( "\n\nSecond polynomial:\n" ) ;
display ( p2 ) ;
printf ( "\n\nResultant polynomial:\n" ) ;
display ( p3 ) ;
getch( ) ;
}
/* initializes elements of struct poly */
void initpoly ( struct poly *p )
{
int i ;
p -> noofterms = 0 ;
for ( i = 0 ; i < MAX ; i++ )
{
p -> t[i].coeff = 0 ;
p -> t[i].exp = 0 ;
}
}
/* adds the term of polynomial to the array t */
void polyappend ( struct poly *p, int c, int e )
{
p -> t[p -> noofterms].coeff = c ;
p -> t[p -> noofterms].exp = e ;
( p -> noofterms ) ++ ;
}
/* displays the polynomial equation */
void display ( struct poly p )
{
int flag = 0, i ;
for ( i = 0 ; i < p.noofterms ; i++ )
{
if ( p.t[i].exp != 0 )
printf ( "%d x^%d + ", p.t[i].coeff, p.t[i].exp ) ;
else
{
printf ( "%d", p.t[i].coeff ) ;
flag = 1 ;
}
}
if ( !flag )
printf ( "\b\b " ) ;
}
/* adds two polynomials p1 and p2 */
struct poly polyadd ( struct poly p1, struct poly p2 )
{
int i, j, c ;
struct poly p3 ;
initpoly ( &p3 ) ;
if ( p1.noofterms > p2.noofterms )
c = p1.noofterms ;
else
c = p2.noofterms ;
for ( i = 0, j = 0 ; i <= c ; p3.noofterms++ )
{
if ( p1.t[i].coeff p2.t[j].exp )
{
p3.t[p3.noofterms].coeff = p1.t[i].coeff + p2.t[j].coeff ;
p3.t[p3.noofterms].exp = p1.t[i].exp ;
i++ ;
j++ ;
}
else
{
p3.t[p3.noofterms].coeff = p1.t[i].coeff ;
p3.t[p3.noofterms].exp = p1.t[i].exp ;
i++ ;
}
}
else
{
p3.t[p3.noofterms].coeff = p2.t[j].coeff ;
p3.t[p3.noofterms].exp = p2.t[j].exp ;
j++ ;
}
}
return p3 ;
}
What is better turbo c or dev C?
Depends upon the personal opinion. They both are different IDE. Dev C used the MICGW compiler while Turbo C uses Borland compiler. Hence due to this, certain inbuilt functions will not work in Dev C. clrscr() is one such function. However Turbo C is outdated and does not use follow many of the programming standards.
Which of the following is not a computer programming language BCPL Algol Q92 Forth?
(A) Basic (b) Turing (c) Java
Of these three choices, (B) Turing is not a programming language. Turing was a mathematician that defined the rules for a "complete" computer/programming language/etc. His contributions to computer programming included the definition for a "complete" language (one that could possibly simulate any real-world condition/environment/etc, irrespective of being able to run in real-time, just being able to calculate the state thereof), and defining two "comparable" machines, such that one machine can simulate another machine, and the second machine can also simulate the first. BASIC and Java are both programming languages.
Write a program that accepts two numbers a and b and checks whether or not a is divisible by b?
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main (void) {
char arry[100];
int i,count=0;
float a,b;
printf("Enter a 2 Number ");
scanf("%d %d",&a,&b);
if(a%b == 0){printf("its divisible");} else {printf("its not divisible"); }
getch();
return 1;
}
What does Lisp mean in computer language?
LISP programming refers to creating applications using LISP languages - a family of old high level programming languages that used Polish notation. LISP languages are the second oldest HLLs after FORTRAN.
What does modular program and non-modualr program mean?
Modular programming is the technique which divides the entire program into smaller modules, which perform a specific task. Even though the simple program structure works well for simple examples, it is counter-productive for longer programs, leading to lack of clarity and slowing code maintenance and modification.
The programmer designs the program in levels, where a level consists of one or more modules. The first level is a complete main program and modules at successive levels consist of sub modules referenced in the prior levels.
A module is a set of program statements which, when acting together complete a specific task. In practice a module can be a function and the main program can consist of a sequence of calls to the functions that represent the modules of the next levels down.
The order in which the modules are executed by the computer is controlled by the main program. This describes fully the procedures required in the solution to a problem. The procedures are written in the order of the machine execution.
Modules should be structured within themselves by incorporating the constructs of sequencing, selection and repetition. Every program can and should be written using only these constructs.
SAP is Simple As Possible Computer. The type of computer is specially designed for the academic purpose and nothing has to do with the commercial use. The architecture is 8 bits and comprises of 16 X 8 memory i.e. 16 memory location with 8 bits in each location, therefore, need 4 address lines which either comes from the PC (Program Counter whish may be called instruction pointer) during computer run phase or may comes from the 4 address switches during the program phase. All intructions (5 only) stores in this memory. It means SAP cann't store program having more than 16 instructions.
SAP can only perform addition and subtraction and no logical operation. These arithematic operation are performed by an adder/subtractor unit.
There is one general purpose register (B register) used to hold one operand of the arithmatic operation while another is kept by the accumulator register of the SAP-1.
In addition there are 8 LEDs, work as output unit and connected with the 8 bit output register.
All timely moment of data or activities are performed by the controller/sequencer part of the SAP-1.
Further details can be found in the Malvino Brown book, Computer design fundamentals-or may confirm the name of the book.
SAP 11) Program counter
2) Input MAR
3) The RAM
4) Instruction Register
5) Controller Sequencer
6) Accumulator
7) The Adder-subtrector
8) B Register
9) Output Register
10) Binary Display
That tells the rest of computer system how to carry out a programs instructions?
the answer is the CPU ( central processing unit). if you open up a file the CPU retrieves the files from the hard drive and are temporarily sent to the RAM (random access memory) until you close it. the same process apply's for programs.
How many computers were made in 2009?
The answer to this is based on your definition of the word "computer". At it's most simple form - a thermometer can be considered a "computer", as it is a machine that is "programmable" to follow a set of instructions and display output data. A sundial or compass are probably other great examples of simple computers. So I am thinking possibly billions of types of computers. Maybe hundreds per household.
Pointer is a variable holding a memory address?
pointer is a derived datatype which contains memory addresses as their values.
program:-
#include<stdio.h>
#include<conio.h>
void main()
{
int m=5,*p;
clrscr();
p=&m;
printf("address of variable m is %p",(void *)p);
}
No, it is a letter.
Had you asked: 'Is C language a single-pass compiler',the answer would be: 'No, it isn't a compiler, it is a programming language'.
Is a linked list a physical data structure?
Physical data structures are how data is organized on a hardware storage device, and therefore how they appear to the computer. Logical or virtual data structures are software-based objects, and how the user or program sees it.
Although many file systems use a type of linked list format for storing information, a linked list is used for both hardware and software purposes, and therefore it cannot fall under either the physical or virtual data structure classification.
What software do you need to make a website?
You do not need software to make a website, though it does come in handy if you don't want to learn HTML/XHTML, JavaScript, and CSS. You can learn these three main languages, but it will take time and practice to make a good website. There are many websites out there that let you create a free "website" under a subdomain, such as mycoolsite.wordpress.com. Do a web search for "free website" and you'll find plenty of websites to try. Many of these offer paid upgrades such as you own domain (mycoolsite.com) or more advanced layouts.
What is the difference between Light-weight process and heavyweight process?
Light weight process are the process are the processes which is considered for the os as less burden like thread.means the threads are executing inside a process which share the same code and data also memory space of a single process that's it has a less burden to the os and considered as a light weight process.also the communication between the threads are much more efficient.
where as in case of a heavy weight process for doing multiple task the os has to create multiple processes which have a multiple memory address space and for communication between them they have to use inter process communication using sockets and pipe and which has more burden on the os than the threads(ligt weight processes) and hence considered as a heavy weight process