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

B.Tech Basic Computer Programming Exam

Uploaded by

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

B.Tech Basic Computer Programming Exam

Uploaded by

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

DR.

BABASAHEB AMBEDKAR TECHNOLOGICAL UNIVERSITY, LONERE


Supplementary Examination, January - 2023
Course: B. Tech Semester: I
Subject Name: Basic Computer Programming Subject Code: ICT206
Max Marks: 60 Date: 17/01/2023 Duration: 3 Hr.
Instructions to the Students:
1. All Questions are compulsory.
2. Each question carries 12 marks.
3. Figures to the right indicate full marks.
4. Assume suitable data wherever necessary and mention it clearly.

Q. 1 Solve any two of the following


A) Explain different phases in programming process. (6)
B) Draw the flowchart and write algorithm and program to find the area of the circle. (6)
C) ii) Differentiate between (6)
a) Compiler b) Interpreter

Q.2 Solve the following


A What is variable? What are the rules for defining variables? Differentiate between local (6)
variable and global variable?
B) Explain any three types of operators with example. (6)
OR
B) Write short note on assignment operator. (6)
C) Write a program to find the factorial of the number.
(6)

Q.3 Solve any two of the following


A) What is the purpose of main() function? What is an argument? Differentiate between (6)
formal arguments and actual arguments?
B) Write a C program to show table of a number using functions. (6)
C) Write the program using Switch Statement which takes an arithmetic operator +, -, *, / (6)
and two operands from the user as an input and performs the calculation on the two
operands.

Q.4 Solve the following


A) Define Array. What are various types of array? Give the syntax of any two of them. (6)

B) Write a program to read 10 elements from the user by using array and display the (6)
squares of the elements.
OR
B) Write a program to find minimum number in an array containing five elements of (6)
integer type.
C) Define string in C? Write syntax to declare character array. How to initialize Character (6)
array?

Q.5 Solve any two of the following


A) Explain the following with examples. (6)
i) What is structure? How to create structure?
ii) How to initialize structure members? How to access structure elements?
B) Write a C program to store information(name, Rollno and Marks) of a student and (6)
displays it on the screen using structure.
C) Explain the following any two string functions with using library functionwith a simple (6)
example:
a) Strcpy
b) Strlen
c) Strcat
d)strncat
e)Strrev

*** End ***

Common questions

Powered by AI

To implement a factorial calculation, initialize a variable to hold the result, iteratively multiply it by each number up to the target number using a loop construct (e.g., for or while loop), ensuring a termination condition on reaching the target. This approach, possibly optimized with recursive functions, is essential for computing factorials within C programming efficiently .

'strcpy()' copies a source string to a destination array, 'strlen()' computes the length of a string, excluding the null terminator, and 'strcat()' concatenates two strings by appending one to another. These functions facilitate string manipulations, a common requirement in C programming for handling text data .

A compiler translates the entire code of a program into machine language before execution, allowing for faster execution afterward, as all translation is done beforehand. An interpreter, however, translates and executes each line of code sequentially, which can be slower, but is beneficial for debugging as it can stop and evaluate each step. This fundamental difference affects how quickly programs run and how errors are handled and corrected during execution .

To use a switch statement for arithmetic operations, first prompt the user for two operands and an operator. The switch statement should evaluate the operator and execute the corresponding operation (addition, subtraction, multiplication, division) on the operands. It systematically replaces multiple if-else statements, improving code readability and execution efficiency .

Arrays are collections of elements, all of the same type, stored in contiguous memory locations. There are several types, including one-dimensional arrays (e.g., int arr[5];), which store a sequence of values, and multi-dimensional arrays (e.g., int arr[3][4];), which store data in structured forms like matrices. These structures enable efficient data management and access within programs .

The main() function serves as the entry point for a C program execution. Formal arguments are variables declared within a function’s signature to receive values passed during the function call, whereas actual arguments are the real values passed to the function. This distinction is crucial for the function's execution, ensuring that data is correctly sent and received within the program .

The programming process consists of several phases, including problem definition, algorithm development, coding, testing, and maintenance. Each phase contributes uniquely: problem definition sets clear objectives, algorithm development creates logical solutions, coding translates algorithms into a programming language, testing identifies and corrects errors, and maintenance ensures the program's long-term functionality and relevance .

Operators like arithmetic, logical, and relational operators perform different functions. Arithmetic operators (e.g., +, -, *) perform basic math operations. Logical operators (e.g., &&, ||) combine or invert boolean values, and relational operators (e.g., <, >, ==) compare values. Each type of operator influences the program's computation by enabling diverse expressions and operations, essential for implementing algorithms .

Variables in C must have a unique name, begin with a letter or underscore, and can only contain alphanumeric characters and underscores. Local variables are defined within a function and only accessible within it, ensuring data encapsulation. Global variables are declared outside of any function, accessible by any part of the program, facilitating shared data across functions .

Structures in C are user-defined data types enabling grouping of diverse data types. A structure can be created using the 'struct' keyword, initialized with designated values, and accessed via the dot operator. This system aids in managing complex data structures within a program, such as records and other composite data types .

You might also like