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

Computer Programming Language and Data Structure Lab

The document contains 10 multiple choice questions related to computer programming concepts in C and C++ languages. Question 1 asks about the behavior of a simple C and C++ program. Question 2 asks about the declaration of a pointer variable. Question 3 asks about the number of times a variable is checked in a while loop. Question 4 asks about the output of a C program involving pre-increment and post-increment operators. Question 5 asks about the difference between stack and queue data structures.

Uploaded by

SandeepRana
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
94 views2 pages

Computer Programming Language and Data Structure Lab

The document contains 10 multiple choice questions related to computer programming concepts in C and C++ languages. Question 1 asks about the behavior of a simple C and C++ program. Question 2 asks about the declaration of a pointer variable. Question 3 asks about the number of times a variable is checked in a while loop. Question 4 asks about the output of a C program involving pre-increment and post-increment operators. Question 5 asks about the difference between stack and queue data structures.

Uploaded by

SandeepRana
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 2

Computer Programming Language and Data Structure Lab (PEC 242)

Name: R. No. : Time: 10 Mint

1. What happens if the following program is executed in C and C++?


#include <stdio.h>
int main(void)
{
int new = 5;
printf("%d", new);
}
a) Error in both C and C++ b)A successful run in both C and C++
c)Error in C and successful execution in C++ d) Error in C++ and successful execution in C

2) Comment on the following pointer declaration.


int *ptr, p;

a) ptr is a pointer to integer, p is not


b) ptr and p, both are pointers to integer
c) ptr is a pointer to integer, p may or may not be
d) ptr and p both are not pointers to integer

3. How many times i value is checked in the following C code?


1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5. while (i < 3)
6. i++;
7. printf("In while loop\n");
8. }
a) 2 b) 3 c) 4 d) 1

4. What will be the output of the following C code?


1. #include <stdio.h>
2. int main()
3. {
4. int i = 2;
5. int j = ++i + i;
6. printf("%d\n", j);
7. }
a) 6 b) 5 c) 4 d) Compile time error
Computer Programming Language and Data Structure Lab (PEC 242)
Name: R. No. : Time: 10 Mint

5. Stack and Queue operates on the principle of

a) LIFO & FIFO respectively b) FIFO & LIFO respectively

c) LIFO & LIFO respectively d) FIFO & FIFO respectively

6. Process of inserting an element in stack is called ____________


a) Create b) Push c) Evaluation d) Pop

7. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in
what order will they be removed?
a) ABCD b) DCBA c) DCAB d) ABDC

8. The “if-else” statement can be replaced by which operator?


a) Bitwise operator b) Conditional operator
c) Multiplicative operator d) None of the mentioned

9. Name the loop that executes at least once.


A. For B. If C. do-while D. while

10. What will be the output of the following C code?


1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5. int j = i++ + i;
6. printf("%d\n", j);
7. }

a) 0 b) 1 c) 2 d) Compile time error

You might also like