Very Short Questions Fall 2017 || Programming Language

Very Short Questions Fall 2017

Very Short Questions Fall 2017

The answers to the Very Short Questions Fall 2017 are given below:

1. Write the name of different types of constant with two examples of each.

ANS-

Constant type
data type (Example)
Integer constants int (53, 762, -478 etc )
unsigned int (5000u, 1000U etc)
long int, long long int
(483,647 2,147,483,680)
Real or Floating point constants float (10.456789)
doule (600.123456789)
Octal constant int (Example: 013 /*starts with 0 */)
Hexadecimal constant int (Example: 0x90 /*starts with 0x*/)
character constants
char (Example: ‘A’, ‘B’, ‘C’)
string constants
char (Example: “ABCD”, “Ram”)

2. Explain fourth-generation computer language?

ANS- A fourth-generation programming language (4GL) is any computer programming language that belongs to a class of languages envisioned as an advancement upon third-generation programming languages (3GL). Each of the programming language generations aims to provide a higher level of abstraction of the internal computer hardware details, making the language more programmer-friendly.

3. Write the rules of naming identifier. 

ANS- Rules for Naming C Identifiers are given below:

  • An identifier can only start with letter (A-Z, a-z) or underscore( _ ) symbol.
  • An identifier can contain alphabet, digits(0-9), and underscore only.
  • The identifier must not contain white spaces.
  • A keyword can not use as an identifier.

4. What is operator precedence?

ANS- Operators Precedence in C. Operator precedence determines the grouping of terms in an expression and decides how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has a higher precedence than the addition operator.

5. What is the data type? Write about the integer data type. 

ANS- A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error. In C, the int data type occupies 2 bytes (16 bits) of memory to store an integer value.

6. Define global variable and local variable. 

ANS- Local variable is declared inside a function whereas Global variable is declared outside the function. Local variables are created when the function has started execution and is lost when the function terminates, on the other hand, Global variable is created as execution starts and is lost when the program ends.

7. What is a function? Write the advantages of function.

ANS- A function is a group of statements that together perform a task. Every C program has at least one function, which is main (), and all the most trivial programs can define additional functions. You can divide up your code into separate functions. Advantages of function are given below:

  • Use of functions enhances the readability of a program. A big code is always difficult to read. Breaking the code in smaller Functions keeps the program organized, easy to understand and makes it reusable.
  • The C compiler follows top-to-down execution, so the control flow can be easily managed in case of functions. The control will always come back to the main() function.

8. What is an array? Explain about accessing 2-D array elements.

ANS- An array is a data structure that contains a group of elements. Typically these elements are all of the same data type, such as an integer or string. A 2D array is like a matrix and has a row and a column of elements (Although in memory these are stored in contiguous memory locations).

9. Debug the errors of the given program.
Voidmain()

{

int v=10; *p;

p=v

printf(%f,*p);

getch()

}

ANS-

Voidmain()

{

int v=10; *p;

p=v;

printf(“%f”,*p);

getch()

}

10. Define a structure for a book and include members like book_name, price, publication.

ANS- struct bookdetails{

int price;

string book_name;

string publication;

}bookdetails;

You may also like Pokhara University || Fall ,2016 || Programming Language

Be the first to comment

Leave a Reply

Your email address will not be published.


*