You are on page 1of 5

Name: kshitiz Aggarwal

Section: 7, CSDS
Admission no: 2020CSDS085

Quiz Assignment- 2
Programming for Problem Solving
Time: 20 min MM: 10

Note: Solve all questions and put your answers at the given space. All questions
carry equal marks.

Q1: Solve the question and mention your answer.


#include<stdio.h>
void main() { int
a=9,b=9,c; c=a^b;
printf(“%d”,c); }

Your output answer:0

Q2: Solve the question and mention your answer.


#include<stdio.h>
void main()
{
int a,b,c,d;
a=512; b=17;
c=29; d=a>b||
c>a;
printf(“%d”,d);
}

Your output answer: 1

Q3: Solve the question and mention your answer.


#include<stdio.h>
void main() {
int a=9,b=4,c;
c=a&b;
printf(“%f”,c);
}

Your Error answer:%f must be replaced with %d

Q4: Solve the question and mention your answer.


#include<stdio.h>
void main()
{ int a=7;
c=a/b;
printf(“%d”,b);
}

Your Error answer : ‘b’ , ‘c’ undeclared

Q5 : Solve the question and mention your answer.


#include<stdio.h>
void main()
{ int a=7;
c=a/0;
printf(“%d”,c);
}

Your Error answer: ‘c’ undeclared


Q6: Explain and differentiate ROM & RAM

ROM

• RAM stands for Random Access Memory.


• In RAM, memory location can be accessedrandomly.
• RAM is a semiconductor memory.
• Access time is independent of the location to beaccessed.
• it is also known as temporary memory.
ROM

• ROM stands for Read Only Memory.


Its normal operation involves only reading of data.
• Information stored in the ROM cannot be changed.

Q7: Explain and differentiate Application Software & System Software

SYSTEM SOFTWARE

• System Software is the type of software which is the interface


between application software and system.
• System software is used for operating computer hardware.
• System software are installed on the computer when operating
system is installed.

APPLICATION SOFTWARE

• Application Software is the type of software which runs as per


user request. It runs on the platform which is provide by system
software.
• Application software is used by user to perform specific task.
• Application software are installed according to user’s
requirements

Q8: Explain and differentiate Linker & Loader

LINKER
 The main function of Linker is to generate executable files.
 The linker takes input of object code generated by
compiler/assembler.
 Another use of linker is to combine all object modules.
 Linker is also responsible for arranging objects in program’s address
space.

LOADER

 The main objective of Loader is to executable files to main memory.


 the loader takes input of executable files generated by linker.
 It helps in allocating the address to executable codes/files.
 Loader is also responsible for adjusting references which are used
within the program.

Q9: Explain and differentiate printf(); &scanf ();

PRINTF

 In C programming language, printf() function is used to print the


(“character, string, float, integer, octal and hexadecimal values”)
onto the output screen.
 We use printf() function with %d format specifier to display the
value of an integer variable.
 Similarly %c is used to display character, %f for float
variable, and %lf for double
 To generate a newline,we use “\n” in C printf() statement.

SCANF

 In C programming language, scanf() function is used to read


character, string, numeric data from keyboard
 Consider below example program where user enters a character.
This value is assigned to the variable “ch” and then displayed.
 The format specifier %d is used in scanf() statement. So that, the
value entered is received as an integer
Q10: Write a program to print largest among three using conditional operator.

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,big;
clrscr();
printf ("enter the a,b and c");
scanf("%d%d%d",&a,&b,&c);
big=a>b?(a>c? a:c):(b>c ? b:c);
printf("\n the biggest number is :%d", big);
getch();
}

You might also like