0% found this document useful (0 votes)
38 views2 pages

C Programming Assignment for M.Tech Students

Uploaded by

raghu1985.blr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

C Programming Assignment for M.Tech Students

Uploaded by

raghu1985.blr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Mangalayatan University, Aligarh

Faculty of Engineering & Technology


Assignment
Class/Course-M. Tech-COMPUTER
SCIENCE-Sem-II-Computer
Programming

SubjectCode-WCSL-
6203
SubjectName- Compute
r Programming
Note:-All the answers have to be writteninthe assignment copies providedandto be
submittedinthe University.

Section-A
Note:-This section contains 10 multiple choice questionsand all the questions are compulsory. All questions
carry equal marks. There will be no negative marking.

Que.1. Who is the father of C language?


a) Steve Jobs
b) James Gosling
c) Dennis Ritchie
d) Rasmus Lerdorf
Que.2. Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
Que.3. All keywords in C are in ____________
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned
Que.4. Which of the following is true for variable names in C?
a) They can contain alphanumeric characters as well as special characters
b) It is not an error to declare a variable to be one of the keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length
Que.5. Which is valid C expression?
a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;
Que.6. Which of the following cannot be a variable name in C?
a) volatile
b) true
c) friend
d) export
Que.7. What is short int in C programming?
a) The basic data type of C
b) Qualifier
c) Short is the qualifier and int is the basic data type
d) All of the mentioned
Que.8. Which of the following declaration is not supported by C language?
a) String str;
b) char *str;
c) float str = 3e2;
d) Both “String str;” and “float str = 3e2;”
Que.9. Which keyword is used to prevent any changes in the variable within a C program?
a) immutable
b) mutable
c) const
d) volatile
Que.10. What is the result of logical or relational expression in C?
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned

Section-B
Note:-This section contains 6 descriptive questionsout of which 5 questions needs to be attempted. It should
be answered within 100-200 words.

Que 11. Explain different types of computer.

Que 12. What is Software? Explain different types of software.

Que 13. With a neat diagram explain the basic structure of a computer

Que 14. Explain a general structure of C program with an example.

Que 15. What is a token? What are different types of tokens available in C language? Explain.

Que 16. Evaluate the following expressions:

i) 22 + 3 < 6 && !5 || 22 = =7 && 22 – 2 > +5

ii) a + 2 > b || !c && a = = d *a – 2 < = e Where a=11, b=6, c=0, d= 7 and e=5

Section-C
Note:-This section contains 4descriptive questions out of which 2 questions needs to be attempted. It should
be answered within 250-300 words.

Que 17. Explain the different types of loops in C with syntax.


Que 18. Show how break and continue statements are used in a C-program, with example.
Que 19. Develop a C program to generate and plot the Pascal triangle.
Que 20. What is an array? How a single dimension and two dimension arrays are declared and initialized?

Common questions

Powered by AI

In C, operators have specific precedence that dictates evaluation order. For '22 + 3 < 6 && !5 || 22 == 7 && 22 - 2 > +5', evaluate arithmetic before relational or logical. (!5, treated as 0 since 5 is non-zero, becomes false). The entire expression yields 0 (false) after substitution by zero for false parts and checking logic (since no condition factually supports truth).

Software can be categorized into system software, application software, and embedded software. System software includes the operating system and utilities that manage hardware. Application software encompasses programs that perform specific tasks, like word processors. Embedded software is specialized for devices not typically seen as computers, such as the software in a car's navigation system .

C provides 'for', 'while', and 'do-while' loops. The 'for' loop includes initialization, condition, and increment expressions; 'while' is entry-controlled, executing as long as its condition is true; 'do-while' is exit-controlled, ensuring execution of code block before evaluating the condition .

The general structure of a C program includes Header files, main function, variable declarations, input/output statements, and other functions. The main function serves as the program's entry point, where execution starts and ends .

Arrays in C are collections of elements of the same type. A single-dimensional array is declared with a type followed by square brackets, e.g., int array[10]. Two-dimensional arrays are declared similarly, e.g., int matrix[5][5], representing rows and columns. Initialization can occur at declaration or iteratively .

Variable names in C programming can contain alphanumeric characters (a-z, A-Z, 0-9) and underscores, but cannot begin with a digit. It is also incorrect to use keywords as variable names. Variable names are case-sensitive, and special characters are not allowed .

In C, 'break' terminates the loop immediately, exiting to the loop's immediate outside control, usually used in switch or loops. 'Continue' skips the remaining code inside the loop for the current iteration and jumps to the next iteration. For example, a 'for' loop using 'continue' skips processing for a condition, while 'break' stops the loop entirely .

Logical and relational expressions in C evaluate to 0 for false and 1 for true. Operations like '&&' (and) and '||' (or) follow this rule, producing 0 or 1 based on the logic of the statements involved. False expressions yield 0, while true ones yield 1 .

A computer system's basic structure includes the CPU, memory, input devices, and output devices. The CPU processes instructions, memory stores data, input devices allow user interaction, and output devices present information. A diagram would label each part and show their connectivity within the system's architecture .

Tokens are the smallest elements of a C program, used to construct full meaning. There are several types of tokens, including keywords, identifiers, constants, strings, and operators. Each token type serves a specific role, such as defining operations, data, and functions in the program .

You might also like