answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Why must high level languages be translated?

High level languages cant be understood by the computer as it performs all tasks in binary form. So its necessary to convert high level language into machine oriented language

How do you convert a while loop to do-while loop?

A for loop is classified as an iteration statement. A simple example might be...

For x = 1 To 10

'loop body

Next x

The same loop expressed as a while loop (classified as a control flow statement) could be...

x = 0

Do While x < 11

'loop body

x = x + 1

Loop

.

What are the drawbacks of computers?

Computers are wonderfully efficient when they are working properly, but they are very complicated and have endlessly many different ways of breaking down, and when they do break down they are often very difficult to fix. Compare record keeping with a computer or with a pen and a piece of paper. The computer records can be much more easily updated and edited than paper records can be, but the paper will never crash, even if there is a power failure.

What is a USB device?

The abbreviation is of Universal Serial Bus, which refers to the way the device corresponds with a computer in order to deliver or exchange files.

The physical link is a small 4-pole connector, but there is of course a goodly amount of controlling electronics with it.

There there are very many USB devices, of which the small portable memory "stick" is perhaps the simplest. Digital cameras also use USB connections to allow you to transfer images from them to computers.

Differentiate between static allocation and dynamic allocation?

BS Anwer- static allocation is when something is moved to a location permanantally and dynamic allocation is when something is moved temporarily, but will move again.

What is conditional expression operator?

The conditional operator (? :) is a ternary operator (it takes three operands). The conditional operator works as follows:

  • The first operand is implicitly converted to bool. It is evaluated and all side effects are completed before continuing.
  • If the first operand evaluates to true (1), the second operand is evaluated.
  • If the first operand evaluates to false (0), the third operand is evaluated.
The result of the conditional operator is the result of whichever operand is evaluated - the second or the third. Only one of the last two operands is evaluated in a conditional expression.

What are the applications of avl tree?

Binary Search Tree and AVL Tree are dictionary data structures. They are used for many search operations and also those operations where data is constantly inserted and deleted. AVL trees provide a better efficiency than BST as they maintain their upper bound of O(n*log n) through rotations.

Eg: the map and set library in c++ isimplementedusing trees.

How do you initialize structures?

struct Details

{

string name;

int age;

char gender;

} Stud{"Phumlani", 21, "M"};

What is memory variables?

Hard to tell, variables usually are in the memory... be more specific.

What is the first step the use in detecting data type mismatch errors?

Better if you use javascript or another scripting language to analyse what is sent to the server in the first place. Most of the browsers support javascript.

Suppose there is an input type of text of the simple html form

Name:

Age :

// The button below makes sure that client side validation is done otherwise it doesn't send data to servers

// Here the "return checkData()" forces the client-side validation to occur before sending it to server

// The neat little code tells if javascript is enabled/disabled in browser

Most of things would be easy this way but alas things aren't so easy. You also need to validate data on the server side using echo statements & control loops before finally posting data in mysql table

What is a basic structure of a c programming?

Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main()

{

Declaration part Executable part (statements)

} /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) .

.

. (return type) (function name n) (arguments...) Basic structure of a C program is /* Documentation section */ /* Link section */ /* Definition section */ /* Global declaretion section */ /* Function section */ (return type) (function name) (arguments...) void main()

{

Declaration part Executable part (statements)

} /* Sub-program section */ (return type) (function name 1) (arguments...) (return type) (function name 2) (arguments...) .

.

. (return type) (function name n) (arguments...)

What is universal pointers?

A universal pointer is a pointer variable that does not specify the type being pointed at. That is, it can be used to store any memory address regardless of the type of object actually stored at that address. It can be likened to a variable type, but you cannot dereference the memory address without providing some mechanism for determining the actual type stored at that memory address. Generally you would use a universal pointer when you don't actually care what type resides at the address, you are only interested in the address itself. But just as a typed pointer can point to 0 (or NULL), so can a universal pointer, which simply means it points at nothing at all.

What is a function argument?

If you are talking about F(x)=something then the argument is whatever value is inside the F() or F of whatever, be it x,y,5,or anything else.

Example

F(x+1) =x^2 or F of x+1 = X^2

=(x+1)^2 [substitute the argument in to the problem]

=x^2+2x+1 [simplify]

So when f(x+1) is equal to x^2, therefore the answer is x^2+2x+1.

What is function parameters?

whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters..

e.g.

int sum(int a,int b);

here a & b are known as parameters.....

Why use pointer?

Because you can produce fast and efficient code. Function arguments are passed "by value", and so you can't change the original value of the argument, but if you use pointers, you can.

What is generic programming in c?

Generic programming in C refers to the practice of writing code that is independent of any specific data type. This is typically achieved using macros and function pointers, enabling the creation of functions and data structures that can operate on various data types without code duplication. The C Standard Library's use of void* pointers is an example, allowing functions to accept pointers to any data type. Although C lacks built-in support for generics like some other languages, these techniques enable a flexible and reusable code base.

Compiler construction would be used for what purpose?

Compiler construction is used for the purpose of developing programming languages and compilers. You can learn more about this at the Wikipedia. Once on the page, type "Compiler construction" into the search field at the top of the page and press enter to bring up the information.

What advantages of a sorted list over a linked list?

All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.

What does user defined mean?

User Defined Regions are a way of allowing a user to write directives around arbitrary segments of code which will allow these segments of code to be folded around.

User Defined regions are regions that are defined by special product or service. They are often inside of other larger physicals, human and functional regions.

What is first in first out data structure?

QUEUE is the first in first out (FIFO) data structure. It is a linear data structure in which insertion of an element is done from rear end of a list and deletion of an element is done from front end of a list. For example- people in queue waiting for bus.

What does c in c stand for?

C does not stand for any specific abbreviation. C is from CPL (Computer Programming Language), then BCPL (Basic Computer Programming Language), which spawned both B (pretty much unused now) and C.