answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is lexicographic order?

Lexicographic order is an order function - a way of sorting information. It is generally a simple and useful way to sort strings. The name comes from the order used in a dictionary, where strings are compared in alphabetical order, from left to right. For more information, see the related link.

What is the best game making program?

If you know how to use it, GAME MAKER


If not, Sploder's pretty good

How do you report hackers?

You don't. Hackers are people who like to experiment with computers and systems.

It would be like reporting an electrician, because he wanted to see if he could make a grilled cheese with a soldering iron.

Crackers on the other hand are people who like to crack into systems for gain.

You can report "Crackers" to the FBI if you have solid evidence.

Don't contact the FBI if your system is acting weird, and you can't explain it.

You need to know what you are doing before you report anyone.

How do we tuple initialize a class or structure?

Consider the following structure:

struct X {

int a;

double b;

// ...

};

Here we could initialise with a std::tuple<int, double>. To achieve this we simply define a constructor that accepts the required tuple:

#include<tuple>

struct X {

int a;

double b;

X::X (std::tuple<int, double>& t): a {std::get<0>(t)}, b {std::get<1>(t)} {}

// ...

};

Note that any constructor that has one argument is known as a conversion constructor, in this case converting from tuple to X. It is usually a good idea to declare such constructors explicit, particularly if you also provide the complementary conversion operator (from X to tuple).

#include<tuple>

struct X {

int a;

double b;

explicit X::X (const std::tuple<int, double>& t): a {std::get<0>(t)}, b {std::get<1>(t)} {} operator std::tuple<int, double> (void) const {return std::make_tuple (a, b);}

// ...

};

A stack can be implemented as?

One way to implement a stack is with a singly-linked list. The head pointer always points to the "top of the stack", and each element points to the next. Since you rarely, if ever, are interested in more than the top of the stack, this is one way, although not the most efficient way, to implement a dynamic stack.

Since a stack is an abstraction, the best way to do this is to use a C++ abstract class or JAVA interface, as that would allow you to fine tune the implementation without having to think about the utilization. Since since the category did not specify C++ or JAVA, however, that ends that discussion.

Shell program to find the sum of cube of individual digits of a number?

Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.

What is nesting loop?

Nested loop, you mean; one loop in the other loop, eg:

for (i=0; i<10; ++i) {

for (j=0; j<i; ++j) {

printf ("i=%d, j=%d\n", i, j);

}

}

Can you give the explanation for various operations in a queue implementation using arrays?

The following are operations performed by queue in data structures

  • Enqueue (Add operation)
  • Dequeue (Remove operation)
  • Initialize

What is the code that asks you if you want to close the program and if you say no then it closes the main window in Liberty Basic?

Code that contains a logic error does the opposite of what is expected. Therefore the answer to the question must be bad code.

What is the difference between a function and not a function?

The word non-function can mean practically anything, a variable, for example.

int fun (int x) { return x+10; }

int nonfun= 32;

Does SGID allow users to execute a binary compiled program?

Not, the execute bit does that.

00100 - execute for user

00010 - execute for group

00001 - execute for others

04000 - set-uid

02000 - set-gid

How do you initialize each element of a two-dimensional array alpha to 5?

Two-dimensional arrays are typically iterated through using nested for loops. If you had a 2-D array alpha with ints ROWS and COLS representing the number of rows and columns respectively, and ints row and col as iterators, the loop would look like this:

for (row = 0; row < ROWS; row++){

for (col = 0; col < COLS; col++{

alpha[row][col] = 5;

}

}

Translated computer program is known as?

The correct answer would depend on what a computer program is translated into and what is used to perform the translation.

A compiler scans all the instructions in a computer program to see if the program conforms to the rules of the programming language and then translates it following a set of rules for how to translate it and into what. The result of a compilation is something closer to the what the computer hardware can process.

If the compiler results can be directly loaded into memory and processed by the computer processor, it is called an executable. If the compilation results in machine language instructions but it still needs to be combined with other programs, it is called an object (or object code). Once it is combined (linked) with the other programs, it can then be called an executable.

Compiling can also result in a more compact version of the original program although it is not the language of the computer hardware. For example:

  • Compiling an IBM i (AS/400) program results in IRP(Intermediate Representation of Program). IRP is converted to actual machine code by the system when it is loaded for execution.
  • Microsoft .NET programs are compiled into CIL (Common Intermediate Language) which eventually is converted to machine code by the .NET jit (just in time) compiler at execution time.
  • A Java programs is compiled into Byte Code which is processed by an interpreter called the JVM (Java Virtual Machine).

There are situations when we need to use a program written in a computer language but the computer does not have a compiler to translate that language. Translators may be available to convert the program to a language that is available on that computer. That language would often be C or Java. After using a language translator, the resulting program can be compiled and run.

Which programming language is compiler type and which is interpreter type?

Although most languages are either compiled or interpreted, there's actually nothing to prevent you interpreting a language that is normally compiled, or compiling a language that is normally interpreted. BASIC, for instance, is traditionally an interpreted language, however modern implementations use compilation. Moreover, Java is typical of many modern languages that natively use both techniques by default, compiling the high-level source code into an intermediate byte code which is than interpreted to produce the machine code. But, with a suitable compiler implementation, it is possible to produce native machine code programs from Java source code.

When we speak of compiled or interpreted languages we're usually referring to the language's standard, if it has one. C and C++ are standardised and both are compiled, but there's nothing to prevent them from being interpreted. BASIC, on the other hand, is non-standard because it has such a wide-variety of variants, some of which are interpreted, some of which compile to byte code (which is then interpreted) and some of which compile to native machine code. Non-standard languages are generally non-portable therefore you have to look at the specific implementation to determine if it is compiled, interpreted, or both compiled and interpreted.

Disadvantages of oop?

On giving a practical example to show the difference between saying and real world working.in designing a car model using oop use classes and inheritance but this is not the same as desire.problem will arise when modues increases and line of code shoot up as in the case of Mercedes-Benz S-class car with 50 controllers, 600,000 lines of code, hundreds of bus messages, thousands of signals, and three networks.

An other issue Aries during athis talk be iterface for all different subsystems which is not possible to same location as assumed by OOP .Different sunsystems use different approaches and methods to deal with problem and they are inheriently built for this .If desire to have same interface changes must br done at subsystm level this will loss their imprtance.

Instead of diving class and making inheritance industry use different approach they divide subsystems ansd made a small team for each subsystem. There is a need for talented systems

engineers to specify and integrate the subsystems, but there is no overall grand software design where OOP might help.