0% found this document useful (0 votes)
122 views10 pages

AR 23-I-I IP (Unit 1 & 2) Rivision

Uploaded by

ashagantana18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views10 pages

AR 23-I-I IP (Unit 1 & 2) Rivision

Uploaded by

ashagantana18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

BTECH I YEAR I SEMESTER (AR 23)

Name of the Course : Introduction to Programming

S.No QUESTIONS Level Course MARKS


Outcome
UNIT 1
Programs and Algorithms, Computer Problem Solving Requirements, Phases of Problem Solving, Problem
Solving Strategies, Top-Down Approach, Algorithm Designing, Primitive Data Types, Variables, and
Constants, Structure of C program, Basic Input and Output, Operators, Expression Evaluation, Type
Conversion
1 Which of the following statement is correct? Remembering (L1) CO1 2M
a) Keywords are those words whose meaning
is already defined by Compiler.
b) Keywords cannot be used as variable name.
c) There are 32 keywords in C
d) C keywords are also called as reserved
words.
2 Correct the below code to display the output as 13. Analyzing(L4) CO1 2M
#include<stdio.h>
int main()
{
int x=1; y=5; z=8;
z=x+y;
printf("%d",z);
return 0;
}
3 What will be the output? Analyzing(L4) CO1 2M
[N.B.: .2f is used for printing floating point value
with 2 decimal places]
#include <stdio.h>
int main()
{
float a = 5.0;
printf ("The output is %.2f",
(7/5)*a + 12);
return 0;
}
4 What will be the final value of c in the following Analyzing(L4) CO1 2M
C code snippet?
(Initial values: a = 1, b = 2, c = 1)
c += (-c) ? a : b;
5 What will be the output? [N.B:- .2f is used to print Analyzing(L4) CO1 2M
upto 2 decimal places of a floating point
number]
#include <stdio.h>
int main()
{
float a = 9.0;
printf ("%.2f", (9/5)*a + 10);
return 0;
}
6 What will happen if the following C code is Analyzing(L4) CO1 2M
executed?
#include <stdio.h>
int main()
{
float b=123.1265;
printf("%5.1f\n",b);
printf("%.2f\n",b);
printf("%.3f\n",b);
return 0;
}
7 What will be the output of the program given Analyzing(L4) CO1 2M
below?
#include <stdio.h>
int main()
{
a=7;
printf("%d", a);
return 0;
}
8 Correct the below code so as to display the ouput Analyzing(L4) CO1 2M
as 25.
#include<stdio.h>
main()
{
int a=10; b=15; c=20;
c=a+b;
printf("%d",c);
}
9 What is the output of the following program? Analyzing(L4) CO1 2M
#include <stdio.h>
#define a 5
main()
{
int a=2, b=3;
a=a+b;
b=a-b;
a=a-b;
printf("%d, %d", a, b);
}
10 What is the output of the following program? Analyzing(L4) CO1 2M
(Assuming that the program is run on a 32-bit
system)
#include<stdio.h>
int main()
{
char a='a';
a=a+3;
printf("%c", a);
}
11 What is the output of below Analyzing(L4) CO1 2M
#include<stdio.h>
main()
{
printf(“Hello World ! %d \n”,x);
}
12 What is the output of below Analyzing(L4) CO1 2M
#include<stdio.h>
#define x 5+10
int main()
{
int result=10;
result =result * x;
printf(“%d”,result);
return 0;
}
13 What is the output, Analyzing(L4) CO1 2M
#include<stdio.h>
int main()
{
int i=10,20,30;
printf(“%d\n”,i);
return 0;
}
14 What is the output, Analyzing(L4) CO1 2M
#include<stdio.h>
int main()
{
int i=-5;
i=i/2;
printf(“%d\n”,i);
return 0;
}
15 What will be the output of the following C code? Analyzing(L4) CO1 2M
#include <stdio.h>
int main()
{
int a = 10;
double b = 5.6;
int c;
c = a + b;
printf("%d", c);
}
16 What will be the output of the following C code? Analyzing(L4) CO1 2M
#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = a == (b + c);
printf("%d", d);
}
17 What will be the output of the following C code? Analyzing(L4) CO1 2M
#include <stdio.h>
void main()
{
int x = 1, z = 3;
int y = x << z;
printf(" %d\n", y);
}
18 Predict the output, Analyzing(L4) CO1 2M
#include <stdio.h>
int main()
{
int a=5,b=10,temp;
temp=a;
a=b;
b=temp;
printf("%d\t%d",a,b);
return 0;
}
19 Predict the value of max in the below code, Analyzing(L4) CO1 2M
#include<stdio.h>
int main()
{
int a=3,b=10,max;
max=a>b?a:b;
printf("%d",max);
return 0;
}
20 Write the output for below code, Analyzing(L4) CO1 2M
#include<stdio.h>
int main()
{
int a=625,b=2394,c=12345;
printf("%5d, %5d, %5d\n",a,b,c);
printf("%3d, %4d, %5d\n",a,b,c);
return 0;
}
21 Identify the role of an identifier? Choose various Understanding (L2) CO1 5M
basic datatypes used in C?
22 Identify different types of operators and explain Understanding (L2) CO1 5M
any five of them with an example code snippet.
23 Construct an algorithm to find the volume of the Applying (L3) CO1 5M
cuboid. (Volume of cuboid=lbh)
24 Accept any two numbers from the user, if the first Applying (L3) CO1 5M
number is greater than second then print the sum
of these two numbers, otherwise print their
difference. Build this program using ternary
operator.
25 Build a C program to accept any five-digit number Applying (L3) CO1 5M
from the user and print the value of remainder
after dividing by 3.
26 Build a program to accept the principal, rate, and Applying (L3) CO1 5M
number of years from the user and find out the
simple interest. Note: Simple interest formula is
(P*T*R)/100
27 Accept the radius of the circle from the user and Applying (L3) CO1 5M
identify the area and perimeter of the circle in C
language. Note: Area of circle= Pie*r*r, Perimeter
of circle=2*Pie*r
28 Accepts marks in five subjects from the user and Applying (L3) CO1 5M
identify the total percentage of the marks using C
program
29 Build a C program to accept the number in Applying (L3) CO1 5M
decimal from the user and print the number in
octal and hexadecimal.
30 Make use of C programming language to enter the Applying (L3) CO1 5M
temperature in Celsius and convert that into
Fahrenheit.
UNIT 2
Control Flow, Decision making statements, Looping/Iterative statements and Branching statements
1 Which loop is guaranteed to execute at least one Remembering (L1) CO2 2M
time.
a) for
b) while
c) do while
d) None of the above
2 Which statement is correct? Remembering (L1) CO2 2M
a) Switch case can only be used with ‘int’
b) Switch case can only be used with ‘char’
c) Switch case can be used with all data type
d) Switch case can only be used with ‘int’
and ‘char’
3 Which of the following are incorrect statements, Analyzing (L4) CO2 2M
a) if(a==7) printf("IncludeHelp");
b) if(7==a) printf("IncludeHelp");
c) if(a=7) printf("IncludeHelp");
d) if(7=a) printf("IncludeHelp");
4 What is the output of the following program? Analyzing (L4) CO2 2M
#include<stdio.h>
int main()
{
int i=1;
while(i<10)
{
if(i==3)
continue;
printf("%d ",i);
i++;
}
return 0;
}
5 What will be the output? Analyzing (L4) CO2 2M
#include <stdio.h>
int main()
{
int a=9;
if(a=5)
printf("It is important to be nice\n");
else
printf("It is nice to be important\n");
return 0;
}

