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

UNIT 1 Questions

Uploaded by

sanjaynova2006
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)
22 views

UNIT 1 Questions

Uploaded by

sanjaynova2006
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/ 7

UNIT-I

1.What is the consequence of semantic errors in a program?

a) The program won't compile at all.

b) The program runs, but produces incorrect results.

c) The program produces syntax errors.

d) The program executes without any output.

2.In which phase is the program converted from source code


to machine code?

a) Debugging

b) Preprocessing

c) Compilation

d) Execution

3.Which phase involves finding and fixing errors in the code?


a) Compilation
b) Debugging
c) Design
d) Execution

4.Which of the following is a primitive data type in Java?


a) String
b) Array
c) int
d) class

5.Which keyword is used to declare a constant in Java?


a) final
b) static
c) const
d) public

6.What is the correct data type for storing a single character?


a) int
b) char
c) string
d) bool
7.Which of the following is a valid primitive data type in C?
a) boolean
b) float
c) String
d) object
Answere: b) float
8.Which of the following is a valid declaration in C?
a) int 1var;
b) int var1;
c) int $var;
d) int float;
Answer: b) int var1;
9.What is the correct way to declare a constant in C?
a) const int x = 10;
b) #define x 10
c) int const x = 10;
d) All of the above
Answer: d) All of the above
10.Type conversion from a higher data type to a lower data
type in C is called?
a) Upcasting
b) Widening
c) Implicit
d) Type casting
Answer: d) Type casting

11.Who is considered the father of the C programming


language?

a) James Gosling

b) Bjarne Stroustrup

c) Dennis Ritchie

d) Ken Thompson
Answer: c) Dennis Ritchie

12.Which of the following symbols is used to represent a


decision in a flowchart?

a) Rectangle

b) Diamond

c) Oval

d) Parallelogram
Answer: b) Diamond

13.Which of the following is a valid variable name in C?

a) 123name

b) _value

c) float

d) my-name

Answer: b) _value

14.Which of these is NOT an arithmetic operator in C?

a) +

b) %

c) =

d) *

Answer: c) =

15.What is the first step in problem-solving using


programming?

a) Coding the solution

b) Debugging the program

c) Writing the algorithm

d) Testing the program

Answer: c) Writing the algorithm

16.Which of the following is an example of a constant?


a) int x;
b) float y = 3.14;
c) char z;
d) const int PI = 3;
Answer: d) const int PI = 3;
17.What does the term "memory allocation" refer to in
programming?
a) Using a constant value
b) Reserving space in memory for data
c) Creating a flowchart
d) Writing pseudocode
Answer: b) Reserving space in memory for data
18.In which phase are syntax errors detected?
a) Preprocessing
b) Compilation
c) Linking
d) Execution

19.Which file is typically generated after the compilation


phase?
a) .c file
b) .h file
c) .o file
d) .exe file

20.Which of the following is an example of a semantic error?


a) Missing a semicolon
b) Using an undeclared variable
c) Assigning a value of the wrong type to a variable
d) Forgetting to include a header file

2marks

1. Define Algorithm

2. Define Flowchart

3. Define Pseudo Code


4. Draw the flowchart for finding the greatest of two numbers

5. What are the rules to be followed in naming an identifier in C


language

6.
Define Preprocessing Stage.
7. Differentiate Syntax Error and Semantic Error.
8.
Give some examples of common Semantic Errors in C.

9. int a = 10, b = 20; int result = a + b * 2; // Expected (a + b) * 2,


Analyse the code and give reason about errors.
10.
List the phases in developing C program.
11.
What is the difference between char and int in C?
12.
Explain different types of constants in C?
13.
What are primitive data types in C? List a few examples.
14.
What is the difference between constants and variables in C?
15. Explain the difference between implicit and explicit type conversion in
C.
16 What is memory in programming, and how are values stored in
memory?
17
What is the role of an instruction in a program?
18
Describe the role of a compiler in the programming process.
19
What are keywords in C? Why are they important?
20
Write an algorithm to check a number is prime or not.

10 mark:

1. Differentiate between syntax errors and semantic errors in C


programming with appropriate examples. Explain how each type of
error is detected by the compiler and describe how they affect the
execution of a program.
2. Explain in detail about Developing Phases in C program.
3. Explain the character set used in C, and describe its importance in
programming.
4. Explain the different primitive data types in C with their size,
default values, and usage.
5. Explain type conversion in C with examples. Discuss the difference
between implicit and explicit conversion, and the potential issues
with each.
6. Explain the various Symbols Used in a Flowchart with a complete
flowchart to find the sum of two numbers
7. a) Differentiate primary memory and secondary memory
b) What are the advantages of writing an algorithm
8. Compare and contrast algorithms, flowcharts, and pseudocode with
suitable examples. When should each be used?
9. a) Write an algorithm to find the area and circumference circle
b) Write a Pseudocode to find the area of a triangle
10. Describe the complete compilation process of a C program,

detailing in each phase.

You might also like