answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

Difference Between interpreter and compiler in java application?

Due to platform independence, a Java compiler will interpret Java source code into Java Byte Code and pass to the JVM, which will pass machine understandable code through to cpu. (clarification needed).A conventional compiler converts source code directly to machine code.(clarification needed).

What are the purpose of data type integer?

An integral data type is a fundamental scalar object in the host's architecture, usually 1, 2, 4, or 8 bytes in size. It represents a binary value, a series of bits, that represent integers with various ranges. It can be signed, allowing positive and negative values, or it can be unsigned, allowing only positive values. In most (or all ??) modern computers, the signed format is what we call two's-complement notation. In two's-complement notation, hardware binary adders generate the same bit pattern no matter what your signed/unsigned convention is - the only difference is in how you interpret the result, and in the meaning of the carry and overflow flag(s). Selection of signedness and size depends on what you need to do. Unsigned Ranges by Number of Bytes: 1: 0 to 255

2: 0 to 65,535

4: 0 to 4,294,967,295

8: 0 to 18,446,744,073,709,551,615 Signed Ranges by Number of Bytes: 1: -128 to +127

2: -32,768 to +32,767

4: -2,147,483,648 to +2,147,483,647

8: -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

How do you write the code by python?

it depends what type of program you wish to write. python is a very simple programing langauge therefore it doesnt have much room to play with. i mainly use it to work out simple math problems, or use it to calculate thing for games i play,

Ex.) This is a program i wrote to work out the Pythagorean therom to find side "C":

a = input("Enter Corner Side A\n ")

b = input("Enter Corner Side B\n ")

c = a*a+b*b

import math

print math.sqrt(c)

raw_input("Press <enter> To Leave Program")

input mean that's where you enter your variable, raw input is what you put at the end so it doesnt just run away (NOTE*** THIS IS A PYTHON 2.6.5 SCRIPT, IT WILL NOT WORK ON OTHER VERSIONS OF PYTHON"

notice i put ("Press <enter> To Leave Program") this is what it will say before it "runs away". i suggest watching some youtube videos on how to write programs for your version of python. also try using the manual that comes with your version of python. it helps greatly.

What is the function of scanner in the microscope?

Document Scanners have a glass plate and a cover. There is also a lamp used to illuminate the document. The scanner moves a mirror, reflecting the light across the document. The light is picked up by a simple CCD camera chip and digitizes the data line by line, like a slow scan TV.

----------------------------------------------------------------------------------------------

Scanners have become an important part of the home office over the last few years. Scanner technology is everywhere and used in many ways:

  • Flatbed scanners, also called desktop scanners, are the most versatile and commonly used scanners. In fact, this article will focus on the technology as it relates to flatbed scanners.
  • Sheet-fed scanners are similar to flatbed scanners except the document is moved and the scan head is immobile. A sheet-fed scanner looks a lot like a small portable printer.
  • Handheld scanners use the same basic technology as a flatbed scanner, but rely on the user to move them instead of a motorized belt. This type of scanner typically does not provide good image quality. However, it can be useful for quickly capturing text.
  • Drum scanners are used by the publishing industry to capture incredibly detailed images. They use a technology called a photomultiplier tube (PMT). In PMT, the document to be scanned is mounted on a glass cylinder. At the center of the cylinder is a sensor that splits light bounced from the document into three beams. Each beam is sent through a color filter into a photomultiplier tube where the light is changed into an electrical signal.

The basic principle of a scanner is to analyze an image and process it in some way. Image and text capture (optical character recognition or OCR) allow you to save information to a file on your computer. You can then alter or enhance the image, print it out or use it on your web page.

----------------------------------------------------------------------------------------------

A scanner is used to scan in printed photographs and other documents so they

can be put into documents or web pages. It uses a light source,

typically a cold cathode lamp to illuminate the scanned imaged. The

light is then reflected off the object and into Charged Coupled Device

(CCD). The Charged Coupled Device collects the information, and through

a series of electronic devices converts the analog signal into a series

of digital signals which can then be read and processed by the internal

electronics of the scanner and subsequently a computer.

----------------------------------------------------------------------------------------------

What is bigger a MB or a KB?

Kg stands for "kilogram" which is a measure of physical mass, where as MB stands for Megabyte, which is a measurement of data. However, there is a measurement of data known as a kilobyte, which is abbreviated "kb". One Megabyte contains 1,000 Kilobytes.

Explain the working of two pass assembler with an example Draw the flowchart of two pass assembler also?

Pass One: Read the source code and build the symbol table. Pass Two: Read the source code again and generate the object code. Both passes do pretty much the same things; parsing, tokenizing, processing expressions, etc. The difference is that in pass one you do not know "a priori" what the type, offset, and size of objects are that you have not yet encountered, so you must do the assembly in two passes. You can assemble in one pass if you constrain the coder to define symbols before they are referenced.

What do you compile?

Compiling is the act of translating human-readable source code to machine-readable byte code.

In Java, the compiler program is javac

What translators convert high-level language on statement-by-statement basis?

Machine level instructions can be converted to readable assembly language using a disassembler. If the machine instructions originated from a higher level language, there may also be a decompiler to create something resembling the original high level language version of the program.

Why are the array and linked list used as stack queue and others?

