INTRODUCTION TO C CLASS IX



      SEBA 
      CLASS- 9
      CHAPTER-14
       INTRODUCTION TO C 

      Note: The star ì mark contained question specify that they are most likely to come in examination and very important. But I suggest you to read all the questions that I post on my site.


      OBJECTIVE TYPE QUESTIONS:

      1. Fill in the blanks:

      a) C programming language was developed by Dennis Ritchie

      b) C language has the feature of Basic Combined Programing Language.

      c) The line beginning with a # (hash) sign is called a preprocessor.

      d) The Comment statements are ignored by the compiler.

      e) The compiler uses different colors to display code. This is called syntax highlighting.

      f) The file extension of C program is .c.

      g) The comment statements start with ‘/*’ and ends with ‘*/’.

      h) The compiler/interpreter translates a program into a form that computer understands.

      i) The statements inside the intmain() function are enclosed within a pair of { } curly Braces.

      j) A statement in C is terminate with a Semicolon;

      printf() is a standard output function declared inside <stdio.h> header file.

      printf() means print formatted text to the standard output.

      scanf() stand for scan formatted string.




    Table of Content

    2. Write True or False:

    a) You can write the entire C program in one line. False

    b) A colon(:) is used to mark the end of a C statement. FALSE

    c) A multi-line comment begins with //. FALSE

    d) The line beginning with’#’ is called pre-processor or directive. FALSE

    e) The main function is the point from where all C programs starts their execution. TRUE

    f) The default extension of a C program file is .bak. FALSE

    g) The statement return0; means that program worked as exception without any error during execution. TRUE

    h) The body of the main function is enclosed in a pair of parentheses (). FALSE

    i) The file stdio.h includes the declaration of the basic standard input-output functions.

    j) Turbo C++ for windows provides an integrated development environment for writing, editing, compiling, and running programs in C and C++. TRUE

    You can write the entire main function in one line. TRUE

       A semi colon(;) is used to mark the end of a C statement.

       A multi-line comment begins with /* and ends with */. TRUE

    The line begins with ‘#’ is called pre-processor directive. TRUE

    The default extension of a C program file is .CPP. TRUE

    The body of the main function is enclosed in a pair of curly braces {}. TRUE

    Every statement in C program must ends with semicolon. TRUE

    3. Choose the correct option:

    a) the extension of C program is .c

    b) The feature of Turbo C++ that uses different colors to display code is. Syntax highlighting

    c) The options in the file menu are. Save as

    d) The line that marks the beginning of the main function is intmain().

    e) The symbol used to mark the end of a C statements is ;(semi colon)

    f) The function used in C to display the output is printf()

    g) Comments in C are marked by /* …….*/

    h) The statements of the main function are enclosed within {} (curly braces).

    i) The last statement of the main function is return0:

    j) The Symbol at the beginning of the pre-processor directive is # (hash sign).


    Table of Content

    DESCRIPTIVE TYPE QUESTIONS

    1. Short answer questions:

    a) Who developed C programming language?

    C programming was developed by Dennis Ritchie of USA in 1972 at AT & T Bell laboratories.

    b) From which earlier language C language been derived?

    The C program language has been derived from Basic Combined Programing Language (BCPL). It is also called B language.

    C) What is comment statement?

    A comment is a non-executable code or a part of a source code ignore by the compiler. It is a statement where the programmer places a remark or include a short explanation within the source code for better understanding.

    d) What is the advantage of writing a single line statement in each line?

    The advantage of writing a single line statement in each line is that it makes a program more readable and error finding become easier.

    e) Which function is used to print a message in a C program?

    The printf() function is used to print message in a C program.

    f) What does the pre-processor directive #include <stdio.h> do?

    The pre-processor directive #include<stdio.h> tell the compiler to include the content of <stdio.h> file  with the source code which include the declaration of the basic standard input-output function such as printf(), scanf() etc.

    g) Why is the main() function so important?

    The main() function is so important because it is here the main function start as it is the entry point for every C program. There should be only one line for only one main() function in C program.

    OR (You can also write)

    The main() function is so important because it serves as the starting point for program execution of a C program. The word main is followed by pairs of () parentheses.

    h) Which statement is used to end the C program?

    return0; statement is used to end a C program.

    i) What is syntax highlighting?

    Syntax highlighting is the feature in Turbo C++ that uses different colors to display code.

    j) What is the extension of C program file?

    The extension of a C program file is .c and .cpp. any one you can use.

     

    2. Long answer question:

    a) What do you mean by comment statement in a C program? Explain with an example.

    Comment statements in a C program are the statements used by the programmers to include short explanation within the source code for better readability of the program. Comment are statement that are not executed by the compiler and interpreter. Example single line comment represent as // double forward slash. It is used to denote a single line comment. It applies comment to a single line only. Where as multi line comment represented by /* any…text */ star with forward slash and asterisk and ends with asterisk and forward slash. It is used to denote multi line comments.

    b) Why are programs compiled?

    Program are compiled so that it can transform a program written in high-level programing language from the source code into object code and passes the source code through a compiler, which translate the high-level language instruction into abject code.

    c) Write the steps to print C program on a printer.

    d) What is the purpose of the statement return0;?

    Note: You shall write the answer according to the marks of question comes in exams.

    The return0; statements cause the main function to ends. Here, the function main returns and integer value that is 0. It indicates that our program has been run successfully and we terminate our main function with this return0; statement.

    OR

    The purpose of the statement return0; is that it return an integer value therefore here we are returning 0. return is a keyword which is used to return some value from a function. It indicate that our program has been run successfully and we terminate our main function with this return0; statement.

    OR

    The purpose of the statement return0; statements is to end the main function without any error during execution.

    e) Which C statement would you use to print the Phrase “HelloWorld”?

    Note: You shall write the answer according to the marks of question comes in exams.

    We will use the printf() statement to print the phrase “HelloWorld”.

    OR

    We will use the printf() statement to print the phrase “HelloWorld”. Example

    Intmain()

    {

    printf(“HelloWorld”);

    return0;

    }

    f) What happen if you include comment within the source code of program without using the comment characters combination /* and */?

    If we include comment within the source code of a program without using the comment characters combination /* and */, the compiler will take them as if they were C++ instruction and most, likely causing one or several errors messages.

    g) Which statement marks the beginning of the main function?

    OR

    Which statement marks the beginning of the main function? Why? Give reason

    Note: You shall write the answer according to the marks of question comes in exams.

    The intmain() statement marks the beginning of the main function.

    OR

    The intmain() statement marks the beginning of the main function because it is the entry point of every C program where the execution of C program starts. For this reason, all C programs must have a main function that must be followed by the pair of parentheses () as it is a function declaration.

    h) Which menu has a compiles option?

    The compile menu has the compile options.

    i) Which menu has the Run option?

    The Run menu has the Run option.

    j) How will you quite Turbo C++ IDE?

    We will use the ways that are given below to quit the Turbo C++ IDE:

    1. Click on the close button that appears on the upper right corner of the Turbo C++ window or

    2. You can select the file menu, then click quit. or

    3. Press Alt +X key together.

    Table of Content

    ADDITIONAL QUESTION & ANSWER

    What is the first programing language?

    The first programing language is Basic Combined Programing Language (BCPL).

    Who developed the C programming language?

    Dennis Ritchie and Brain Kernighan developed C programing language.

    In which language the UNIX operating system was coded?

    The UNIX operating system was coded in C language.

    What is the work of Compiler/interpreter?

    Compiler/Interpreter work is to convert source code to object code.

    What is an Integrated Development Environment (IDE)?

    The platform by which writing, editing, compiling and running a program in C language is done using the software called IDE Integrated Development Environment.

    What is pre-processor directive? What is its use?

    A line begins with # hash sign is such as #define, #iclude etc., are called Pre- processor directive.

    It is typically used to make source code programs easy to change and easy to compile in different execution environments. Directive in the source file tell the pre-processor to take specific actions.

    What is include in the file stdio.h?

    The file stdio.h include the declaration of the basic standard input-output function as printf(0, scanf(),and return0; etc. so that it can used in the program.

    What do you mean by return0; statement in C program?

    The return0; statement in C program where the return statement is followed by a return integer 0 zero means that the program worked as expected without any error during its execution.

    What is printf() function? Why it is use? What type of character it accepts? Give example.

    printf() function is a standard output function. It is responsible for displaying some text on the console. It accepts sequence of characters enclosed in double quotation (“”).

    Example: 

    printf(“HelloWorld”); 

    C program is consisted of how many parts?

    A C program is basically consisted of the following parts:

    1. Pre-processor or Directive

    2. Function: Entry point of C program.

    3. Comments:

    4. Variables

    5. Statement & Expression


    Table of Content