answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

What is the difference between translators and compilers?

A compiler is a program that reads a program written in one language and translates it into another equivalent program in other language(target language).i.e, Hll------Mll

A translator on the other hand translates a given language into many languages as per requirement like Chinese to English and others as per capability.

Can i ignore warning messages from my compiler?

Yes, warnings can be ignored. However, it is advised that you do not ignore them, particularly in production (release) code. Treat all warnings as errors and examine each one in turn to determine which can safely be suppressed (documenting your reasoning) and which indicate any unwanted side-effects. Those with unwanted side-effects should be re-written to eliminate those side-effects and thus eliminate the warning.

What is lazy initialization?

Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper class, System.Lazy<T>, for executing the lazy initialization in your application. Lazy initialization helps you to reduce the wastage of resources and memory requirements to improve performance. It also supports thread-safety.

What is data loader in salesforce?

A data loader is software that allows for the automated import, export, and storage of Salesforce data in large volumes.

A data loader is used to import, export, and delete an unlimited amount of data for your business in a quick and secure manner.

A Salesforce data loader is a universal tool used for bulk importing and exporting of data. It provides a user-friendly UI or command line access.

A data loader can input, update, and completely delete large amounts of Salesforce records.

Which data structure is used for breadth first seach?

Breadth first search can be performed upon any tree-like structure. A binary tree is a typical example. A breadth first search begins at the root and searches the root's children, then all its grandchildren, and so on, working through one level of the tree at a time.

Can a computer program develop the initiative to execute tasks in a better way than its programmers envisioned?

To an extent, yes - and in the future, computer programs might get better at this. An interesting case is the program that beat the Go world champion (Go is a well-known Japanese board game); the program was designed to learn game strategy by playing, and seeing what works and what doesn't; and now, the original programmers have no idea HOW the program determines the best moves!

Can pseudo code be executed or compiled.give reason?

No. If it could be executed or compiled, it wouldn't be pseudocode, it would be code.

How does being an excellent writer contribute to being an excellent computer programmer?

It doesn't. A writer is a person that translates an abstract concept into a human-readable form. A programmer is a person that translates an abstract concept into a machine-readable form. Aside from typing, the skill sets are largely unrelated; so being good at one will not make you good at the other.

What is CAML in SharePoint?

Caml (originally an acronym for Categorical Abstract Machine Language) is a dialect of the ML programming language family, developed at INRIA and formerly at ENS.

How do you convert the binary value 11000001111111100000000000000000 from IEEE 754-1985 to its decimal equivalent?

To convert 11000001111111100000000000000000 from IEEE 754-1985 to its decimal equivalent, proceed as follows:

The most significant bit, bit 31, represents the sign, where 0 denotes positive and 1 denotes negative. So this number is clearly negative.

The next 8 bits, from bit 23 to bit 30, represent the exponent. Here we have the value 10000011 which is 131 decimal. However, exponents are biased by 127, thus 131 really means 131-127=3. Thus the exponent is 3. In scientific notation, the exponent tells us how many decimal places to move the decimal point and in what direction. This is no different in binary except we use a binary point instead of a decimal point. Thus an exponent of 3 tells us to move the binary point 3 positions to the right (if it were -3, we'd move three position to the left instead).

The remaining 23 bits, from bit 0 to bit 22, represent the mantissa, the fractional component. Here we have 11111100000000000000000. However, a leading 1 bit is always implied so the mantissa is really 24 bits long, with a value of 111111100000000000000000. The binary point is placed to the right of the (implied) leading digit, thus this mantissa has a binary value of 1.11111100000000000000000.

Note that the leading 1 bit can always be implied because the digit to the left of the binary point must always be non-zero and the only non-zero digit in binary is 1.

The exponent, 3, tells us to move the binary point 3 positions to the right, so we now have 1111.11100000000000000000. We can ignore the trailing zeroes so we now have a binary fraction of 1111.111.

Converting floating point binary values to decimal values is no different to converting integer values where every bit position represents some power of 2. Those to the left of the binary point represent increasing powers of 2 starting with 2^0, just as they do in integer conversions. Those to the right represent decreasing powers of 2, starting with 2^-1 (which is 0.5 in decimal). Thus, working from left to right we have:

1 x 2^3 = 8

1 x 2^2 = 4

1 x 2^1 = 2

1 x 2^0 = 1

binary point

1 x 2^-1 = 0.5

1 x 2^-2 = 0.25

1 x 2^-3 = 0.125

Adding these up we get the decimal value 15.857. However, the sign bit indicated the value was negative, so the value is -15.857.

Thus 11000001111111100000000000000000 in IEEE 754-185 represents -15.857 in decimal.

Which type of search (linear binary or hash) would you use for the following scenarios?

Explain why you would choose that type of search, ensuring that you illustrate what characteristics in the scenario limit the type of search you can perform.

1. You are looking at a departures list in an airport (which is always sorted by the city the flight is going to) and you want to find your flight to Ottawa in the list.

2.You have a record of visits to your website, organized by the visit time. You want to find when a specific person last visited your website, and are given the person's name.

3. You want to find a textbook for a specific course in a bookstore, where the store is organized by subject.

How do you draw an octagon using Logo command?

An octagon is an eight-sided pentagon where all sides are equal length and all angles are equal. To draw an octagon in Logo, you move forward the length of a side and then turn 45 degrees, repeating 8 times (8x45=360). The following will therefore draw an octagon with a side length of 100 pixels:

repeat 8 [fd 100 rt 45]

What does GroupData mean?

Rather than have frequencies of observations allocated to each observed value, grouped data allocates them to a range (or group) of values.

What is a resource compiler?

As the name suggests, a resource compiler (or RC) compiles resources. When we speak of resources in programming we are often referring to memory resources, however programs use many resource elements other than just memory (files and devices are also resources). However, a Windows application typically makes use of other resources such as strings, cursors, icons, bitmaps, dialog boxes, fonts, version information, and so on. To make use of these resource elements we need a resource-definition script (.rc file) but we typically use a resource editor to generate one for us. The RC's job is to compile the resource-definition script, the output of which can subsequently be linked with our application. The resources themselves are actually embedded in the data segment of the executable by the linker, thus making those resources immediately available to our application.

How in oops once a class is created it can be changed?

You can change a class by modifying its definition at design time, assuming you have access to the source code.

Why is John von Neumann known as the father of the stored program computer?

Computer programs were originally considered to be an integral part of the machine while the data it operated on was separate. In 1945, John von Neumann proposed a new architecture such that the program and its data could be stored together on a mass storage medium (such as a hard disk drive), to be loaded into working memory (such as RAM), as and when it was required. This is the basis of all modern computers, thus John von Neumann is now regarded as being the father of the stored program computer.

How do you write a pascal program using the case statement to display the days of the week?

Normally we would represent the days of the week using a low-level enumeration:

type

DayOfWeek (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);

In other words, Sunday is represented by the integer 0, Monday by 1, Tuesday by 2, etc. This provides with a compact method of representing the high-level concept of a day of the week and the symbolic names are sufficiently abstract to make them easy to work with. However, it would be useful to convert these low-level symbolic constants to their higher-level equivalents (the actual strings, 'Sunday', 'Monday', 'Tuesday', etc) which can then be presented to the user. It would also be useful to be able to perform the reverse conversion, from high-level string to low-level enumeration. We achieve this with conversion functions implemented as lookup tables using case statements:

function ToDayOfWeekStr (Dow : DayOfWeek) : string;

begin

case Dow of

Sunday: ToDayOfWeekStr := 'Sunday';

Monday: ToDayOfWeekStr := 'Monday';

Tuesday: ToDayOfWeekStr := 'Tuesday';

Wednesday: ToDayOfWeekStr := 'Wednesday';

Thursday: ToDayOfWeekStr := 'Thursday';

Friday: ToDayOfWeekStr := 'Friday';

Saturday: ToDayOfWeekStr := 'Saturday';

end

end

function ToDayOfWeekEnum (Dow : string) : DayOfWeek;

begin

case Dow of

'Sunday': ToDayOfWeekEnum := Sunday;

'Monday': ToDayOfWeekEnum := Monday;

'Tuesday': ToDayOfWeekEnum := Tuesday;

'Wednesday': ToDayOfWeekEnum := Wednesday;

'Thursday': ToDayOfWeekEnum := Thursday;

'Friday': ToDayOfWeekEnum := Friday;

'Saturday': ToDayOfWeekEnum := Saturday;

else {handle input errors here};

end

end

How do you explain the computing environment in c language?

It is not possible to explain the computing environment in terms of a high-level programming language because the language is independent of the machine; it is the machine that defines the computing environment not the language. With high-level languages like C, the exact same source code can be compiled on any machine regardless of its computing environment. Note that the language itself is merely an abstraction; it allows us to express computations in a machine-independent manner.

The implementation of the language is actually defined by the language compiler. Each machine type requires its own independent implementation, although a single compiler implementation can cater for a family of processors sharing a common architecture (such as 32-bit and 64-bit variations of the same architecture). The C language standard defines how computations should be expressed in the language itself, but it is the compiler's job to interpret these expressions such that every machine performs the computations as efficiently as the hardware will allow and produces consistent results regardless of the computing environment.

What is the difference between inheritance relationship and client-server relationship in programming?

These two concepts are not even remotely related, so listing the differences would be pointless. Far easier to simply explain what they are.

The client-server model is typically used in networking where one computer acts as the server and all computers that connect to it are known as the clients. The server does all the actual work, serving information to the clients and collecting information from the clients. The software is therefore divided into two major components known as the server and the client.

Inheritance is typically found in object-oriented programming, where one class of object derives from another class of object known as a base class.

What is Nil value?

Several programming languages use a pointer value of Nil to indicate that the pointer does not point to anything.

While the internal coding for Nil is usually not relevant to the programmer, it is typically the number 0 (but any value that would not be a valid memory address for storing such data structures at could be used).

How is the default constructor equivalent to a constructor having default arguments?

Any constructor that can be invoked without explicitly passing any arguments is a default constructor. Note that there can be only one default constructor so there can only be one constructor where all arguments have default values or one constructor that has no arguments, but not both. A constructor where all arguments have default values is a useful means of combining two or more constructors into a single default constructor, thus reducing verbosity and code duplication.

What was the problem with keeping data and methods separate?

There is no problem with keeping data and methods separate. Encapsulating data with the methods that operate upon the data doesn't actually resolve anything, it merely helps us to express the relationship between the data and the methods in code. But we still require methods that are completely separate from the data. For example, a function that operates upon two different data types cannot be a member of both data types, it has to be separate from at least one of them.

The problem to which you allude is not the fact that data and methods are separate but the fact that the data itself is publicly accessible and can be modified by any function regardless of whether the function is a member of the type or not. The compiler cannot help us because user-defined types are user-defined; it has no knowledge of which operations are valid and which are not.

Encapsulation not only introduces the concept of member functions it also introduces the concepts of private, protected and public access, as well as the concept of friend functions. These concepts do not exist at the machine level, they only exist at the programming level and are simply an extension to the procedural programming paradigm. Behind the scenes, the data is still public and the functions are still separate; calling a member function is merely syntactic sugar-coating for an ordinary procedure call.

Encapsulation essentially allows us to inform the compiler as to which functions may gain access to which data. This helps to eliminate many potential errors at compile time, but also reduces the amount of code we need to write by eliminating runtime checks that would otherwise impact upon performance. In short, the more the compiler knows about our user-defined types, the more it can help us to eliminate errors in our code, and encapsulation is just one of the tools we use to provide that information to the compiler.

Where did Yasumasa Kanada do his calculations?

Japanese mathematician Yasumasa Kanada, who computed trillions of digits for pi, is an IT professor at the University of Tokyo.