Arrays are beneficial whenever you need constant-time, random-access to any element within a set of data and the number of elements doesn't change too much (enlarging an array may require the entire array be copied to a larger block of free memory, which is expensive in terms of performance). Linked lists are beneficial when the number of elements is highly variable and you also need constant time access to the head (as per a stack) or both the head and tail (as per a queue). Neither a queue nor a stack requires any traversal whatsoever, so the lack of random access is immaterial. If a set of data is variable and must remain in sorted order (such as a priority queue), then a heap or self-balancing binary tree is the most efficient structure to use.

Why there is a need for converting high level language into machine level language............ why cant we use high level language directly in computers?

Machine code is the native language of the machine. The machine does not "understand" any language other than its own native language. As such, all other languages, including low level assembly languages, must be compiled or interpreted in order to produce the required machine code.

How do you write your own programming language from scratch?

Writing your own programming language is an incredibly ambitious, and almost unachievable, goal. You won't be able to do this on your own unless you are a hardworking genius. Writing a programming language entails making a way for the average individual to communicate with electronic equipment. To make a language you need a working knowledge of the electronics you are making the language for - either a CPU or a smaller chip.

When you understand how all the 1s and 0s (off and on, respectively) work, then you can combine them to create definitions for different programming words (i.e. Add, Subtract, If/Then, etc.).

An alternative is to base your programming language off another programming language. In other words, if you would like to simplify a language like C then you would need a working knowledge of that language. From that knowledge, you can create definitions which can be used to invoke C code.

There are programs to create compilers -- YACC is the most well known of them (use google for details).

What are arrays?

  • Array data structure, an arrangement of items at equally spaced addresses in computer memory
  • Array data type, used in a programming language to specify a variable that can be indexed
  • Associative array, an abstract data structure model that generalizes arrays to arbitrary indices

or various kinds of the above, such as

  • Bit array or bit vector
  • Dynamic array, allocated at run time
  • Parallel array of records, with each field stored as a separate array
  • Sparse array, with most elements omitted, to store a sparse matrix
  • Variable-length array
  • Ragged (jagged) array, where the rows have different lengths individually

or various related concepts:

  • Array processor, a computer to process arrays of data (not to be confused with a processor array)
  • Array programming, using matrix algebra notation in programs (not the same as array processing)
  • Array slicing, the extraction of sub-arrays of an array
  • APL (programming language)

or also:

  • Video Graphics Array (VGA), a display adapter and video format, and many variants thereof (EVGA, FWVGA, QVGA, QXGA, SVGA, SXGA, SXGA+, TXGA, UVGA, XGA, XGA+, ...)

What are diskettes?

A diskette is a removable storage device that is used in a floppy disk drive. It contains a plastic rotating disk, it is inside a shell. There were 2 main varieties, the 5.25 inch floppy and the 3.5 inch floppy. The 5.25" diskette truly was floppy. The disk is soft and inside a flexible shell, and you had to take care to never bend it. The 3.25" floppy was actually hard. The platter was more rigid and it was in a hard plastic shell.

What is the difference between a constant and a variable in java programming language?

A constant in Java is defined using the "final" modifier. For instance:

final double Density_Of_Water = 1.000;

would set Density_Of_Water to 1.000. This value can not be modified throughout the program because "final" told the compiler that this value would not change. A variable however, can be changed by the user throughout the program.

What is the expansion of conio.h?

EXPANSION OF CONIO.H

Conio.h library in C implies a console version which encapsulates the common I/O functions.

Console input/output header

Why is pseudocode useful?

Programmers use pseudo-code to debug programs. Pseudo-code lays out the basic coding for the program before putting it into any specific programming language. That way, a programmer can be sure that all the necessary components are included, and that the program will run as expected.

How many numbers can be stored in a 4-byte integer system?

If all four bytes are being used for its value (i.e. this is an unsigned integer) then you have 8 * 4 = 32 bits, so your range is from 0 to 2^32 (4,294,967,296)

Remember, the size of various data types in C and C++ is architecture dependent. See limits.h (/usr/include/limits.h in Linux)

What is a Linker used for in computer programming?

Linking is the process of combining various pieces of code and data together to form a single executable that can be loaded in memory. Linking can be done at compile time, at load time (by loaders) and also at run time (by application programs)

The average the sum of the elements divided by the number of elements?

Yes,

average is the sum of elements divided by the number of elements

Exp:- x1=10,

x2=20,

x3=30,

x4=10.

then the average is 10+20+30+10

------------------

4

=> 17.5

Average = sum of total of element

----------------------------------

no. of elements

Tools used in studying Systems Analysis and Design?

System analysis and design processes do not normally involve the use of any programming language at all, but UML is frequently used as an abstract (graphical) language in the design process.

Is it necessary to initialize accumulator variables?

If it isn't, then you don't know for sure what value it will start at in some languages. Thus, your count will be wildly inaccurate. In other languages, it will just generate an error if you forget to initialize.

Two steps:

1. It is critical that variables be properly initialized.

2. Counter-variables are variables.

How many values can a method return in Java?

A method in java can declare only one return value and type at a time. For ex: a single method cannot have a code that returns a string in some cases and an integer in other cases. Java compiler does not let you do that. You can only have one return type for every method in java.

What is the format specifier use with the data type double in c language?

double would be %e, %f or %g (depending on the format you want), long int would be %ld or %lu (signed or unsigned), long double would be %Le, %Lf or %Lg.