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

Module1 CSP

The document contains a series of questions and programming tasks related to computer architecture, memory types, and C programming. It includes multiple-choice questions about data paths, memory types, and processor addresses, as well as programming exercises for various algorithms and data manipulations. Additionally, it provides answers to some of the questions, indicating the correct options.

Uploaded by

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

Module1 CSP

The document contains a series of questions and programming tasks related to computer architecture, memory types, and C programming. It includes multiple-choice questions about data paths, memory types, and processor addresses, as well as programming exercises for various algorithms and data manipulations. Additionally, it provides answers to some of the questions, indicating the correct options.

Uploaded by

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

Module 1

Q1) The Width of a processor’s data path is measured in bits. Which of the
following are common data paths?
a. 8 bits
b. 12 bits
c. 16 bits
d. 32 bits
Q2)Which is the type of memory for information that does not change on your
computer?
a. RAM
b. ERAM
c. ROM
d. RW / RAM
Q3)Which one of the following is the address generated by CPU?
a) physical address
b) absolute address
c) logical address
d) none of the mentioned
Q4.An embedded system must have (a) hard disk (b) processor and memory (c)
operating system (d) processor and input-output unit(s).
Q5.During the execution of the instructions, a copy of the instructions is placed in
the ______ .
a) Register
b) RAM
c) System heap
d) Cache
Q6. CISC stands for,
a) Complete Instruction Sequential Compilation
b) Computer Integrated Sequential Compiler
c) Complex Instruction Set Computer
d) Complex Instruction Sequential Compilation
Q7.The I/O processor has a direct access to ....................... and contains a number
of independent data channels.

A) main memory
B) secondary memory
C) cache
D) flash memory
Q8. Write a C Program to swap three numbers without using fourth variable.
Q9)Write a C Program to swap three numbers .
Q10)Write a C Program to swap two numbers using third variable.
Q11)Write a C Program to swap two numbers without using third variable.
Q12)Write a C Program to print the total seconds in a given time(hrs,min,sec's).
Q13)Write a C Program to convert temperature from Fahrenheit to
centigrade.C=(F-32)*5/9.0
Q14)Write a program to calculate the sum of digits of a three digit number.
Q15) Write a program to find the reverse of a number.
Q16)Write a program to merge n numbers.
Exp: a=1,b=2,c=3 is 123 and a=1,b=2 is 12.
Q17)Write an algorithm,pseudo code and flowchart for finding:
A)Maximum out of three numbers
B)Maximum out of four numbers
C)Factorial of a number
D)Smallest out of n numbers
E)First and second highest out of n numbers
Q18)Determine which of the following are valid identifiers.If invalid ,explain why
A) record1 B) $tax C) name_and_address D)1record e)name f)name-and-address
g)file_3 h) name and address I) 123-45 j)return
Q19)Determine which of the following are valid character constants
A) 'a' B)'\\' C) '\0' D)'$' E) '\a' F)'xyz' G)'\n' H)'T' I)'\052'

Q20)What will be output to the following program:


A)main()
{int a,b;
scanf("%f %f",&a,&b);
printf("%d %d",a,b);
} If input is given as 2 3,the output will be:
I)2.0 3.0
II)3.0 2.0
III)2 3
IV)run time error
V)Garbage

Q21) Explain the output for the following:


