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

What is the definition of the Watchdog Function?

The watchdog function of Congress is designed to keep watch on the executive agencies

What is the function of the aortices?

I don't know the word "aortices". Perhaps it is a misspelling. Please restate your question.

How. to. write an. algorthim. to find the. sum of. first. 15 natural. numbers?

Write an. Algorthim. To. Find the. Sum. Of. First15 natural. Numbers

In ANSI C you can hide data by using private access specifier Justify?

One can always declare a datatype as static which will limit the scope to the file only. this way data hiding can be achived. For more clearance on the same please refer 'the C programming language'.

Data hiding means only relevant data is visible to the user and all the background information is hidden from the user. In c++, the variables are named as data members and these can be hidden with the help of private access specifier.

In procedural languages, variables(global variables) are free to flow from functions to functions and hence they were not secured. But in C++, only the class in which the data members are being declared can access them by using private specifier. As, the data members and also member functions of a class cannot be accessed outside the class if they have private access so, they get hidden from the user and hence the data hiding is achieved.

Also in inheritance when we derive a class from the base class then the derived class cannot access the private members of the base class. In addition, if a class is derived from another class privately i.e. for example syntax : class B : private A , is used then all the public and protected members (not private) becomes private to class B and cannot be accessed outside the class B, even by using the object of class B.

Hence, data hiding is achieved in C++ through private access specifier.

Remington model 24 what type bullet should be used in 22 short std or high velocity lead or?

The Model 24 was made in two configurations - one would shoot only 2 short (usually used for gallery rifles at arcades) and the other for 22 long rifle. If it is not marked on the side of the barrel (and it should be), take the gun apart and see if a 22 LR will slide completely into the chamber. If not, it is a 22 short.

What is and gm and and gd in c program?

gd is graphics driver specifies which graphics driver to be used..... gm is graphics mode sets highest resolution for detected driver

What are the main ways of exiting a program?

Other than throwing an exception or a run-time library error, or forcibly terminating the process, there is only one way of exiting a program; you return from the entry point function, usually main(), provided by the library, or from winmain(), if you are using Windows.

What are the four main types of SAE programs?

Ownership/Entrepreneurship, Placement, Exploratory, and Research.

Describe the difference between Interface-oriented Object-oriented and Aspect-oriented programming?

