• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 32 páginas
Examen

C-programming questions and answers

Document preview thumbnail
Vista previa 4 fuera de 32 páginas

The document contains a series of programming-related questions and answers, primarily focused on the C programming language. It covers fundamental concepts such as swapping variables, tokens, call by value, time complexity, and characteristics of C. It also explains programming structures like flowcharts, data types, and storage classes. Additionally, the document discusses functions like `getch()` and `getchar()`, and control statements like break and continue. Each topic is supplemented with explanations, examples, and sample code to demonstrate key concepts.

Vista previa del contenido

QUESTIONS WITH ANSWERS
1. what do you mean by swapping?
Ans- Swapping two number in C
programming language means exchanging
the values of two variables. Suppose you
have two variable var1 & var2. Value of
var1 is 20 & value of var2 is 40. So, after
swapping the value of var1 will become 40
& value of var 2 will become 20.
#include<stdio.h>
int main() {
double first, second, temp;
printf("Enter first number: ");
scanf("%lf", &first);
printf("Enter second number: ");
scanf("%lf", &second);


// value of first is assigned to temp
temp = first;

, // value of second is assigned to first
first = second;


// value of temp (initial value of first) is
assigned to second
second = temp;


// %.2lf displays number up to 2 decimal
points
printf("\nAfter swapping, first number =
%.2lf\n", first);
printf("After swapping, second number =
%.2lf", second);
return 0;
}
Two types of swapping basically
a. call by value
b. call by reference

,2.what is token?
Ans- Tokens in C is the most important
element to be used in creating a program
in C. We can define the token as the
smallest individual element in C. For
`example, we cannot create a sentence
without using words; similarly, we cannot
create a program in C without using tokens
in C. Therefore, we can say that tokens in C
is the building block or the basic
component for creating a program in C
language.




o Keywords in C
o Identifiers in C
o Strings in C

, o Operators in C
o Constant in C
o Special Characters in C


3.what do you mean by call by value?
Ans- The call by value method of passing
arguments to a function copies the actual
value of an argument into the formal
parameter of the function. In this case,
changes made to the parameter inside the
function have no effect on the argument. By
default, C programming uses call by value
to pass arguments.
/* function definition to swap the values */
void swap(int x, int y) {


int temp;


temp = x; /* save the value of x */
x = y; /* put y into x */

Información del documento

Subido en
12 de septiembre de 2024
Número de páginas
32
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
ScholarSync
4.3
(19)
Vendido
237
Seguidores
5
Artículos
3042
Última venta
1 mes hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes