Test Your Knowledge (Ch 1)

The following questions are based on what we have learned so far in Chapter 1 – Introduction to C programming. To test your understanding, try answering the following questions. The explanations are also provided to each question so you can always check the correctness of your answers. All the best 👍


Question 1

Why do we need a programming language?

To communicate with humans
To communicate with computers
To send a letter to girlfriend
None of the above
explanation

programming language helps humans to communicate with computers effectively so that the computers can understand the task we want them to perform.

Question 2

Is C++ a C based programming language?

Yes
No
explanation

Yes. C++ and many other programming languages like Perl, C#, Java are all C based programming languages and therefore, this is one of the core reasons why everyone should learn C to solidify the concepts of programming in general.

Question 3

State True or False. 
The Unix Operating System was originally developed using C language, but later it is re-written in assembly language.

True
False
explanation

False. The opposite is true. The Unix operating system was originally developed using assembly language, but later it is re-written in C language.

Question 4

What is stdio.h?

a header file
an executable file
There is no file in the world with .h extension
a hypertext file
explanation

stdio.h is a header file because any filename that ends with “.h” is called header file in C.

Question 5

What is the difference between predefined and user defined functions? 

Predefined functions are defined by users and user defined functions are defined by programmers
Predefined functions are already defined for us by someone and user defined functions are defined by us (the programmers)
Predefined functions are defined by aliens and user defined functions are defined by humans
None of the above
explanation

Predefined functions are already defined for us and are ready to use like printf, scanf, etc. On the other hand, user-defined functions, as the name suggests, are defined by us (the programmers).

Question 6

Is printf() function a predefined function?

Yes
No
explanation

printf() function is a predefined function as it is already defined by someone and makes it available to us so that we can directly use it in our programs.

Question 7

printf stands for

Print Fast
Play Forward
Print the Formula
Print Formatted
explanation

printf stands for print formatted.

Question 8

return 0 at the end of the main() function indicates

Successful execution of main()
Unsuccessful execution of main()
Doesn’t mean anything
0 means nothing and hence return 0 means return nothing
explanation

putting return 0 at the end of the main() function is the way to indicate that the main() function, and hence the program, has executed successfully. It is the standard practice.

Question 9

Determine the output of the following program:

#include <stdio.h>

int main() {
    printf(“Hello User.”);
    return 0; 
}
Hello User
Hello User.
“Hello User.”
Nothing will be printed
explanation

printf() function is used to print the string provided as an input to it. In this case, the string “Hello User.” is provided as an input, but printf function will not output the string with double-quotes. Only the characters within double-quotes will be printed. Hence, the output of the above program is Hello User.

Question 10

What is a compiler?

It is a software program written to convert C code to machine code
It is a software program written to convert humans to aliens
It is a piece of hardware in computer
None of the above
explanation

Compiler is a software program written to convert C code to machine code.

Your score is out of



Leave a comment

Leave a comment

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

Thank you for choosing to leave a comment. Please be aware that all comments are moderated in accordance with our policy. For more information, please review our comments policy. Rest assured that your email address will not be shared with anyone. Kindly refrain from using keywords in your comment. Let’s maintain a respectful atmosphere and engage in meaningful conversations.