C Theory and Questions
C Theory and Questions
C Theory and Questions
Machine Language: It is the lowest and most elementary level of Programming language and was the first type of programming language to be Developed. Machine Language is basically the only language which computer Can understand. In fact, a manufacturer designs a computer to obey just one Language, its machine code, which is represented inside the computer by a String of binary digits (bits) 0 and 1. The symbol 0 stands for the absence of Electric pulse and 1 for the presence of an electric pulse . Since a computer is Capable of recognizing electric signals, therefore, it understand machine Language.
Assembly Language
It was developed to overcome some of the many inconveniences of machine language. This is another low level but a very important language in which operation codes and operands are given in the form of alphanumeric symbols
instead of 0s and ls. These alphanumeric symbols will be known as mnemonic codes and can have maximum up to 5 letter combination e.g. ADD for addition, SUB for subtraction, START,LABEL etc. Because of this feature it is also known as Symbolic Programming Language. This language is also very difficult and needs a lot of practice to master it because very small English support is given to this language. The language mainly helps in compiler orientations. The instructions of the Assembly language will also be converted to machine codes by language translator to be executed by the computer.
BASIC (Beginners All Purpose Symbolic Instruction Code). FORTRAN (Formula Translation).
PL/I (Programming Language, Version 1). ALGOL (Algorithmic Language). APL (A Programming Language).
These languages emphasize their capabilities for maintaining data processing procedures and files handling problems. Examples are: COBOL (Common Business Oriented Language). RPG (Report Program Generator
b) String and List Processing: These are used for string manipulation including search for patterns, inserting and deleting characters. Examples are:
Object Oriented Programming Language In OOP, the computer program is divided into objects. Examples are:
C++ Java
e) Visual programming language: these are designed for building Windows-based applications Examples are:
User-friendly Similar to English with vocabulary of words and symbols Therefore it is easier to learn. They require less time to write. They are easier to maintain. Problem oriented rather than 'machine' based. Program written in a high-level language can be translated into many machine language and therefore can run on any computer for which there exists an appropriate translator.
It is independent of the machine on which it is used i.e.Programs developed in high level language can be run on any Computer
A high-level language has to be translated into the machine language by a translator and thus a price in computer time is paid. The object code generated by a translator might be inefficient Compared to an equivalent assembly language program Types of computer languages As we human beings communicate with each others in different language such as Urdu, French, Punjabi and Arabic etc. Similarly to communicate with the computers we have to use specific languages and for this..
The Process Symbol represents any process, function, or action and is the most frequently used symbol in flowcharting.
The Document Symbol is used to represent any type of hard copy input or output (i.e. reports).
Offpage Connector Symbols are used to indicate the flowchart continues on another page. Often, the page number is placed in the shape for easy reference.
The Input/Output Symbol represents data that is available for input or resulting from processing (i.e. customer database records).
Comment Symbols are used when additional explanation or comment is required. This symbol is usually connected to the symbol it is explaining by a dashed line.
The Decision Symbol is a junction where a decision must be made. A single entry may have any number of alternative solutions, but only one can be chosen.
The Connector Symbol represents the exit to, or entry from, another part of the same flowchart. It is usually used to break a flow line that will be continued elsewhere. It's a good idea to reference page numbers for easy location of connectors.
TYPES OF MEMORY SUMITA ARORA
Q.1 Explain the following questions in detail. 1) 2) 3) 4) 5) 6) 7) Write a note on Process of Compilation? Explain the Basic Structure of a Program in C Language? State significance of name main? What is Flowchart? List Guidelines for drawing Flowchart? Draw the basic symbol of flowchart? What is Algorithm? List Different ways of stating Algorithm? List Guideline for drawing algorithm explain with example? What do you understand by scope and lifetime of a variable? Describe various storage classes that a C Variable can have with example? List all categories of C Data type. Explain Basic data type in detail? Describe different types of operators that are included in C with Example. Q.2 Write a note on Following? Explain C Tokens in detail? What is identifier? Explain rules for naming an identifier? Explain use of escape sequence with an example? Explain Enumerated and typedef Data type with example? Explain Turnery operator in detail? Q.3 Differentiate the Following. Compiler Vs Interpreter Algorithm Vs Flowchart High level and Low level programming language Third Generation Vs Fourth Generation language Logical And Operator Vs Bitwise And Operator (&& Vs &)
1) 2) 3) 4) 5)
1) 2) 3) 4) 5)
Q.4 Write an Algorithm and Flowchart for the Following Find out the largest among the three numbers. Check weather a given number is krishnamurty number or not. i.e. Sum of factorial of every digit equal to original number. E.g. 145 = 1 + 24 + 120 = 145. 3) Compute the sum of the digits of any given number. 4) Print the Fibonacci Series up to N terms. 5) Find out the largest prime from N number. 1) 2) Q.5 Answer the following question in One or Two Line (Optional) 1) Who was the inventor of C and at which place? 2) Why is the C Language is called a middle level language? 3) List the different storage classes in C. 4) List the type of Constants in C 5) What is the return type of built in function printf() and scanf() 6) Which symbol is used to represent decision in a flowchart? 7) List the situation in which we will get run time error for the expression a/b 8) What is the difference between = and == ? 9) How can % symbol be printed using a printf() statement. 10) What is dynamic initialization?
Q.6 State Whether true or false. justify your answer with reason. (Optional) 1) X += Y*Z; is a Valid C Statement. 2) The header file stdio.h contains the definition of inbuilt functions printf and scanf 3) A C Variable can start with a number. 4) BASICSALARY is a valid variable name. 5) printf(%f,5/2); will gives output 2.5 6) The signed is a C Keyword. 7) 10.120 is a integer constants. 8) Identifiers are the name of variables, arrays, function, and so on. 9) A is a character constant. 10) India is a string constant. 11) _abc is a valid variable name. 12) int occupies 4 bytes in memory. 13) sizeof is an operator. 14) main is a keyword 15) In C variable SUM and sum are the same. Q.7 What will be the output of the following programs (Optional) 1). void main() { unsigned char c=90; printf(%d %c %d,c,c,c); } 2). void main() { int i=2,j=10,k; k = !((i<2) && (j>2)); printf(%d,k); } 3). void main() { int i,j=3,k; i=2*j/2; k=2*(j/2); printf(\n i=%d k=%d,i,k); } 4). void main() { int b,k=5; b=(k++ - k++ - k++,k++); printf(\nb=%d,b); } 5). void main() { int i=3,j=0; printf(%d, i++ + ++i + i-- + i++ + --i + ++i + ++i + i--); i=3; j= i++ + ++i + i-- + i++ + --i + ++i + ++i + i--; printf(%d,j);
28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41.
Pattern-III
42. Print pattern like follow. 12345 12345 12345 12345 12345 43. Print pattern like follow. 11111 22222 33333 44444 55555 44. Print pattern like follow. 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 1015 20 25 45. Print pattern like follow. AAAAA BBB BB CCCCC DDDDD E EE EE 46. Print pattern like follow. 1 22 333 44444 555555 47. Print pattern like follow. 1 12 123 1234 12345 48. Print pattern like follow. 5 54 543 5432 54321 49. Print pattern like follow. 1 21 321 4321 54321 50. Print pattern like follow. 1 2 3 4 5 6 7 8 9 10 1112131415
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
1 10 100 1000 10000 Print pattern like follow. 1 01 010 1010 10101 Print pattern like follow. 1 10 101 1010 10101 Print pattern like follow. a bb ccc dddd eeeee Print pattern like follow. a bc def ghij klmno Print pattern like follow. z y x wvu t s rq p onml Print pattern like follow. 5 45 345 2345 12345 Print pattern like follow. 12345 1234 123 12 1 Print pattern like follow. 12345 2468 369 48 5 Print pattern like follow. 54321 5432 543 54 5 Print pattern like follow.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
1 72.
54321 4321 321 21 1 Print pattern like follow. 12345 2345 345 45 5 Print pattern like follow. 55555 4444 333 22 1 Print pattern like follow. 2 4 6 8 10 4 6 8 10 6 8 10 8 10 10 Print pattern like follow. abcde bcde cde de e Write a program that perform the following output for n rows 1 3 5 6 8 9 10 Write a program that perform the following output for n rows * * ** *** Write a program that perform the following output for n rows 1 1 2 1 2 3 1 2 3 4 Write a program to perform the following output for n rows 1 101 10101 Write a program to perform the following output for n rows 1* 2* * * 3* * * ** 4* * * * * ** Write a program that perform the following output for n rows 123454321 1234 4321 123 321 12 21 1 Write a program for following output for n no of rows( Pascal triangle)
1 1 1 1 1 4 3 6 2 3 4 1 1 1 1