0% found this document useful (0 votes)
37 views

Tutorial 3 Operators

Uploaded by

Dhairya Pandey
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Tutorial 3 Operators

Uploaded by

Dhairya Pandey
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

ODD 2023

Tutorial Sheets – 3
Software Development Fundamentals – I (15B11CI111)
Course Outcomes (CO)
CO1 Explain various phases of software development life cycle

CO2 Explain various data types, memory allocation schemes, precedence of


arithmetical and logical operations, and need of array, and structures
CO3 Draw the flow chart and write the high level code for different problems

CO4 Apply and implement functions with or without pointers for different problems

CO5 Demonstrate and implement various operations like traverse, insertion, deletion,
etc. on files

Note: Students are advised to submit their solutions to their respective


tutorial faculties

Before attempting the following questions, discuss the doubts in earlier tutorials (Tutorial 1
and Tutorial 2), if any.

Q1. [CO2] What will be the output of following program?

#include<stdio.h>
int main()
{
printf("%d\t",sizeof(2.5));
printf("%d\t",sizeof(2));
printf("%d\t%d",sizeof('A'),'A');
return 0;
}

Q2. [CO2]What will be the output of the following program?

#include<stdio.h>
int main(){
float me = 5.25;
double you = 5.25;
if(me == you)
printf("Hey");
else
printf("Bye");
return 0;
}
Q3. [CO2] What will be the output of the following program?
#include <stdio.h>
int main()

{
int a=11, b=22, c;

c = a + b + a++ + b++ + ++a + ++b;


printf("a=%d",a);
printf("b=%d",b);
printf("c=%d",c);

Q4. [CO2] Show the output of the following code:

#include <stdio.h>
int main() {
char ch = 'B';
printf("%c\n", ch);
int x = 45, y = 90;
printf("%d\n", x);
printf("%i\n", y);
float f = 12.67;
printf("%f\n", f);
printf("%e\n", f);
int a = 67;
printf("%o\n", a);
printf("%x\n", a);
char str[] = "Hello World";
printf("%s\n", str);
printf("%20s\n", str);
printf("%-20s\n", str);
printf("%20.5s\n", str);
printf("%-20.5s\n", str);
return 0;
}
Q5. [CO2]Which one of the following operator performs operations with only integer operands?

A. +
B. *
C. /
D. %
Q6. [CO2] Which one of the following statements are true in context of || (logical OR) operator

S1: Evaluation of the expression involving || operators only will stop if one of its components
is evaluated as true
S2: Evaluation of the expression involving || operators only will stop if one of its components
is evaluated as false
S3: Evaluation of the expression involving || operators only takes place from right to left
S4: Evaluation of the expression involving || operators only takes place from left to right

A. S1 & S2
B. S1 & S3
C. S1 & S4
D. None of the listed options

Q7. [CO2] Which one of the following is the output of the program given below?

#include<stdio.h>
void main()
{
int A = - -2
printf(“%d”, A);
}

A. -2
B. 2
C. Will give error
D. None of the listed options

Q8. [CO2] Which one of the following is the output of the program given below?

#include <stdio.h>
int main()
{
int x, y, z;
x = 20;
y = 30;
z = 10;

if(x > y, x > z)


printf("IF BLOCK");
else
printf("ELSE BLOCK");
return 0;
}
A. IF BLOCK
B. ELSE BLOCK
C. Will give error
D. None of the listed options

Q9. [CO2] Which one of the following is the output of the program given below?

#include <stdio.h>
int main()
{
intw, x, y, z;
x = 20;
y = 30;
z = 10;
w = (x = z, y+=x, z = x+y+z);
printf(“%d %d %d %d”, w, x, y, z);
}

A. 60, 10, 40, 60


B. 10, 10, 40, 60
C. 10, 10, 30, 60
D. None of the listed options

Q10. [CO2]Which one of the following is not a valid declaration of a variable in C?


D1: signed int x;
D2: unsigned short y;
D3: unsigned short int z;
D4: signed short w;

A. D2
B. Both D2 and D4
C. All declarations are valid
D. None of the listed options

Q11. [CO2] What will be output of the following program?

int main()
{
float w, x;
double y, z;
w = 20 / 3;
x = 20.0 / 3;
y = 20 / 3;
z = 20.0 / 3;
if(w == y)
printf(“Same”);
else
printf(“Different”);
if(x == z)
printf(“\t Same”);
else
printf(“\t Different”);
if(w == x)
printf(“\t Same”);
else
printf(“\t Different”);
return 0;
}

A. Same SameSame
B. Same DifferentDifferent
C. Different SameSame
D. Different DifferentDifferent

You might also like