answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is far and near pointer and how are they used?

It is a matter of the memory model you are using. On old or embedded systems, some memory was outside of the range of a normal pointer. If you have 4 megs of ram you need at least a 22bit pointer to see all of it. But let's say you only have a 16 bit pointer. This means you can only access the first 65K of ram. Odd as it may sound, this was a problem on old computers, and is sometimes an issue on embedded devices with limited processing power. The near and far classifications were a solution. Pointers are near by default. In my example above, the 65K of ram would be accessed with a near pointer. To get past that 16 bit limit, you need a far pointer. Thus: memory within the pointer's range is near. Memory outside of the range is far. Near pointer: char near * ptr; Far pointer: char far * ptr;
A far pointer uses both the segment and the offset address to point to a location in memory. A near pointer in contrast uses only the offset address and the default segment. The far pointer can point to any location in memory, whereas the near pointer can only point to a nearby local address.
Something that was important 20 years ago. Now you can forget it.

How many operators are there in C Language?

There are several operators in the C programming language, which are used to perform various operations on variables and values.

Here is a list of some of the most commonly used operators in C:

Arithmetic operators: +, -, *, /, % (addition, subtraction, multiplication, division, modulus)

Assignment operators: =, +=, -=, *=, /=, %=, &=, |=, ^=, =

Comparison operators: ==, !=, , = (equal to, not equal to, less than, greater than, less than or equal to, greater than or equal to)

Logical operators: && (AND), || (OR), ! (NOT)

Bitwise operators: &, |, ^ (AND, OR, XOR)

Increment and decrement operators: ++ (increment), -- (decrement)

Conditional operator: ?: (ternary operator)

It's important to note that there may be some additional operators depending on the specific C compiler or implementation being used.

When using a cause-oriented approach to receive acquisition problems it is important to .?

When using a cause-oriented approach to resolve acquisition problems, it is important to

Why is assembly level language non portable?

Because machine language itself varies across systems. For example, machinecode for a x86 is totally different from machinecode for a PowerPC. This is why we need compilers and assemblers, so that the same higher level code can be translated into lower level code for various architectures.

Explain how memory is represented in a linked list data structure?

Type your answer here...  Let lists be a linked. Then list will be maintained in memory unless otherwise specified or implied as follows. First of all list required two liner array we will call them here INFO and LINK such that INFO[K] and LINK[K] contain, respectively, the information part and the next pointer filed of a node of list.

 As noted above list also required a variable name such as start which will contain the location of the beginning of the lists and the next pointer sentinel denoted as null which indicates the end of the lists

 Since the subscripts of the array INFO and LINK will usually be positive, we will chose null otherwise started.

Which produces faster program execution a compiler or pure interpreter?

A compiled program would execute faster than an interpreter running the same code step by step.

Why return type is not considered while overloading a function?

YES only if: The return type in the child class is a sub-type of the return type of the parent class.

Ex:

public int getName() {} - Parent class method

public String getName() {} - Child class method

If we implement the above two methods in the class hierarchy we will get compilation errors. whereas if we try the below implementation it will work:

public Object getName() {} - Parent class method

public String getName() {} - Child class method

This is because String is a sub-type of Object and hence it works.

This is also called as Covariant Overriding.

Note: This feature is available only from Java 1.5. Earlier versions of Java expect overriding methods to have exactly the same return type as the super class method.

What ia a prototype?

A prototype is a working example of what something will be e.g. a car or a computer system. It is designed to demonstrate to funding sources or company managers how a project to develop new products will look.

10 situations that can be represented by means of graph?

Financial history

Score history

Statistical analysis

data set averages

data set trends

time value of money

usage statistics

performance statistics

personal achievement trends

grade history and analysis

What are the ranges of basic datatype of C' programming languages?

Basic built-in data types in the C programming language are scalar types in variations of char, int and float:

char, unsigned char, signed char

int, signed int, unsigned int, short, signed and unsigned short, long, signed and unsigned long

float, double

Named enumerations are supported. These are weakly typed constant literals of type int. Bitfields are supported as range-limited signed or unsigned integers. Neither qualify as a type in their own right.

Some dialects also support additional types, such as wide character, extra large integers or floating point scalars.

The language also knows a related keyword void, which is used to express the fact that the related item has no known or no specific type. void in itself is not a type (it is rather the absence of a type).

The C programming language also supports three basic aggregates: structure, union and arrays.

Pointers can reference any of the scalar built-ins, enumerations, structures, unions, arrays, and the infamous void. Pointers are viewed as a data type by many.

Other members of the C family of languages also support class and interface types and strongly typed enumerations.

Where are boolean operators used?

Boolean operators are used in programming. It would be hard for me to explain exactly how they are used in programming without giving you a programming course, but I can tell you basically what they do. The main boolean operators are AND, OR, NOT, and XOR (exclusive or). So: * (true AND true) makes true * (true AND false) makes false * (false AND true) makes false * (false AND false) makes false * (true OR true) makes true * (true OR false) makes true * (false OR true) makes true * (false OR false) makes false * (NOT true) make false * (NOT false) makes true XOR is the same as OR except that it only allows one or the other to be true; not both: * '''(true XOR true) makes false''' * (true OR false) makes true * (false OR true) makes true * (false OR false) makes false Boolean operators can be mixed together like this: NOT (true XOR (false AND true)) makes false In programming, you often use symbols to represent these instead of writing out the words. OR is , not is !, and AND is &&. -DJ Craig They are often used by search engines. If you put in "Bob" AND "Smith" you would get results that have both Bob and Smith in them (say 150 results). If you put in "Bob" OR "Smith" you would get any result with Bob or Smith (say 3000 results). If you put in "Bob" NOT "Smith" you would get Bob Jones, but not Bob Smith. Not all search engines use these. And some use other terms for them.

How does Internet evolve?

The Advanced Research Projects Agency Network (ARPANET) developed by ARPA of the U.S. Department of Defense was the world's first operational packet switching network, and the progenitor of the global Internet. During the 1950s, several communications researchers realized that there was a need to allow general communication between users of various computers and communications networks. This led to research into decentralized networks, queuing theory, and packet switching. The subsequent creation of ARPANET in the United States in turn catalyzed a wave of technical developments that made it the basis for the development of the Internet. The first TCP/IP wide area network was operational in 1984 when the United States' National Science Foundation (NSF) constructed a university network backbone that would later become the NSFNet. It was then followed by the opening of the network to commercial interests in 1995. Important separate networks that have successfully entered the Internet include Usenet, Bitnet and the various commercial and educational X.25 networks such as Compuserve and JANET. The collective network gained a public face in the 1990s. In August 1991 CERN in Switzerland publicized the new World Wide Web project, two years after Tim Berners-Lee had begun creating HTML, HTTP and the first few web pages at CERN in Switzerland. In 1993 the Mosaic web browser version 1.0 was released, and by late 1994 there was growing public interest in the previously academic/technical Internet. By 1996 the word "Internet" was common public currency, but it referred almost entirely to the World Wide Web. Meanwhile, over the course of the decade, the Internet successfully accommodated the majority of previously existing public computer networks (although some networks such as FidoNet have remained separate). This growth is often attributed to the lack of central administration, which allows organic growth of the network, as well as the non-proprietary nature of the Internet protocols, which encourages vendor interoperability and prevents any one company from exerting too much control over the network. The IEEE has assigned the 802.1 label to the internetworking among 802 LANs, MANs and other wide area networks, now known as the Internet.

How is the C programming language not object-oriented?

A "pure object oriented language" is one where every thing in it is treated on a consistent basis as on object, including elementary data types such as an integer. Since C++ treats elementary objects differently than classes, it does not meet the formal definition as a "pure ...".

How much does an engineer get paid a year?

It depends what type of engineer you are. If you are a mechanical engineer and if u have experience u make around $80,000-100,000 per year.Eletrical engineers make about the same with experience. Civial engineers with experience and what type of mission their doing ,like if their making a okay sized buliding they could make around $160,000. But it depends about how much experience they have and wat type of mission their dealing with and also if their going to make a huge skyscraper like the cn tower or even bigger skyscrapers like the burj khalifa[the tallest building in the world] they could even go as high as making $100,000,000.

A source program is the program written in which language?

It is programming that is licensed in such a way that it provides the source code for everyone to view and suggest changes to, and is usually at no cost or a very lost cost to anyone that wants the program and its source code.

Can we use same compiler for both c and c plus plus language?

Yes. In fact both the C++ compiler and the linker are intrinsically command-driven; the IDE (if you have one) simply provides a graphical front-end to both. Consult your compiler/linker documentation to view the required command line syntax. In particular, consult the 'makefile' topic which should show you how to create a command file (or batch file) that can automate the entire process for a particular project.

How do you write a program to find the reverse of a given number in COBOL?

Identification Division.
Program-id. Example1.
Data Division.
Working-storage Section.
01 Num1 Pic 999 Value Zeros.
01 Num2 Pic 9 Value Zeros.
01 Num3 Pic 99 Value 10.
01 Result Pic 999 Value Zeros.
01 Temp Pic 99.
Procedure Division.
Calculator.
Display "enter First Number :".
Accept Num1.
Perform Until Num1 = 0
Divide Num1 By Num3 Giving Temp Remainder Num2
Compute Result =(result * Num3) + Num2
Compute Num1 = Num1 / Num3
End-perform
Display "result Is=", Result.
Stop Run.

What is the difference between uninitialized pointer and null pointer in c language?

A null pointer is a pointer that has been initialised with the NULL value (zero). An uninitialised pointer is one that has not be initialised to any value and will in fact store whatever value happened to reside in the pointer's own memory address at the point of instantiation. Uninitialised pointers are a clear sign of bad programming because the only safe way to determine if a pointer is valid or not is to compare its value with NULL. An uninitialised pointer will almost always be non-NULL, which means you run the risk of accessing memory that either does not belong to you, or is otherwise invalid. Most compilers include a debug switch to warn you when you attempt to access any uninitialised variable, which naturally includes pointer variables. This switch must be on at all times.


Whenever you instantiate a pointer, always initialise it straight away, either by nullifying it, or by storing a valid memory address in it. When you are finished with the pointer, it's good practice to nullify it immediately, even if the pointer would subsequently fall from scope. If the pointer is to be immediately re-assigned, there is no need to nullify it (but it's good practice nonetheless). If you follow this practice at all times, you can be assured that any non-NULL pointer will always be pointing at something valid (and if it isn't, then you have some serious problems elsewhere in your code).


As a rule of thumb, if you can use a reference rather than a pointer, use a reference. They are much easier to work with. Pointers should only be used if there's any possibility (however remote) that a reference could be NULL, because a NULL reference will completely invalidate your program (pointers can be NULL, but references can never be NULL). This is why functions such as malloc() and calloc(), and the C++ new operator all return pointers rather than references. You can only return a reference when an allocation is guaranteed to succeed, and a dynamic memory allocation simply cannot make that guarantee.


Need of structured programming?

That basically refers to a programming language that has support for conditional statements (if), code repetition (while, for, ...), and subroutine or function calls. Most modern language have that. The term is also sometimes used for languages that do NOT work with OOP. Actually OOP includes the structured programming concepts mentioned above, but it includes a few other things, too.

What is the code for a C program to find the largest and smallest number?

Fist of all, let's assume that by "list" you mean "array." Otherwise we would need your list implementation in order to be able to iterate through the elements.

int[] nums; // assume these are the numbers you want to search through

int nums_length; // also assume that we know how many numbers are in nums

int min; // smallest number in nums

int max; // largest number in nums

// special case for an empty list of numbers: set min = max = 0

if(nums_length == 0) {

min = 0;

max = 0;

}else {

// start min and max off as equal to the first number

min = nums[0];

max = nums[0];

// iterate through nums

int i;

for(i = 1; i < nums_length; ++i) {

// update max, if necessary

if( nums[i] > max ) {

max = nums[i];

}

// update min, if necessary

if(nums[i] < min) {

min = nums[i];

}

}

}

// min and max are now properly set (or both equal to 0 if nums is empty)

What is the if-then-else structure?

This is one of the most simple flow control mechanisms in programming. It follows very closely to the spoken-language version.

IF something is true

THEN do something

ELSE do something else

if x == 1

print "x is one!"

else

print "x is not one!"

If a cache can be made as large as the device for which it is caching for instance a cache as large as a disk why not make it that large and eliminate the device?

Though the size of a cache has increased over time, so too has the size of hard disk. An economical comparison of cache versus hard disk space in a cost per MB analsysis will show that a cache would be significantly more expensive. Furthermore, cache in general is considered "temporary" or volatile storage which means that the contents of the storage device is lost when the system is powered off. A hard disk, on the other hand, is "long term" or non-volatile storage; when the system is powered off, the hard disk still safely holds the data stored on it.

Explain the features of doubly linked list?

Well, in a singly linked list you can only move forward, if the pointer you seek is behind your current position you'll have to cross the hole list to get there. In a doubly linked list you can simply move back as well as forward....

hope this helps...

What is object in programming?

Object in context of a class is the root of the class hierarchy in Java in the java.lang package.

Every class has Object as a superclass whether it's explicit or not. All objects, including arrays, implement the methods of this class.

Is machine language a programming language?

Actual Machine level language is binary language, which contains only '0' & '1 ' and it's the extreme besic of a computer's instruction. Then comes low level language, like assembly language and so on.