Tuesday, August 11, 2020

UGC NET Questions Based on C Language || Interview Questions Based On C Language

 

C INTERVIEWS QUESTIONS

 

1.                 What's the C language?

2.                 Who has developed C language?

3.                 Describe the history of the C programming language.

4.                 Where is the C programming language used or the C language used?

5.                 What's the difference between C and C++?

6.                 What is the compared to the top-down approach and the bottom-up approach in programming languages?

7.                 Difference between Java and C?

8.                 C language was developed in which language?

9.                 Which year C language has been developed?

10.            What does programming language mean and give some examples?

11.            Describe the C standards.

12.            What are the key features of the C-language or the characteristics of the C-language?

13.            What's C embedded in it?

14.            Which level does the C language belong to?

15.            What do you mean by high-level, middle-level and low-level languages and give each of them an example?

16.            What is the difference between structured, object-oriented, and non-structure-oriented programming language?

17.            What's the compiler?

18.            What's the difference between the assembler, the compiler, and the interpreter?

19.            What is printf()?

20.            What is scanf()?

21.            What does the protocol mean?

22.            The execution of the C program starts with which function?

23.            What are all the sections that the C program can and must-have?

24.            What's the IDE?

25.            Please list some of the C compilers.

26.            What is the C-language header file?

27.            Is the case of C language-sensitive?

28.            What's the macro? Why are we using a macro?

29.            What is the type of data in C?

30.            What is the difference between the type of int, char, float, and double data?

31.            What's the use of the sizeof() function in C?

32.            What's the change in C?

33.            What are the different types of C modifiers?

34.            What's the Enum in C?

35.            What's the void in C?

36.            What's a C token?

37.            What kind of C tokens are there?

38.            What's a C identifier?

39.            What's the keyword in C?

40.            List some of the keywords available in the C language.

41.            What's the constant in C?

42.            What are the constant types in C?

43.            What's the variable in C?

44.            What is the difference in C between constant and variable?

45.            Can the name of the variable start with numbers?

46.            What is the difference between the declaration of variable and the definition of a variable in C?

47.            What are the different variable types in C?

48.            What's the local variable in C?

49.            What's the global variable in C?

50.            What is the C environment variable?

51.            What's the operator in C?

52.            What are the different types of C operators?

53.            What is the syntax for the C ternary operator?

54.            What is the C arithmetic operator?

55.            What's the assignment operator in C?

56.            What is the C relational operator?

57.            What's the logical C operator?

58.            What's the C bitwise operator?

59.            What are the decision control statements in C?

60.            What are the loop control statements in C?

61.            What's the difference between while and do-while loops in C?

62.            What is the difference between a single equal "=" and a double equal "= =" operator in C?

63.            What is the difference between the post-increment operator and pre-increment operator?

64.            What is the difference between a post-decrement operator and a pre-decrement operator?

65.            Explain the "*" and "&" operators in C?

66.            What happens if the break statement is not used in the C switch case?

67.            Why is the default statement used in the C switch case?

68.            What is the "goto" statement?

69.            What value is assigned to the variable X if a = 10, b = 20, c = 30, d = 40 for the expression X = a / b+c*d-c?

70.            What is the value assigned to the variables below? int X1 = 13/3; int X2 = 13%3;

71.            What is the difference between the auto variable and the C registry variable?

72.            What's the difference between the auto variable and the static variable in C?

73.            Where is the typecast function not to be used in C?

74.            How many arguments can be passed to the C function?

75.            What's the static function in C?

76.            If you want to run the C program even after the main function is finished, which function can be used?

77.            Is it possible to call atexit() more than once in a C program?

78.            What's the exit() function in C?

79.            Difference between exit() and return() in C?

80.            What is the use of "# define" in C?

81.            What is the syntax of the comments in C?

82.            What's the "# #" operator in C?

83.            What's the C pragma? Or how are you going to perform functions before and after the main function in the C program?

84.            How are you going to override the existing macro in C?

85.            How to check whether or not the macro is defined in the C program?

86.            What's the difference between memcpy() and strcpy() functions in C?

87.            What's the difference between memcpy() and memmove() functions in C?

88.            Is there any built-in library function in C to remove the leading and trailing spaces from the string? How are you going to remove them in C?

89.            What is the difference between the functions of strcpy() and strncpy() in C?

90.            Can array subscriptions have a negative value in C?

91.            What's the difference between the array and the C string?

92.            What's the pointer in C?

93.            What are the zero pointers in C?

94.            What's the NULL in C?

95.            What's the void pointer in C?

96.            What's the dangling pointer in C?

97.            What's the wild pointer in C?

98.            What's the C file pointer?

99.            When can the void pointer and the zero pointers be used in C?

100.       What's a C const pointer?

101.       Is the arithmetic pointer a valid one? Which arithmetic operation should not be valid in the pointer? Why?

102.       Is void arithmetic a valid pointer? Why?

103.       What's the difference between zero and Null?

104.       What is the difference between the zero pointers and the uninitialized pointer in C?

105.       Can the size of the array be declared at run time?

106.       What's a memory leak in C?

107.       What's going to happen when we try to access the zero pointers in C?

108.       What does segmentation fault or memory fault mean in C?

109.       What does the core dump in C mean?

110.       Can a pointer be freed in C more than once? What happens if we do it? Or can a pointer be set free twice in C?

111.       What's the size of the int pointer and the char pointer in C?

112.       How are you going to print the value and address of the pointer variable (example int * ptr) in C?

113.       How are you going to print the value and address of the normal variable (example int ptr) in C?

114.       What are the functions of the library and their use in the C language? Can we write our own features and include them in the C library?

115.       Can the variable name start with the underscore in C?

116.       Can the name of the variable have special symbols in C?

117.       What's the inline function in C?

118.       Is it possible to print "Hello World" in C without a semicolon? How is that?

119.       What is the scope of the local, global, and environmental variables in C?

120.       Why do we use C pointers?

121.       What's the static variable in C?

122.       What is the external and static function in C?

123.       What's the difference between the pointer and the array in C?

124.       Can variables in C be both volatile and constant?

125.       What is the main() function used in C?

 

 


Tuesday, August 4, 2020

Constants Or Literals In C language || Literals in programming Language || Computer Language

C Literals or Constants

 



A constant is a named memory location that holds only one value throughout the execution of the program.

In C programming language, the constant is similar to the variable, but the constant only holds one value during the execution of the program. This means that once a value is assigned to a constant, that value can not be changed during the execution of the program. Once the value is assigned to the constant, the value is fixed throughout the program. A constant can be defined as follows:

 

Type of C Constants

 

Numeric Constants

Integer Constant

An integer constant may be a decimal integer or an octal integer or a hexadecimal integer. The decimal integer value is specified as the direct integer value, while the octal integer value is prefixed with 'o', and the hexadecimal value is prefixed with 'OX.'

 

An integer constant may also be an unsigned type of integer constant or a long type of integer constant. The unsigned integer constant value is suffixed with 'u' and the long integer constant value is suffixed with 'l' while the unsigned long integer constant value is suffixed with 'ul.'

  

Integer Constants are following type:

Decimal --> 123

Octal --> 1576

Hexa --> 59AE

Unsigned --> 50u

Long --> 30I

unsigned long --> 100ul

 

 Floating Point constants

The floating-point constant must contain both the integer and the decimal components. It may also contain an exponent part some times. When a floating-point constant is shown as an exponent, the value must be suffixed with 'e' or 'E.'

 

For example,

 

The floating-point value of 3.14 is shown as 3E-14 in exponent form.

 

 

Character Constants

1.     Single Character Constants

 

A character constant is a symbol that is enclosed in a single quotation. The constant character has a maximum length of one character.

 

Example :

 

'S'

'5'

'>'

'$'

 

