Important Questions for Viva CPU 1. List various components of a computer system. i. Input Unit ii. Output Unit iii. Central processing unit (Control Unit + Arithmetic and Logical Unit) iv. Storage Unit v. Output Unit 2. List various input devices i) Keyboard ii) Mouse iii) Joy Stick iv) Track Ball iv) Light Pen v) Scanner vi) Mic or Microphone 3. List various output devices i) Video Screen (CRT Monitor, LCD Screen, LED Screen) ii) Printer (Dot Matrix, Ink Jet, Laser Printer) iii) Speaker iv) Headphone iv) Projector 4. What is an operating system? An operating system (OS) is a collection of softwares that manages computer hardware resources and provides common services for computer programs. Operating System is considered the backbone of a computer, managing both software and hardware resources. 5. What is programming language A programming language is a computer language, programmers use to develop applications, Scripts, or other set of instructions for a computer to execute. Programming language is an artificial language used to write instructions that can be translated into machine language and then executed by a computer. 6. List different programming languages i. Machine Language (Low level Language) ii. Assembly Language iii. Higher Level Language
7. Define Hardware Hardware is best described as a device that is physically connected to the computer or something that can be physically touched 8. Define Software Software is a general term used to describe a collection of computer programs, procedures, and documentation that perform some tasks on a computer system. 9. What are different types of Softwares? i. System Software ii. Programming Software iii. Application Software 10. What is Algorithm An algorithm is a step by step solution of any problem 11. What is Flowchart Flow chart is a graphical/ pictorial representation of an algorithm 12. Explain C program development lifecycle 1. Creating the program 2. Compiling the program 3. Linking the program with functions that are needed from the C library 4. Executing the program 13. List C character set 1. Letters 2. Digits 3. Special Characters 4. White Spaces 14. List fundamental data types of C. 1. Integer 2. Floating point 3. Character 4. Void 15. Explain structure A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure. A structure is a convenient way of grouping several pieces of related information together.
16. Explain Union A union is a special data type available in C that enables you to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multi-purpose. 17. Explain various symbols used in Flowchart 18. Explain storage class specifiers in C 1) Automatic storage class 2) Register storage class 3) Static storage class 4) External storage class
19. Explain Basic structure of C program 20. List different operators used in C language 1. Arithmetic Operators 2. Relational Operators 3. Logical Operators 4. Assignment Operators 5. Increment and Decrement Operators 6. Conditional Operators 7. Bitwise Operators 8. Special Operators
21. What is operator precedence The precedence is used to determine how an expression involving more than one operator is evaluated. There are distinct levels of precedence and an operator may belong to any of these levels. The operators at higher level of precedence are evaluated first. 22. What is Operator associativity The operators of the same precedence are evaluated either from Left-to-Right or from Right-to-Left, depending on the priority (or precedence) level. This is known as the associativity property of operator. 23. Explain Implicit type conversion C automatically converts any intermediate values to the proper type so that expression can be evaluated without losing any significance. This automatic conversion is known as implicit type conversion. 24. Explain Explicit type conversion There are instances when we want to force a type conversion in a way that is different from the automatic conversion. This problem is solved by converting locally one of the variables to the higher type. 25. Explain Conditional Operator Conditional operator is a ternary operator pair? :. It is used to construct conditional expressions of the following general form: exp1?exp2:exp3 where exp1, exp2 and exp3 are expressions. First exp1 is evaluated. If it is non-zero (true), then the expression exp 2 is evaluated and becomes the value of the expression. If exp1 is false, exp3 is evaluated and its value become the value of the expression. 26. Explain goto statement C supports goto statement to branch unconditionally from one point to another in the program 27. What is an Array An array is a fixed-size sequenced collection of elements of the same data type. It is simply a grouping of like-type data. An array is used to represent a list of numbers, or a list of names. 28. What is a multidimensional array A multi-dimensional array is an array of three or more dimensions. The general form of a multidimensional array is: type array_name[s1][s2][s3] [sn] where si is the size of the i th dimension.
29. Explain strcat() The strcat function joins two strings together. It takes the following form: strcat(string1, string2); where string1 and string2 are character arrays. When the function strcat is executed, string2 is appended to string1. 30. Explain strcpy() The strcpy function works almost like a string-assignment operator which copies one string over another. It takes the following form: strcpy(string1, string2); which assigns the contents of string2 to string1. 31. Explain strncmp() It is a variation of the function strcmp. This function has three parameters in the function call as shown below: strncmp(s1,s2,n); This compares the left-most n characters of s1 to s2 and returns a) 0, if they are equal b) Negative number, if s1 sub-string is less than s2 c) Positive number, otherwise 32. Explain strstr() It is a two parameter function that can be used to locate a sub-string in a string.this takes the following form: strstr (s1, s2); strstr (s1, ABC ); The function strstr searches the string s1 to see whether the string s2 is contained in s1. If yes, the function returns the position of the first occurrence of the sub-string. Otherwise, it returns a NULL pointer. 33. List categories of functions in C Category 1: Functions with no arguments and no return values. Category 2: Functions with arguments and no return values. Category 3: Functions with arguments and one return values. Category 4: Functions with no arguments but return values. Category 5: Functions that return multiple values. 34. What is recursive function? A function that calls itself is known as recursive function and the process of calling function itself is known as recursion in C programming. While using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go in infinite loop.
35. What is pointer? A pointer is therefore, nothing but a variable that contains an address, which is a location of another variable in memory. 36. What is dynamic memory allocation? The process of allocating memory at run time is known as dynamic memory allocation 37. Explain malloc function The malloc function reserves a block of memory of specified size and returns a pointer of type void. It takes the following form: ptr = (cast-type *) malloc (byte-size); where, ptr is a pointer of type cast-type. The malloc returns a pointer of type cast-type to an area of memory with size byte-size. 38. Explain calloc function The calloc function is used for requesting memory space at run time for storing derived data types such as arrays and structures. While malloc allocates a single block of storage space, calloc allocates multiple blocks of storage, each of the same size, and then sets all bytes to zero. The general form of calloc is : ptr = (cast-type *) calloc (n, elem-size); This statement allocates contiguous space for n blocks. Each of size elem-size bytes. All bytes are initialized to zero and a pointer to the first byte of the allocated region is returned. If there is not enough space, a NULL is returned 39. Explain free function When the amount of memory is not needed anymore, you must return it to the operating system by calling the function free. 40. List various file operations. 1. Naming a file 2. Opening a file 3. Reading from a file 4. Writing data into a file 5. Closing a file