Skip to main content

C language question Bank

Short Questions:
1:
Variables:
A variable in simple terms is a storage place which has some memory allocated to it. Basically, a variable used to store some form of data. Different types of variables require different amounts of memory, and have some specific set of operations which can be applied on them.
Constants:
Constants in C are the fixed values that are used in a program, and its value remains the same during the entire execution of the program.

2:
High Level Language:
A high-level language (HLL) is a programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages.

3:
Low Level Language:
A low-level language is a type of programming language that contains basic instructions recognized by a computer. Unlike high-level languages used by software developers, low-level code is often cryptic and not human-readable. Two common types of low-level programming languages are assembly language and machine language.

4:
Assembly language:
An assembly language is a low-level programming language for microprocessors and other programmable devices. It is not just a single language, but rather a group of languages. An assembly language implements a symbolic representation of the machine code needed to program a given CPU architecture.

5:
Flowchart:
Graphical representation of an algorithm or a computer program is known as flowchart.

6:
Algorithm with example:
An algorithm is a step-by-step demonstration of data processing or problem solving.
Example:
Write an algorithm to add two numbers entered by user.
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
        sum←num1+num2
Step 5: Display sum
Step 6: Stop
7:
Draw flowchart symbol for Input / Output:





[Input / Output symbol]

8:
Draw flowchart symbol for decision:






[decision symbol]

9:
Operator:
An operator is a symbol that tells the compiler to perform specific mathematical or logical functions.

10:
List relational operator:
Relational operators are used in decision making and loops.

Operator Meaning of Operator Example
== Equal to 5 == 3 is evaluated to 0
> Greater than 5 > 3 is evaluated to 1
< Less than 5 < 3 is evaluated to 0
!= Not equal to 5 != 3 is evaluated to 1
>= Greater than or equal to 5 >= 3 is evaluated to 1
<= Less than or equal to 5 <= 3 is evaluated to 0







11:
List logical operator:
Logical operators are commonly used in decision making in C programming.
Operator Meaning Example
&& Logical AND. True only if all operands are true If c = 5 and d = 2 then, expression ((c==5) && (d>5)) equals to 0.
|| Logical OR. True only if either one operand is true If c = 5 and d = 2 then, expression ((c==5) || (d>5)) equals to 1.
! Logical NOT. True only if the operand is 0 If c = 5 then, expression !(c==5) equals to 0.

12:
printf() syntax:
printf(“*formatted string [optional]placeholders”[if placeholder is used], variable);

13:
scanf() syntax:
scanf(“placeholder”, &variable);

14:
We can use @ special character as variable name.
False.

15: Dennis Ritchie invented C language.

16:
C is Higher Level Language.
True.

17:
Data Type:
Data type is a storage format which has specific size or range of values.

18:
Use of == opetrator:
Relational operator == checks if two operands are equal or not. If the relation is true, it returns 1; if the relation is false, it returns value 0.

19:
4 Keywords used in C langusge:
1: int
2: float
3: char
4: for



20:
Token:
C tokens are the basic buildings blocks in C language which are constructed together to write a C program. Each and every smallest individual units in a C program are known as C tokens.

21:
Data types in C language.
int
float
char
double

22:
What is #include<stdio.h>
Header file

23:
Use of void main().
void before main() is nothing but indicating the return type of the main() function. void means the function return nothing. main is predefined function from which execution of program get started.



24:
Every C statements ends with ;
True.

25:
Array:
An array is a collection of data items, all of the same type, accessed using a common name.

26:
string:
A string in C is an array of characters.

27:
What are 2 Dimensional arrays?
Like a 1D array, a 2D array is a collection of data cells, all of the same type, which can be given a single name. However, a 2D array is organized as a matrix with a number of rows and columns.
28:
Syntax of if statement:
if(condition)
{
//statemetns
}
29:
Syntax of if else statement:
if(condition)
{
//statemetns
}
else
{
//statemetns
}


30:
Example of switch-case:
Following program illustrates the use of switch-case:
#include <stdio.h>
void main()
{
int num = 1;
switch (num)
{
case 1:
printf("Value is 1");
break;
case 2:
printf("Value is 2");
break;
case 3:
printf("Value is 3");
break;
default:
printf("Out of range");
break;
        }
    }
Output:
Value is 1


31:
Declare array of size 10.
Syntax for size of 10.
DataType arrayName[10];
example:
int a[10];
float f[10]
char c[10];

32:
Array elements starts from 0.
True.



33:
Array can be multidimensional.
True.

34:
Declare 1 dimensional array.
Syntax:
DataType arrayname[size];
Example:
int a[10];
35:
Declare 2 dimensional array.
Syntax:
DataType arrayname[size][size];
Example:
int a[3][3];

36:
How to initialize string?
Syntax: char string_name[string_length] = "string";

Example: char name[20] = “Soyab Sama”;


37:
What is entry controlled in loop?
An entry controlled loop is a type of loop in which the condition is checked first and then after the loop body executed.

38:
What is exit controlled in loop?
An entry controlled loop is a type of loop in which the loop body executed first and then after the condition is checked.

39:
Do-while is entry controlled loop.
False.

40:
Do-while is exit controlled loop.

41:
Syntax of for loop.
for ( init; condition; increment / decrement )
{
   statement(s);
}


Comments

Popular posts from this blog

Gujarati Keyboard layout (terafont-varun), Computer Short cut key, Tally short cut key

Word , Excel , Power Point Shortcut Key in Gujarati

Terafont-Varun (Gujarati Typing) Keyboard Layout by "Sama Soyab"

  For Gujarati Typing : Required : Terafont-Varun Font  After Successfully Installed Terafont Varun Open Any Text Editor or any program. Select Font Terafont-Varun -> Ok For more detail please watch below video. Search Topics : Learn terafont varun, Learn terafont chandan, Learn terafont gujarati to english translation, Learn terafont varun keyboard, Learn terafont converter, Learn terafont varun zip, Learn terafont keyboard, Learn terafont kinnari, Learn terafont akash, Learn terafont aakash, Learn terafont akash ttf, Learn terafont aakash gujarati download, Learn terafont akash keyboard, Learn terafont akash download for windows 10, Learn terafont akash font download, Learn terafont arun, Learn terafont border, Learn terafont chandan keyboard, Learn terafont-chandan font, Learn tera font chandana, Learn convert terafont to shruti, Learn convert terafont varun to shruti, Learn terafont varun chart, Learn terafont download, Learn terafont download for windows 10, Learn tera...