2.     Escape Sequence or backslash Characters

 

There are some predefined character constants called escape sequences in the C programming language. Each escape sequence has its special functionality, and each escape sequence is prefixed with the '\' symbol. These escape sequences are used for the output function called 'printf().'

 

Escape Sequence Table:

Escape Sequence name

Symbol

Description

Alert

\a

Make an Alert, such as a beep

Backspace

\b

Moves the cursor Back one space

Formfeed

\f

Move the cursor to next logical page, Formfeed Page Break

Newline

\n

Move the cursor to next line, Newline

Carriage return

\r

Move the cursor to the beginning of the line, Carriage Return

Horizontal tab

\t

Print a Horizontal Tab

Vertical tab

\v

Print a Vertical Tab

Backslash

\\

Print a Backslash

Single Quote

\'

Print a single-quote

Double Quote

\"

Print a double quote

Question Mark

\?

Print a Question mark

Octal/hex number

\(number)

Translates an octal / hex number from a char

 

 

 

 

3.     Trigraph Sequence

 

Release of various reasons for using trigraphs. One reason is that some keyboards may not have keys that cover the whole character set of the C Language, and therefore the input of a special character may be difficult. Using the Trigraph sequence concept, we can use these characters. Each sequence comes in three combinations of characters, i.e. two question marks??) (followed by a special character.

 

Example:

hash sign --> (??=)  

 

 Trigraph Sequence Table:

Trigraph Sequence

 

Replaced With

??=

# (hash) sign

??(

Left parenthesis

??)

Right parenthesis

??<

Left curly brace

??>

Right curly brace

??!

| vertical bar

??/

\ bach slash

??'

^ caret

??-

~ tilde

 

 

String Constants

The string constant is a series of zero or more characters. The string constant is a collection of characters, digits, special symbols, and escape sequences that are enclosed in double-quotes.

 

 

In a single line, we

define the string constant as follows ...

 

 

"This is the studybeat"

"This is a man"

 

 

We can define string constants using multiple lines as follows.

 

 

"This\ 

is\

the\    

studybeats"

 

 

We can also define the constant string by separating it with white space as follows ...

 

 

"This"  "is" "the" "studybeats"

 

 

 

 

How to Use of C constants

 

 

All of the above three define the same string constant.

 

In the C programming language, constants can be created using the following two rules:

 

1. Use the keyword 'const'

2. Use the '# define' preprocessor

 

 

Use the keyword 'const'

 

 

We create a constant for any data type using the 'const' keyword. To create a constant, we prefix the variable declaration with the keyword 'const.'

 

 

The general syntax for creating a constant using the keyword 'const' is as follows ...

 Const datatypename constantname;

OR

Const datatypeName  constantname= value;

 

 

 

Example

const int x = 10 ;

Here, 'x' is an integer constant with a fixed value 10.

 

 

Example Program

#include<stdio.h>

#include<conio.h>

void main()

 {

   int i = 9 ;

   const int x = 10 ;

   i = 15 ;

   printf("i = %d\nx = %d", i, x ) ;

}

Output:

i=15

x=10

Use the '# define' preprocessor

 

Constants can also be created using the '# define' preprocessor directive. When creating a constant using this preprocessor directive, it must be defined at the beginning of the program (because all preprocessor directives must be written before the global declaration is made).

 

 

Use the following syntax to create a constant using the '# define' preprocessor directive ...

 

#define constantname value

Example

#define x 10

Here, x is a constant with value 10

 

 

Example Program

#include<stdio.h>

#include<conio.h>

 

#define  x 10

 

void main()

{

   int y,mul;

   printf("Please enter the value of Y: ") ;

   scanf("%d", &y) ;

   mul = x*y ;

   printf("multiplication of Y with 10 is : %d", mul) ;

}


Climate Crisis and Innovation: Navigating Earth's Future

Climate Change: Recent Events and Technological Solutions 1. The Escalating Climate Crisis The climate crisis has intensified in recent year...