main()
{
int x=2,y=6,z=6;
x=y==z;
printf("%d",x);
}
Q22)What is the purpose of control string in scanf function? What type of
information does it convey?Of what is the control string composed?
Q23)If a control string within a scanf function contains multiple character
groups,how are the character groups separated?Are whitespace characters
required?
Q24)When entering data via the scanf function,must octal data be preceded by 0?
Must hexadecimal data be preceded by 0x (or OX)?How must floating –point data
be written?
Q25)Interpret the meaning of the control string in each of the following scanf
functions:
A)scanf("%12ld %5hd %15lf %15le",&a,&b,&c,&d);
B) scanf("%10lx %6ho %5hu %14lu",&a,&b,&c,&d);
C)scanf("%12D %hd %15f %15e",&a,&b,&c,&d);
D)scanf("%8d %*d %12lf %12 lf",&a,&b,&c,&d);
Q26)Predict the output:
int a =3;
float b=3.0;
if(a==b)
printf("\n a and b are equal");
else
printf("\n a and b are not equal");
Q27)Write a program to print the second maximum of four numbers.
Q28)Write a program to computer the telephone bill of a customer.Monthly Rental
is Rs 100 and rates are as follows:
No. Of calls Rate
1 to 100 0
101 to 200 0.80
201 to 500 1
501 and above 1.20
Q29)Write a program to check whether a three digit number is a magic number or
not.A number is a magic number if its reverse is same as the original number.
Q30)Write a program to determine an entered year is leap year or not.
Q31)Any character is entered through the keyboard.Write a program to determine
whether the character entered is a capital letter ,a small case letter, a digit or a
special symbol.
Q32)Write a program using conditional operators to determine whether a year
entered through the keyboard is leap year or not.
Q33)Write a program to calculate the real roots of a quadratic equations.
Q34)Write a program to create a calculator using switch case statements that can
perform addition,subtraction,multiplication, division and modulus(remainder).
Q35)What will b contain:
int a=300,b,c;
if(a>=400)
b=300;
c=200;
printf("\n%d%d",b,c);
Q36)Write a program to print fibonnicci series upto N terms.
Q37)Write a program to check if the given sequence of numbers is in ascending
order or not.The sentinel value of the sequence is –1.
Q38) Write a program to print the sum of 9+99+999+…........n terms.
Q39)Write a program to print pascal's triangle:
1
11
121
1331
14641
Q40)Write a program to find square of a positive number without using math.h
Q41) Write a program to Convert a decimal number to its binary equivalent.
Q42)Write a program to compute the natural logarithm of a given number.
Q43)Write a program to generate n random numbers.
Q44)Write a program to print the following output:
abcdefgfedcba
abcdef fedcba
abcde edcba
abcd dcba
abc cba
ab ba
a a
Q45)Write a program to print number of characters typed by the user.Input will be
terminated by enter key.
Q46)Write a program to reverse a number and find its octal equivalent.
Q47)Print the following pattern:
4
434
43234
4321234
43234
434
4
Q48)Write a program to find out the maximum,second maximum,position of
maximum,and position of second maximum from the sequence of n numbers.
Q49)Write a program to generate all combinations of 1,2 and 3 using for loop.
Q50)Write a program to print the sum of first n prime numbers.
Q51)According to a study ,the approximate level of intelligence of a person can be
calculated using the following formula:
i=2+(y+0.5x)
Write a program which will produce a table of values of i,y and x,where y
varies from 1 to 6 and for each value of y,x varies from 5.5 to 12.5 in steps of 0.5
Q52)Write a program to check whether a given number is palindrome or not.
Q53)Write a program to compute the volume and surface area of a sphere of radius
r.
Q54)Write a program to print the sum of n numbers,sum of squares of first n even
numbers and sum of cube of first n odd numbers.
Q55)Write a program to calculate overtime pay of 10 employees.Overtime is paid
at the rate of Rs 12 per hour for every hour worked above 40 hours.Assume that
employees do not work for fractional part of an hour.
Q56) Write a program to check whether a given sequence of values is sorted in
increasing order.The sentinel value for the sequence is –1.No use of arrays is
permitted.
Q57)Write a program to find the sum and average of values appearing at the
positions divisible by 3 in the given sequence of n values.No use of arrays is
permitted.
Q58)Write a program to find the number of times the minimum value has appeared
in the given sequenceof n numbers.No use of arrays is permitted.
Q59)Write a program to input the marks of n students and count the number of
students who have obtained a,b,c,d and f grades.The grades are awarded according
to the following rules.
Marks Grade
>=80 A
>=70 B
>=60 C
>=50 D
<50 F
Q60)Suppose we want to calculate the average of several consecutive lists of
numbers.Ask user how many lists are to be averaged and the count of numbers in
each list.Write above program.
Q61)Calculate the average of non negative numbers in a list of n numbers.
Q62)Write a loop that will calculate the sum of every third integer,beginning with
I=2 for all values of I that are less than 100.Write the loop in three different ways:
A)Using a while statement
B)Using a do-while statement
C)Using a for statement.
Solutions
Ans 1 . a.8bits
Ans 2. c ROM
Ans 3 c. Logical Address
And 4. b)processor and memory
And 5. d)Cache
Ans 6. c)Complex Instruction Set Computer
Ans 7 A)Main Memory

You might also like