6 What will happen if the following C code is Analyzing (L4) CO2 2M


executed?
#include <stdio.h>
int main()
{
int a=20,b=3;
if(a<10)
a=a-5;
b=b+5;
printf("%d %d\n",a,b);
return 0;
}
7 What will be the output of the program given Analyzing (L4) CO2 2M
below?
main()
{
int a=0,b=0;
if(!a)
{
b=!a;
if(b)
a=!b;
}
printf("%d, %d\n",a,b);
}
8 What will be the output of the program given Analyzing (L4) CO2 2M
below?
#include <stdio.h>
int main()
{
int i,j=10;
for(i=0;i=j;j-=2)
printf("%d ",j);
return 0;
}
9 What is the output of the following program? Analyzing (L4) CO2 2M
#include <stdio.h>
main()
{
int i;
for(i=1;i<10,i++)
{
if(i==3)
continue;
printf("%d ",i);
}
}

10 What will be the output? Analyzing (L4) CO2 2M


#include <stdio.h>
int main()
{
int i,sum=0;
for(i=0;i<10;i+=3)
sum+=i*i;
printf("%d",sum);return 0;
}

11 What is the output of below Analyzing (L4) CO2 2M


#include<stdio.h>
int main()
{
int i = 12;
if (i == 10)
printf("i is 10");
else if (i == 15)
printf("i is 15");
else if (i == 20)
printf("i is 20");
else
printf("i is not present");
return 0;
}

