Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer

Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer, Computer Science Class 9 Solutions, NCERT Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer for each chapter is provided in the list so that you can easily browse throughout different chapters SCERT Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer and select needs one.

Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer

Join Telegram channel

Also, you can read the SCERT book online in these sections Solutions by Expert Teachers as per SCERT (CBSE) Book guidelines. NCERT Solution of Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer is part of AHSEC All Subject Solutions. Here we have given Class 9 Computer Science Chapter 8 Introduction to C Programming Question Answer Notes for All Subjects, You can practice these here in SEBA Class 9 Computer Science.

Introduction to C Programming

Chapter – 8

COMPUTER SCIENCE

TEXTUAL QUESTIONS AND ANSWERS

OBJECTIVE TYPE QUESTIONS

1. Fill in the blanks.

(a) C is the only high-level programming language ____.

Ans. TRUE.

(b) IDE stands for____.

Ans. integrated development environments.

(c) We always need a very powerful computer to run C program _____.

Ans. FALSE.

(d) Every statement in a C program has to end with _____.

Ans. semi-colon.

(e) Execution of a program starts from ____.

Ans. main ().

DESCRIPTIVE TYPE QUESTIONS

2. Short answer questions.

1. While writing a computer program, what does a programmer need to assume about the CPU and storage?

Ans. While writing a computer program, a programmer needs to make certain assumptions about the CPU and storage to ensure that the program works correctly and efficiently. 

These assumptions are typically based on the architecture and capabilities of the target computer or system.

2. Do we always need Codeblock to write C programs? Explain.

Ans. No, we don’t always need Codeblock to write C programs.

Once you got a strong hold to compile and execute C programs using a command line, it’s time to switch to IDE. However, I always recommend a beginner to use command prompt for sometime for compiling and executing C programs. CodeBlocks is a powerful IDE for creating, compiling, executing and debugging C/C++ programs.

3. Why do we need header files? Name a few standard header files in C.

Ans. It helps to reduce the complexity and number of lines of code. It also gives you the benefit of reusing the functions that are declared in header files to different.

A few standard header files in C are 

  • stdio.h
  • stdlib.h
  • math.h
  • string.h.

3. Long answer questions.

1. Explain the process of compilation of a C program. When we save a C program with the name Namaskar.c, what files will be created at each step of compilation?

Ans. The compilation Preprocess can be divided into four steps –

(1) Preprocessor: Preprocessing is the first stage in the compilation process in the C program. 

This phase includes:

  • Removal of Comments
  • Expansion of Macros
  • Expansion of the included files.
  • Conditional compilation.

(2) Compiler: The code which is expanded by the preprocessor is passed to the compiler. The compiler converts this code into assembly code. If the source file name is Namaskar.c, then this step produces output as Namaskar.i.

(3) Assembler: In this phase, the Namaskar.c is taken as input and turned into Namaskar.c by the assembler. This file contains machine-level instructions. At this phase, only existing code is converted into machine language, and the function calls like printf() are not resolved. 

(4) Linker: At this step, different object files are linked if one object file requires to use of another object file for its execution. Finally, we get an executable file Namaskar.exe as output from the source file that we wrote.

2. Can we compile an erroneous code in C? If we do not write the function main() in our C program, will it compiler successfully?

Ans. No, we cannot Compiler an erroneous code in C. The Compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by compiler and thus are known as compile-time errors.

No, C program will not Compile successfully, if we do not write the function main() in our C program. The execution of any program starts from a special function main(). All C programs mush have this function.

3. What is a programmer’s view of memory? Is it different from actual memory? Explain briefly.

Ans. According to the programmer’s view of memory – 

(1) The programmer is always sure about the calculation or processing element. 

(2) The program must be sure about the huge and sufficient memory storage to store the data.

Yes, a programmer’s view of memory is different from actual memory. 

Many complex things happen when the CPU communicates with memory and when it executes the instructions.

4. Programming assignments : (I will be giving these programs handwritten).

1. Write and execute a C program to print your name.

Ans. Program

#include

int main()

{

printf ("Dev Library is an Assam No. 1 Education Website");

return 0;

}

Output

Dev Library is an Assam No. 1 Education Website

2. Write and execute a C program to print your name and your mother’s name in two different lines but using a single printf.

Ans. The program

#include

int main()

{

printf ("Dev Library is an Assam No. 1 Education Website\n All Class Notes are Available");

return 0;

}

Output

Dev Library is an Assam No. 1 Education Website

All Class Notes are Available

3. Write and execute a C program to print the sentence “I am from Assam. I am a responsible citizen of my country.” Five time.

Ans. Program 

#include

int main()

{

printf ("Dev Library is an Assam No. 1 Education Website.");

printf ("\n Dev Library is an Assam No. 1 Education Website.");

printf("\n Dev Library is an Assam No. 1 Education Website.");

printf("\n Dev Library is an Assam No. 1 Education Website.");

printf("\n Dev Library is an Assam No. 1 Education Website.");

return 0;

}

Output

Dev Library is an Assam No. 1 Education Website.

Dev Library is an Assam No. 1 Education Website.

Dev Library is an Assam No. 1 Education Website.

Dev Library is an Assam No. 1 Education Website.

Dev Library is an Assam No. 1 Education Website.

4. Remove the semicolons (;) from the C program of the previous question. Compile the program and check the errors. Note the line numbers and then rectify them.

Ans. If we remove the semicolon (;) from the previous question then the error is as follows

Output

Line Message

Build file: “no target” in “no project” (compiler: unknown)

Error; expected ‘:’ before ‘return’

5. Write and execute a C program to print your name in the order Last name First name. But you will pass them in First name Last name order inside printf [Hint : use proper escape sequence].

Ans. Program

#include<stdio.h>

Int main()

{

printf("\t\t First Name \r Last Name");

return 0;

}

Output 

Last Name    First Name

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top