This document appears to be an exam paper for an introductory computing course. It provides instructions for a 3 hour exam with 50 multiple choice questions worth 2 marks each. Negative marking of 1 mark is applied for incorrect answers. Students are instructed to write their name and roll number on the question paper and answer sheet. Use of mobile phones or calculators during the exam is prohibited.
19. Java data structures algorithms and complexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use.
Finding root of equation (numarical method)Rajan Thakkar
▪ The numerical methods provide a real solution to problems where f (x) = 0.
▪ Here we are not only programing these methods but also to analyze which method converges who faster than the other method.
▪ We measure the average time to solve each method (how much time conduct for solving by each method) and the iteration (In how many iterations the method converges.)
▪ Use dynamic input so that user can input its own choice of function
▪ We use the graph for new point so that if f(x)=0 than what is the value x we can easily find out by viewing the graph
▪ In That we also compare two different language which is faster c++ or python.
▪ We conclude that among all the Newton Raphson is efficient method.
▪ Note: calculation time is low in bisection method and give answer in too many iterations but depending upon system newton Raphson is take little bit more time but find the root in few iterations.
Psychtoolbox (PTB) practical course by Volodymyr B. Bogdanov, Kyiv 2017, Day 1Volodymyr Bogdanov
Day 1 of Psychtoolbox practical course is dedicated to MATLAB functions important for building experimental paradigms
The code file can be downloaded:
https://drive.google.com/file/d/0B7HyuFpj0ptpcXF4ZzcwaWpDRUU/view?usp=sharing
In this chapter we will learn about arrays as a way to work with sequences of elements of the same type. We will explain what arrays are, how we declare, create, instantiate and use them. We will examine one-dimensional and multidimensional arrays. We will learn different ways to iterate through the array, read from the standard input and write to the standard output. We will give many example exercises, which can be solved using arrays and we will show how useful they really are.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
In this chapter we are going to get familiar with some of the basic presentations of data in programming: lists and linear data structures. Very often in order to solve a given problem we need to work with a sequence of elements. For example, to read completely this book we have to read sequentially each page, i.e. to traverse sequentially each of the elements of the set of the pages in the book. Depending on the task, we have to apply different operations on this set of data. In this chapter we will introduce the concept of abstract data types (ADT) and will explain how a certain ADT can have multiple different implementations. After that we shall explore how and when to use lists and their implementations (linked list, doubly-linked list and array-list). We are going to see how for a given task one structure may be more convenient than another. We are going to consider the structures "stack" and "queue", as well as their applications. We are going to get familiar with some implementations of these structures.
19. Java data structures algorithms and complexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use.
Finding root of equation (numarical method)Rajan Thakkar
▪ The numerical methods provide a real solution to problems where f (x) = 0.
▪ Here we are not only programing these methods but also to analyze which method converges who faster than the other method.
▪ We measure the average time to solve each method (how much time conduct for solving by each method) and the iteration (In how many iterations the method converges.)
▪ Use dynamic input so that user can input its own choice of function
▪ We use the graph for new point so that if f(x)=0 than what is the value x we can easily find out by viewing the graph
▪ In That we also compare two different language which is faster c++ or python.
▪ We conclude that among all the Newton Raphson is efficient method.
▪ Note: calculation time is low in bisection method and give answer in too many iterations but depending upon system newton Raphson is take little bit more time but find the root in few iterations.
Psychtoolbox (PTB) practical course by Volodymyr B. Bogdanov, Kyiv 2017, Day 1Volodymyr Bogdanov
Day 1 of Psychtoolbox practical course is dedicated to MATLAB functions important for building experimental paradigms
The code file can be downloaded:
https://drive.google.com/file/d/0B7HyuFpj0ptpcXF4ZzcwaWpDRUU/view?usp=sharing
In this chapter we will learn about arrays as a way to work with sequences of elements of the same type. We will explain what arrays are, how we declare, create, instantiate and use them. We will examine one-dimensional and multidimensional arrays. We will learn different ways to iterate through the array, read from the standard input and write to the standard output. We will give many example exercises, which can be solved using arrays and we will show how useful they really are.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
In this chapter we are going to get familiar with some of the basic presentations of data in programming: lists and linear data structures. Very often in order to solve a given problem we need to work with a sequence of elements. For example, to read completely this book we have to read sequentially each page, i.e. to traverse sequentially each of the elements of the set of the pages in the book. Depending on the task, we have to apply different operations on this set of data. In this chapter we will introduce the concept of abstract data types (ADT) and will explain how a certain ADT can have multiple different implementations. After that we shall explore how and when to use lists and their implementations (linked list, doubly-linked list and array-list). We are going to see how for a given task one structure may be more convenient than another. We are going to consider the structures "stack" and "queue", as well as their applications. We are going to get familiar with some implementations of these structures.
Std 12 Computer Chapter 9 Working with Array and String in Java important MCQsNuzhat Memon
Std 12 Computer Chapter 9 Working with Array and String in Java important MCQs
Std 12 Computer MCQs
Computer std 12 mcq ch 9
computer std 12 ch 9 mcq
std 12 important mcq
chapter 9 working with array and string
1 d array (single dimensional array)
2 d array
String in java
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
1. 1
End Semester Examination
Introduction to Computing (CS 101)
IIT Guwahati
April 29, 2014
Duration: 3 Hours
Instructions:
(1) Encircle the answer (A/B/C/D/E) in the space provided in the answer script.
(2) Each question has exactly one correct answer.
(3) There are a total of 50 questions. Each question carries two marks.
(4) Negative Marking: Each wrong answer will be penalised by 1
2
negative marks.
(5) Please write your name and roll number on both the question paper and the answer script.
(6) Possession of either a mobile phone or a calculator is strictly prohibited during the exam.
(7) No doubts will be entertained during the exam.
(8) There are 6 pages of questions and 2 pages for rough work in the question paper. Please contact the invigilator, if otherwise.
Name: Roll No:
1. The conversion of a program from some high-level
programming language to machine language (object
code) is done by a .
(A) Compiler
(B) Loader
(C) Linker
(D) All of the above
(E) None of the above
2. Which of the following is not a storage device?
(A) Hard Disk
(B) CD ROM
(C) Keyboard
(D) Floppy Disk
(E) None of the above
3. In C programming, the name of an array indicates
the .
(A) Address of the first element of the array
(B) First element of the array
(C) Number of elements in the array
(D) Data type of the elements stored in the array
(E) None of the above
4. Which of these data types is used by an operating
system to manage the recursion in C programming?
(A) Stack
(B) Queue
(C) Linked List
(D) Array
(E) None of the above
5. Let A be an array containing n distinct integers. If
i < j and A[i] > A[j], then the pair (i, j) is called an
inversion of A. Which array containing the elements
{1, 2, . . . , n} has the most and the least number of
inversions, respectively?
(A) Most: {1, 2, . . . , n}, Least: {1, 2, . . . , n}
(B) Most: {1, 2, . . . , n}, Least: {n, n − 1, . . . , 1}
(C) Most: {n, n − 1, . . . , 1}, Least: {1, 2, . . . , n}
(D) Most: {n, n − 1, . . . , 1}, Least: {n, n − 1, . . . , 1}
(E) None of the above
6. Identify the equivalent postfix representation for the
following infix expression: A + B ∗ C + D
(A) AB + CD + ∗
(B) ABCD + +∗
(C) ABCD + ∗+
(D) ABC ∗ +D+
(E) None of the above
7. Evaluate the postfix expression: 2 3 ∗ 4 5 ∗ +
(A) 36
(B) 50
(C) 70
(D) 120
(E) None of the above
8. Identify the correct statement.
(A) Matrix multiplication of two n×n matrices can
be done in O(n3
) time.
(B) Matrix multiplication of two n×n matrices can
be done in O(n2
) time.
(C) Matrix multiplication of two n×n matrices can
be done in O(n) time.
(D) All of the above
(E) None of the above
2. 2
9. Which of the following sorting algorithms has the
fastest possible best-case time complexity for n ele-
ments?
(A) Selection sort (without using an auxiliary array)
(B) Selection sort (using an auxiliary array)
(C) Insertion sort
(D) Both A and B
(E) All of the above
10. The worst-case time complexity for searching an el-
ement from a set of n sorted elements using binary
search algorithm is
(A) O(log n)
(B) O((log n)
2
)
(C) O(log log n)
(D) O(1)
(E) None of the above
11. Consider the sorted array declared by “int A[9]={1,
2, 3, 4, 5, 6, 7, 8, 9};”. What is the number of
comparisons (between elements) required to find the
element 7 using binary search? Note that mid =
⌊low+high
2 ⌋.
(A) 2
(B) 3
(C) 4
(D) 5
(E) 9
12. Consider the array declared by “int A[9]={9, 8, 7, 6,
5, 4, 3, 2, 1};”. What is the number of comparisons
(between elements) required to find the element 7
using linear search, starting from the beginning of
the array?
(A) 2
(B) 3
(C) 4
(D) 5
(E) 9
13. Suppose we have some distinct numbers between 1
and 1000 stored in a sorted array, and we want to
search the number 500 using binary search. Which
of the following is a valid binary search sequence?
(A) 100, 400, 300, 600, 500
(B) 400, 800, 700, 600, 500
(C) 200, 100, 600, 800, 500
(D) 300, 900, 700, 800, 500
(E) None of the above
14. Assume A to be an array of integers (e.g., “int A[5]
= {1, 2, 3, 4, 5};”). Indicating equivalence by ‘≡’,
which of the following statements is incorrect?
(A) A[i] ≡ ∗(A + i)
(B) A ≡ &A[0]
(C) &A[i] ≡ A + i
(D) (i − j) ≡ (&A[i] − &A[j])
(E) None of the above
15. Identify the data structure (among the following
ones) that consumes the highest amount of space
to store a set of n integers. Assume that n is large.
[Note: Consider the most space-efficient implemen-
tation of each data structure.]
(A) One-dimensional array
(B) Singly linked-list
(C) Doubly linked-list
(D) Stack
(E) Queue
16. What will be the output for the code segment below?
#include <stdio.h>
int main ()
{
int a[] = {10, 20, 30, 40, 50};
int i;
for(i=0; i<5; ++i)
printf("%d,", *(a+i));
printf("n");
return 0;
}
(A) 10, 10, 10, 10, 10,
(B) 10, 20, 30, 40,
(C) 10, 20, 30, 40, 50,
(D) Garbage values
(E) None of the above
17. What will be the output for the code segment below?
#include <stdio.h>
int main ()
{
int a[3][3] = {1,2,3,4,5,6,7,8,9};
int *ptr [3] = {a[0],a[1],a[2]};
int i;
for(i=0; i<3; ++i)
printf("%d,", *ptr[i]);
return 0;
}
(A) 1, 1, 1,
(B) 1, 2, 3,
(C) 1, 4, 7,
(D) Garbage values
(E) None of the above
3. 3
18. What will be the output for the code segment below?
#include <stdio.h>
typedef struct {
int i;
float f;
} values;
int main ()
{
values var ={555 , 67.05501};
printf("%d ,%.2f", var.i, var.f);
return 0;
}
(A) 555, 67
(B) 555, 67.06
(C) 555, 67.05
(D) 555, 67.05501
(E) None of the above
19. The output of the following code segment is
0x7fff70b4e3b0, . Choose the correct option
for filling up the blank.
#include <stdio.h>
void main ()
{
int a[5] = {10, 20, 30, 40, 50};
printf("%p,%pn", a, &a);
}
(A) 0x7fff70b4e3b0
(B) 10
(C) Address of the location containing
0x7fff70b4e3b0
(D) Compile time error
(E) None of the above
20. Given an array A = {10, 30, 40, 50, 20}, calculate the
number of swap operations required to sort the ele-
ments in an increasing order using Bubble sort.
(A) 1
(B) 2
(C) 3
(D) 4
(E) 5
21. Given an array A = {10, 20, 30, 40, 50}, calculate the
number of comparisons (between elements) required
to sort the elements in an increasing order using the
most efficient implementation (one that requires the
minimum number of comparisons in the best-case)
of Bubble sort.
(A) 0
(B) 4
(C) 5
(D) 9
(E) 10
22. The following program will create a file file.txt.
What will be the content of the file.txt after the
execution of the program?
#include <stdio.h>
int main ()
{
FILE *fp;
fp = fopen("file.txt","w+");
fputs("abcdef", fp);
fseek(fp , -2, 1);
fputs("pqrst", fp);
fclose(fp);
return (0);
}
(A) abcdefpqrst
(B) abcdepqrst
(C) abcdefqrst
(D) abcdpqrst
(E) None of the above
23. What will be the output for the code segment below?
#include <stdio.h>
#include <string.h>
int main ()
{
char str1 [15];
char str2 [15];
int ret;
strcpy(str1 , "aAbBcC");
strcpy(str2 , "aABbcC");
ret = strcmp(str1 , str2 );
if(ret > 0)
printf("str2 <str1");
else if(ret < 0)
printf("str1 <str2");
else
printf("str1=str2");
return (0);
}
(A) str2<str1
(B) str1<str2
(C) str1=str2
(D) Compile time error
(E) None of the above
24. Given an array A = {40, 30, 10, 50, 20}, calculate the
number of swap operations required to sort the el-
ements in an increasing order using Selection sort
that requires O(1) (constant) worst-case space com-
plexity, i.e., does not use an auxiliary array.
(A) 1
(B) 2
(C) 3
(D) 4
(E) 5
4. 4
25. Given an array A = {10, 20, 30, 40, 50}, calculate the
number of comparisons (between elements) required
to sort the elements in an increasing order using in-
sertion sort.
(A) 0
(B) 4
(C) 5
(D) 9
(E) 10
26. Consider an array A = {329, 457, 657, 839, 436, 720,
355}, which we are trying to sort using radix sort
starting from the least significant digit, using 3 it-
erations. What would be the order of the elements
after the second iteration?
(A) {720, 355, 436, 457, 657, 329, 839}
(B) {720, 329, 436, 839, 355, 457, 657}
(C) {720, 329, 436, 839, 457, 355, 657}
(D) {720, 329, 839, 436, 457, 355, 657}
(E) None of the above
27. Which of the following sorting algorithms is stable?
(A) Insertion sort
(B) Bubble sort
(C) Counting Sort
(D) All of the above
(E) None of the above.
28. Consider an empty stack S in which the follow-
ing sequence of operations are performed: Push(4),
Push(6), Pop(), Push(8), Push(9), Push(1),
Push(2), Pop().
Which of the elements are present in the stack after
the above operations?
(A) 4, 6, 8, 9
(B) 4, 8, 9, 1
(C) 8, 9, 1, 2
(D) 6, 8, 9, 1
(E) None of the above
29. Consider an empty queue Q in which the following
sequence of operations are performed: Enqueue(4),
Enqueue(6), Dequeue(), Enqueue(8), Enqueue(9),
Enqueue(1), Enqueue(2), Dequeue().
Which of the elements are present in the queue after
the above operations?
(A) 4, 6, 8, 9
(B) 4, 8, 9, 1
(C) 8, 9, 1, 2
(D) 6, 8, 9, 1
(E) None of the above
30. What will be the output for the code segment below?
#include <stdio.h>
void swap1(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
void swap2(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void main ()
{
int i=10, j=20, k=30, l=40;
swap1(i, j);
swap2 (&k, &l);
printf("%d,%d,%d,%dn",i,j,k,l);
}
(A) 10, 20, 30, 40
(B) 20, 10, 30, 40
(C) 10, 20, 40, 30
(D) 20, 10, 40, 30
(E) None of the above
31. Consider a singly linked list L in which every node
(structure) consists of two members. The first mem-
ber is an integer data d. Identify the correct data
type for the second member.
(A) Integer
(B) Pointer to an integer
(C) Pointer to a pointer to an integer
(D) Pointer to a node
(E) None of the above
32. Identify the number of bytes required to store the
string “This is an easy question” in a C program.
(A) 20
(B) 21
(C) 24
(D) 25
(E) None of the above
33. Given an integer array declared by “int A[3][5];”,
which of the following statements does not repre-
sent the element A[2][3]?
(A) (∗(A[2] + 3))
(B) (∗(A + 2))[3]
(C) (∗((∗(A + 2)) + 3))
(D) (A[2] + 3)
(E) None of the above
5. 5
34. Given an integer array declared by
“int A[ ] = {2, 4, 6, 8, 3};”, what is the value of
A[A[1]]?
(A) 2
(B) 4
(C) 6
(D) 8
(E) 3
35. Identify the 2’s complement representation of the
negative integer −127, using 8 bits.
(A) 10000001
(B) 11111111
(C) 01111111
(D) 10000000
(E) None of the above
36. The number of 1’s in the binary representation of
the integer 13 ∗ 163
+ 11 ∗ 162
+ 9 ∗ 16 + 3 is:
(A) 7
(B) 8
(C) 9
(D) 10
(E) None of the above
37. Given an integer array declared by “int A[10];”, what
is the value of ((&A[2])−(&A[6]))? Assume that an
integer takes 4 bytes.
(A) −4
(B) −16
(C) 4
(D) 16
(E) None of the above
38. If two pointers p1 and p2 are declared by “int *p1,
*p2;”, identify the invalid statements.
(A) p1 = p1 + 2;
(B) p1 = p1 − 2;
(C) p1 = p1 ∗ 2;
(D) int i = p1 − p2;
(E) None of the above
39. Consider a singly linked-list with a head and a tail
pointer (i.e., pointers to the first and last node in the
list). Given this representation, which of the follow-
ing operations can not be implemented in constant
time (i.e., O(1) time)?
(A) Insert an item at the front of the list
(B) Insert an item at the rear of the list
(C) Delete the front item from the list
(D) Delete the rear item from the list
(E) None of the above
40. Consider the following code segment. Identify the
invalid statement to assign a value to member1.
#include <stdio.h>
struct test{
int member1;
} var;
void main ()
{
struct test *ptr=&var;
/* identify the invalid statement.*/
}
(A) (*ptr).member1=5;
(B) *ptr.member1=5;
(C) (ptr)->member1=5;
(D) ptr->member1=5;
(E) None of the above
41. In C programming, the return type of a malloc()
function is
(A) An integer
(B) A void pointer
(C) A pointer to an integer
(D) Pointer to an array
(E) None of the above
42. What is the equivalent pointer expression for refer-
ring the array element A[i][j][k][l] in an integer array
A[10][10][10][10]?
(A) ((((A+i)+j)+k)+l)
(B) (*(*(*(*(A+i)+j)+k)+l))
(C) (((A+i)+j)+k+l)
(D) ((A+i)+j+k+l)
(E) None of the above
43. In C programming, the size of a union is determined
by the size of the .
(A) First member in the union
(B) Last member in the union
(C) Maximum-sized member in the union
(D) Sum of the sizes of all members
(E) None of the above
44. The C syntax for command-line argument is “int
main(int argc, char *argv[ ])”. What is indicated by
argv[0] in command-line arguments?
(A) The name by which the program is invoked
(B) The name of the files which are passed to the
program
(C) Count of the arguments in argv[ ] vector
(D) Both A and B
(E) None of the above
6. 6
45. In C programming, the size of a structure is deter-
mined by the size of the , excluding the slack
bytes.
(A) First member in the structure
(B) Last member in the structure
(C) Maximum-sized member in the structure
(D) Sum of the sizes of all members
(E) None of the above
46. The deletion of a node can always be done in con-
stant (i.e., O(1)) time from a linked list with n nodes
if .
(A) The linked list is singly and the element stored
in the node to be deleted is given
(B) The linked list is singly and the pointer to the
node to be deleted is given
(C) The linked list is doubly and the element stored
in the node to be deleted is given
(D) The linked list is doubly and the pointer to the
node to be deleted is given
(E) None of the above
47. In C programming, identify the valid declaration of
a three-dimensional array.
(A) int A[ ][2][2]={2,2,2,2};
(B) int A[ ][ ][2]={2,2,2,2};
(C) int A[2][2][ ]={2,2,2,2};
(D) Both A and B
(E) Both A and C
48. Which of the following code segments is invalid?
(A) int A[20]; printf(“%p”, A+1);
(B) int A[20]; printf(“%p”, (&A)+1);
(C) int A[20]; printf(“%p”, (&(&A)+1));
(D) Both B and C
(E) None of the above
49. Consider the C code below. How many ‘*’ will be
printed by the following program?
#include <stdio.h>
void quiz(int i)
{
if (i > 1)
{
quiz(i / 2);
quiz(i / 2);
}
printf("*");
}
void main ()
{
quiz (5);
}
(A) 3
(B) 5
(C) 7
(D) 9
(E) None of the above
50. Consider the C code below. How many ‘*’ will be
printed by the following program?
#include <stdio.h>
void quiz(int i)
{
if (i > 1)
{
quiz(i % 2);
quiz(i / 2);
}
printf("*");
}
void main ()
{
quiz (6);
}
(A) 3
(B) 4
(C) 6
(D) 7
(E) None of the above