12 What is the output of below Analyzing (L4) CO2 2M


#include <stdio.h>
int main()
{
int x=2;
if(x=1)
printf("TRUE");
else
printf("FALSE");
return 0;
}
13 What is the output, Analyzing (L4) CO2 2M
#include <stdio.h>
int main()
{
if((-10 && 10) && (4>3))
printf("Condition is true.");
else
printf("Condition is false.");
return 0;
}

14 Which for loop has range of similar indexes of ‘i’ Analyzing (L4) CO2 2M
used in for (i = 0;i < n; i++)
1) for (i = n; i>0; i–)
2) for (i = n; i >= 0; i–)
3) for (i = n-1; i>0; i–)
4) for (i = n-1; i>-1; i–)

15 What will be the output of the following C code? Analyzing (L4) CO2 2M
#include<stdio.h>
main()
{
if(0)
{
printf(“\n First statement”);
}
if(-10)
{
printf(“\n Second statement”);
}
if(80-10*8)
{
printf(“\n Third statement”);
}
}
16 What is the output of the given below program? Analyzing (L4) CO2 2M
#include<stdio.h>
int main()
{
int i;
for (i=0; i<3; i++)
{
printf("%d", i);
}
return 0;
}
17 Predict the output, Analyzing (L4) CO2 2M
#include <stdio.h>
int main()
{
int x = 1;
switch (x)
{
case 1: printf("Choice is 1 \n");
default: printf("Choice other than 1 \n");
}
return 0;
}
18 How many times “Hello” will be printed when the Analyzing (L4) CO2 2M
following code is executed?
#include<stdio.h>
int main()
{
int i=6;
while(--i>0)
printf("Hello\t");
return 0;
}
19 Write the output for below code, Analyzing (L4) CO2 2M
#include <stdio.h>
int main ()
{
int a = 10;
do {
printf("%d ", a++);
++a;
}while( a >= 20 );
printf("%d ", a);
return 0;
}

20 Write the output for below code, Analyzing (L4) CO2 2M


#include <stdio.h>
int main ()
{
int a = 4, b = 15, c = 29;
if (c > b > a)
printf("TRUE");
else
printf("FALSE");
return 0;
}
21 Build a program to print prime numbers from 1 to Analyzing (L4) CO2 5M
99
22 Build a program to find out the grade of a student Analyzing (L4) CO2 5M
when the marks of 4 subjects are given. The
method of assigning grade is as below,
a) percentage>=85, Grade A
b) percentage<85 and percentage>=70, Grade B
c) percentage<70 and percentage>=50, Grade C
d) percentage<55 and percentage>=40, Grade D
e) percentage<40, Grade E
23 Identify the use of if and if-else decision-making Understanding (L2) CO2 5M
statements in C language.
24 Make use of switch-case-default statement to Understanding (L2) CO2 5M
explain its working.
25 Identify the difference of while loop with for loop Understanding (L2) CO2 5M
with suitable example?
26 Build a program to print the below kind of Applying (L3) CO2 10M
patterns for the given value of n.

27 Build a program to find the sum of the series up to Applying (L3) CO2 5M
n terms where n is an integer entered by the user.
1+2+4+7+11+16+....
28 Build a program to find out the value of x raised Applying (L3) CO2 5M
to the power y, where x and yare positive integers
without using pow() function.
29 Build a program to find largest number from Applying (L3) CO2 5M
three given numbers

30 Build a program to find whether given year is leap Applying (L3) CO2 5M
or not
31 Build a program to print the sum of digits of any Applying (L3) CO2 5M
number
32 Build a program to accept a number and find the Applying (L3) CO2 5M
reverse of that number.
33 Build a program to accept any number n and print Applying (L3) CO2 5M
the sum of square of all numbers from 1 to n.
34 Build a program to accept any number n and print Applying (L3) CO2 5M
the cube of all numbers from 1 to n which are
divisible by 3
35 Build a program to accept any six digit number Applying (L3) CO2 5M
and print the sum of all even digits of that number
and multiplication of all odd digits

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy