Академический Документы
Профессиональный Документы
Культура Документы
– 1
Getting Started
Questions
SECTION A
Que: Which of the following are invalid variable names and why?
B'day
Invalid : No special symbols are allowed
while
Invalid: keywords cannot be used variablem name
$hello
Invalid: No special symbols are allowed.
#HASH
Invalid: No special symbols are allowed.
dot.
Invalid: No special symbols are allowd.
number
Valid
totalArea
Valid
_main()
Invalid: No special symbols are allowed.
temp_in_Deg
Valid
total%
Invalid: No special symbols are allowed.
1st
Invalid: Variable name cannot be start with a number.
stack-queue
Invalid: No special symbols are allowed.
variable name
Invalid: No white space is allowed.
%name%
Invalid: No special symbols are allowed.
salary
Valid
SECTION B
Que: State whether the following statements are True or False.
(b) True
(c) True
(e) True
(f) True
(h) True
(i) True
(j) True
(m) True
(n) True
(o) True
SECTION C
Que: Ramesh’s basic salary is input through the keyboard. His dearness allowance is
40% of basic salary, and house rent allowance is 20% of basic salary. Write a program
to calculate his gross salary.
#include<stdio.h>
#include<conio.h>
int main()
{
int sal;
float gros_sal;
printf("Enter the basic salary of Ramesh : ");
scanf("%d", &sal);
//salary calculated
gros_sal=sal+(sal*40/100)+(sal*20/100);
getch();
return 0;
}
Que: The distance between two cities (in km.) is input through the keyboard. Write a
program to convert and print this distance in meters, feet, inches and centimeters.
#include<stdio.h>
#include<conio.h>
int main()
{
float dis;
getch();
return 0;
}
Que: If the marks obtained by a student in five different subjects are input through the
keyboard, find out the aggregate marks and percentage marks obtained by the student.
Assume that the maximum marks that can be obtained by a student in each subject is
100.
#include<stdio.h>
#include<conio.h>
int main()
{
float a,b,c,d,e;
getch();
return 0;
}
Que: Temperature of a city in Fahrenheit degrees is input through the keyboard. Write
a program to convert this temperature into Centigrade degrees.
#include<stdio.h>
#include<conio.h>
int main()
{
float f,c;
printf("Enter the temperature in Fahrenheit : ");
scanf("%f", &f);
//conversion of temperature
c=(f-32)*100/180;
getch();
return 0;
}
Que: The length & breadth of a rectangle and radius of a circle are input through the
keyboard. Write a program to calculate the area & perimeter of the rectangle, and the
area & circumference of the circle.
#include<stdio.h>
#include<conio.h>
int main()
{
float l,b,r;
//rectangle calculations
printf("\n%f is the area of the rectangle.", l*b);
printf("\n%f is the perimeter of the rectangle.", l+b);
//circle calculations
printf("\n\nEnter the radius of the circle : ");
scanf("%f", &r);
printf("\n%f is the area of the circle.", 3.14*r*r);
printf("\n%f is the perimeter of the circle.",
2*3.14*r);
getch();
return 0;
}
Que: If the total selling price of 15 items and the total profit earned on them is input
through the keyboard, write a program to find the cost price of one item.
#include<stdio.h>
#include<conio.h>
int main()
{
int sp,prof;
getch();
return 0;
}
Que: Paper of size A0 has dimensions 1189 mm x 841 mm. Each subsequent size A(n) is
defined as A(n-1) cut in half parallel to its shorter sides. Write a program to calculate
and print paper sizes A0, A1, A2, ...A8.
#include<stdio.h>
#include<conio.h>
int main()
{
int A0_a, A0_b, A1_a, A1_b, A2_a, A2_b, A3_a, A3_b,
A4_a, A4_b, A5_a, A5_b, A6_a, A6_b, A7_a, A7_b, A8_a, A8_b;
A0_a = 1189;
A0_b = 841;
printf("\nA0 : %dmm x %dmm ", A0_a, A0_b);
A1_a = A0_b;
A1_b = A0_a/2;
printf("\nA1 : %dmm x %dmm ", A1_a, A1_b);
A2_a = A1_b;
A2_b = A1_a/2;
printf("\nA2 : %dmm x %dmm", A2_a, A2_b);
A3_a = A2_b;
A3_b = A2_a/2;
printf("\nA3 : %dmm x %dmm", A3_a, A3_b);
A4_a = A3_b;
A4_b = A3_a/2;
printf("\nA4 : %dmm x %dmm", A4_a, A4_b);
A5_a = A4_b;
A5_b = A4_a/2;
printf("\nA5 : %dmm x %dmm", A5_a, A5_b);
A6_a = A5_b;
A6_b = A5_a/2;
printf("\nA6 : %dmm x %dmm", A6_a, A6_b);
A7_a = A6_b;
A7_b = A6_a/2;
printf("\nA7 : %dmm x %dmm", A7_a, A7_b);
A8_a = A7_b;
A8_b = A7_a/2;
printf("\nA8 : %dmm x %dmm", A8_a, A8_b);
getch();
return 0;
}