0% found this document useful (0 votes)
37 views6 pages

FOP Assignment U 1 To U 3

This document contains questions related to C++ programming concepts like data types, constants, variables, operators, control flow statements like if-else, switch case, loops etc. It also includes questions on flowcharts, pseudocode and the structure of C++ programs.

Uploaded by

shwerghu2003
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)
37 views6 pages

FOP Assignment U 1 To U 3

This document contains questions related to C++ programming concepts like data types, constants, variables, operators, control flow statements like if-else, switch case, loops etc. It also includes questions on flowcharts, pseudocode and the structure of C++ programs.

Uploaded by

shwerghu2003
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/ 6

CHHOTUBHAI GOPALBHAI PATEL INSTITUTE OF

TECHNOLOGY
FOP Assignment
Subject code: CE3002

Unit 1

1. Write a rule for declaring character constant.


2. Difference between compiler and interpreter
3. Explain Types of Language with an example.
4. List any two naming rules for variables that should be followed when designing
program logic.
5. Write the importance of Pseudo Code/Algorithm.
6. What are keywords in C++? List any four keywords with their use in C++.
7. Which are the basic data types available in C language? Explain in detail along with its
size and range.
8. Which data types are used to store real number values in C++ and JAVA?
9. Write a short note on the symbols used to draw a flowchart.
10. Write the difference between source code and object code.
11. Write two ways to declare constants in C++.
12. Explain programming paradigms.
13. Explain the Programming process.
14. State the output produce by the following statement.
cout<<" \nThis\nis\n\ntest";
15. What would be the value of x after execution of the following statements?
int x, y = 12;
char z = 'a';
x = y + z;
16. What will be the output of the following code?
#include <iostream>
using namespace std;
int main()
{
cout<<"FYBE\rFYIME\n";
return 0;
}
17. State whether the following declaration statements are valid or invalid. If it is invalid,
give an appropriate reason and rewrite in the correct way.
char ch='ab';
int x , y=22 , int z=0;
char x=y=z='a';
float x=12.2, y , z=56.09;

18. Find out any four syntax errors from the following code.
#include<iostream>
using namespace std;
int MAIN()
{
int radius=10, circle_area=0;
circle area =PI * radius * radius
cout<<"Area of Circle <<circle_area;
return 0;
}
19. Write any two differences between source code and object code.
20. What is constant? Explain in detail four basic types of constants available in C++ or
JAVA language. Also, write at least two differences between literal constant and
symbolic constant by giving an appropriate example.
21. What is an algorithm? Enlist and explain its characteristics.
22. Draw the following symbols used in the flowchart: Start/Stop/Terminal, Input,
Processing, Decision, Output, and Connector.
23. Draw a flowchart or write a pseudocode/Algorithm to represent the logic of a program
that allows the user to enter a value. The program multiplies the value by 10 and outputs
the result.
24. Draw a flowchart or write pseudocode to represent the logic of a program that allows
the user to enter a value for the radius of a circle. The program calculates the diameter
by multiplying the radius by 2 and then calculates the circumference by multiplying the
diameter by 3.14. The program outputs both the diameter and the circumference
25. Explain the structure of the C++ program.
26. Write the advantages and disadvantages of a flowchart. Explain the various symbols
used in flowcharts.
27. Explain the structure of the Java Program.
28. Draw the flowchart for the
1. To calculate the area of circle and triangle.
2. To find out the largest number out of three numbers.
3. To print first 50 even numbers.
4. To find the sum and percentage of given n numbers.
5. To check whether the given number is prime or not.
6. To find the factorial of the given number.
7. To accept n numbers from the user and count how many of them where odd
and also compute the sum of these odd numbers.
8. To convert the temperature from Fahrenheit to Celsius.
Unit 2

1. What will be the output of the following code segment?


#include<iostream>
using namespace std;
int main()
{
int mon=3, day=8;
if (mon > 4)
if (day < 15)
cout<<"Late";
else
cout<<"Early";
}
2. Write a C++ or Java program to find the maximum among three numbers. Also draw
the flowchart and write pseudocode.
3. What do you understand by local variable and global variable? State the scope and
lifetime of local and global variables in detail with appropriate examples.
4. Draw a flow chart for the following C++ code.
int main()
{
if (2 > 15)
cout<<"Test \n";
elseif (5 > 3)
cout<<"Test1";
cout<<"Test2";
return 0;
}
5. What will be the output of the following code segment?
#include<iostream>
using namespace std;
int main()
{
int mon=3, day=8;
if (mon > 4)
if (day < 15)
cout<<"Late";
else
cout<<"Early";
}
return 0;
6. Write a C++ or JAVA program that takes three positive integers from the user and prints
true if any one of them is greater than or equal to the sum of the other two otherwise
prints false.
7. Your aunt runs a business selling knives. She hires door-to-door salespeople in her
business and has created a system of pay to give the salespeople great incentives for
excellent performance. In particular, the following chart shows how much each
salesperson gets paid per sale, depending on how many sales he or she has made in the
month.
a. Number of Knives Sold Pay
b. Less than or equal to 100 Rs. 5
c. In between 101 and 200 Rs. 10
d. More than 200 Rs. 15
e. Your aunt has asked you to write a C++ or JAVA program that asks the
salesperson how many knives they sold for the month and prints out how much
he gets paid for the month.
8. Draw a flow chart for the following C++ code.
int main()
{
if (10 > 15)
cout<< "Test \n";
if(5 > 3)
cout<<"Test1";
return 0;
}
9. Write a C++ or JAVA program to generate a student’s mark sheet. Generate student’s
results (A.T.K.T, PASS, FAIL) and class. Assume that there are 5 subjects in the
semester and the passing percentage is 40. If he/she fails in 1 or 2 subjects he/she will
get the result as an ATKT otherwise if he/she fails in a greater or equal to 3 subjects
then he/she will get the result as a FAIL otherwise he/she PASS. If he/the result is PASS
then display their Class. The class will be decided on the basis of percentage and class
criteria are as given below.
Percentage Class
Grater than 70 Distinction
Between 60 to 70 First
Between 50 to 60 Second
Between 40 to 50 Pass
Note: Assume that user will enter marks in positive numbers and not more than 100.
10. Explain any three forms of if statement using a flowchart and examples.
11. Explain Nested If –else statement with its syntax, flowchart and example.
12. Explain Else-if ladder with its syntax, flowchart and example.
13. Explain switch-case statement with its syntax, flowchart and example.
14. Explain ? : operator with an example.
Unit 3
1. What is a counter-controlled loop and a sentinel-controlled loop? Explain it with an
example.
2. Explain exit controlled loop (Posttest loop) and entry controlled loop(Pretest loop) with
an example.
3. Explain a nested loop.
4. Write a C++ or Java program to find the sum of all integers greater than 100 & less than
200 and are divisible by 5.
5. Write the difference between while and do..while loop statements. Write a C++ or
JAVA program to reverse numbers.
6. Write C++ or Java program to check whether the entered number is prime or not.
7. Find out errors from the following C++ code.
#include <iostream>
int main()
{
int i=1;
while( )
{
cout<<i++;
}
return 0;
}
8. Write a program to input a four-digit positive integer number from the user and do sum
of all digits till the number is converted to a single digit. For example, if a number that
is inputted is 2531, then the output will be 2 (2531= 2+5+3+1=11, 11=1+1=2).
9. Explain any one loop statement with an example and flowchart?
10. What do you mean by infinite loop?
11. What is the break statement? What is the difference between the break and return
statement? Demonstrate break statement with for loop statement.
12. Write any two-point of difference between while and do..while loop statement.
13. Write a C++ or JAVA program to accept and find the maximum from N positive
integer numbers only.
14. Write a C++ or java program to find the sum of the first ten odd numbers.
15. Write a C++ or java program to find the factorial of a given number.
16. Explain the break with an example.
17. Explain multilevel break with an example.
18. Write a C++ or JAVA program to generate a triangle as shown below for n = 5. The
program should take the input from the user.
1
22
333
4444
55555
19. Write a C++ or JAVA program to generate a triangle as shown below for n = 5. The
program should take the input from the user.
1
33
555
7777
99999
20. Write a C++ or JAVA program to generate a triangle as shown below for n = 5. The
program should take the input from the user.
A
BC
DEF
GHIJ
KLMNO
21. Write a C++ or JAVA program to generate a triangle as shown below for n = 5. The
program should take the input from the user.
A
11
BBB
2222
CCCCC
22. Write a C++ or JAVA program to generate the first N term of the following series.
3 4.5 6 7.5 9 10.5 …….

You might also like