Week 3 c Programming
Week 3 c Programming
GRADED ASSIGNMENT
WEEK 3
WEEK 3
PROGRAMMING
PROGRAMMING
ELECTROWORLD
ELECTROWORLD
In C programming, what
is the purpose of a
header file?
To include function
declarations and macros.
Which of the following is a
valid comment in C?
// This is a comment
/* This is a comment */
Which of the following
are valid variable names
in C?
Number_2
Number3
Which of the following are
valid ways to declare a long
variable in C?
long a;
lont int a;
signed long a;
What is the value of a
after the execution of
the following code?
30
What will be the final
value of j?
8
Which statement
correctly assigns the
value 20 to variable a?
Consider that all given
variables are integer.
a = x = y = 20;
Which of the following
statements about Boolean
conditions in C is true?
Compilation error
What will be the output of the
following program?
15
What will be the output
of the program?
Compilation error
What will be the output
of the program?
ABC3
What will be the output of
the given code snippet?
0
What will be the value of x, y
and z after executing the
given code snippet?
x = 2, y = 3, z = 1
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
int main()
{
// Initialize required Variables
double weight, rate, cost;
return 0;
}
COPY & PASTE
#include <stdio.h>
int main()
{
int age, gender;
double weight, height, activityFactor, calories;
return 0;
}