In object oriented programming cross cutting concerns cannot be implemented while in aspect-oriented these can be implemented easily, but if there is a logic mistake in implementing these cross-cutting concerns then the whole system will fail. In case of object-oriented whole system will not fail.(Excerpt from FrazzledDad blog @ http://frazzleddad.blogspot.com)Aspect-OrientedAspect-oriented programming looks at how many components or pieces of a system might need to interact. The intersections of these pieces are what are important in AOP. "Crosscutting" is a slice across several units, all of which interact during some operation. The article Discussing aspects of AOP in Communications of the ACM, Volume 44, Number 10 (2001) shows an example of a drawing editor with point and line elements. If the drawing is moved, both point and line elements need to update. A crosscut hits these elements for this event. Other examples might include logging or exception handling which hit several different layers in a system. (Viji Sarathy, Aspect Orienting .NET Components )Interface-OrientedInterface-oriented programming is a contract-based approach. Nether side of the interface cares how the other does its work, only that the two sides can communicate via an agreed-upon contract. WSDL-based web services are the prime example of this.Object-OrientedObject-Oriented programming is based on abstraction, encapsulation (data hiding), polymorphism and inheritance. Classes implement these concepts to build objects controlling or implementing a system.Abstraction allows loose coupling between components by providing a layer between objects so that one object isn't concerned with how the other implements its business rules. (Interfaces, layers) Great stuff when you want to isolate parts of the system so they can be swapped out without killing the rest of the sytsem.Encapsulation allows abstraction to work by hiding details of a class's implementation from calling classes. (Public vs. private fields)Inheritance enables base (parent) classes to have common functionality defined in it and passed down to child classes. A Shape class might have a field for color which is inherited by child classes of Square or Circle type.Polymorphism enables implementation of same-named public fields, allowing different classes to perform different actions on the same call - rendering a Square or Circle object differently in a graphic program, even though they might both be subclassed from a base Shape class. (Overriding)

Sort the following numbers 19 5 28 2 7 using bubble sort?

Passes:

bold are "sunk" into place

1: 5 19 2 7 28

2: 5 2 7 19 28

3: 2 5 7 19 28

4*: 2 5 7 19 28

*The last pass had no swaps, thus it breaks out of the sort

Efficiency: O(n^2) in random order O(n) when already sorted

When configuring GPOs which node contains the majority of account policies?

Computer Configuration node, Windows settings folder, security settings node.

How do you write a program in C that variables change value with each other?

void main()

{

//variable declaration

int a;

int b;

printf("\n Enter the first value");

scanf("%d",&a);

printf("\n Enter the second value");

scanf("%d",&b);

a=a+b;

b=a-b;

a=a-b;

printf("\n After swap the value");

printf("\n value of A=%d",a);

printf("\n value of A=%d",b);

getch();

}

In C how can you make a program that allowing the user press a key then process without pressing Enter key use getch but how?

How can I program that when the user press a key, it will automatically process like 4 example:

The user press w

You just press the key 'w'

Not scanf...

I think it's getch but I don't know how. It have errors.

Write a c program with an append operation on an existing file?

#include<stdio.h>

#include<stdlib.h>

int main()

{

FILE *fp;

char a[60],b[60];

printf("Enter the name of the file\n");

scanf("%s",a);

fp=fopen(a,"a+");

printf("Enter a single line to append to the file %s :\n",a);

scanf(" %[^\n]s",b);

fprintf(fp,"%s",b);

printf("Append Successfully to the file %s",a);

fclose(fp);

return 0;

}

What does the scope of an identifier refer to?

It refers to a place in your code where names or variable have meaning.

Which program translates an assembly language program into a high-level language?

A High level language is a language like C, Pascal, Fortran. To convert, the easiest way is to use a compiler.

A compiler will take the instructions written in a high level language and convert them into machine code which is the specific instruction set for that type of computer. Assembly language is just a human readable form of a machine code which is how the designers of the computer instruction set made it work.

A disassembler will show the assembly language from machine code. But the compiler usually includes a lot of optimisations from a the high level language and will not often generate very simple assembly.

Explain why interrupts are not appropriate for implementing synchronization?

Because they are completely unrelated things? Synchronization can be implemented with semaphores or mutexes.

Write a program to transpose of a matrix?

Program to find the Transpose of a Matrix

#include

#include

void main()

{

int i,j,n,t;

int m[5][5];

clrscr();

printf("Enter Order of Matrix : ");

scanf("%d",&n);

printf("Enter Elements of Matrix :\n\n");

for(i=0;i

{

for(j=0;j

{

scanf("%d",&m[i][j]);

}

}

printf("Transpose of the Matrix :\n\n");

for(i=0;i

{

for(j=i+1;j

{

t=m[i][j];

m[i][j]=m[j][i];

m[j][i]=t;

}

}

for(i=0;i

{

for(j=0;j

{

printf("\t%d",m[i][j]);

}

printf("\n");

}

getch();

}

Output:

Enter Order of Matrix : 3

Enter Elements of Matrix :

45 56 96

75 36 15

29 64 81

Transpose of the Matrix :

45 75 29

56 36 64

96 15 81

with out using temp variable:

#include

#include

void main()

{

int i,j,n,t;

int m[5][5];

clrscr();

printf("Enter Order of Matrix : ");

scanf("%d",&n);

printf("Enter Elements of Matrix :\n\n");

for(i=0;i

{

for(j=0;j

{

scanf("%d",&m[i][j]);

}

}

printf("Transpose of the Matrix :\n\n");

for(i=0;i

{

for(j=i+1;j

{

m[j][i]=(m[i][j]+m[j][i]-(m[i][j]=m[j][i]));

}

}

for(i=0;i

{

for(j=0;j

{

printf("\t%d",m[i][j]);

}

printf("\n");

}

getch();

}

What is the difference between data hidding and data abstraction?

Abstraction: Abstraction refers to removal/reduction of irrelevant data or unnecessary data or confidential data from a Class. Data hiding: Data hiding is a feature provided by the abstraction for hiding the data from the class.

What defines a variable?

A variable is a named storage location that can hold any data value. A variable has two associated values ; r value and l value.

Where the variables are stored in the computer?

Variable stored in the memory block inside the RAM. whenever we declare a variable it would take space in main memory and consume it's size from RAM.

Using three tuple representation of a sparse matrix?

#include<stdio.h> #include<unistd.h> #define SIZE 3000; void main() { int a[5][5],row,columns,i,j; printf("Enter the order of the matrix(5*5)"); scanf("%d %d",&row,&columns); printf("Enter the element of the matrix\n"); for(i=0;i<row;i++) for(j=0;j<columns;j++) { scanf("%d", &a[i][j]); } printf("3-tuple representation"); for(i=0;i<row;i++) for(j=0;j<columns;j++) { if(a[i][j]!=0) { printf("%d %d %d", (i+1),(j+1),a[i][j]); } } getchar(); }