0% found this document useful (0 votes)
15 views6 pages

Programming & Coding Questions Week 1

The document outlines a programming and coding exam scheduled for October 7, 2025, consisting of 18 questions to be completed in 60 minutes. The questions cover various programming concepts, including output predictions, error identification, and algorithm implementation in C or Java. Additionally, it includes practical tasks such as pattern printing and sorting algorithms.

Uploaded by

andrewgodwin2004
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)
15 views6 pages

Programming & Coding Questions Week 1

The document outlines a programming and coding exam scheduled for October 7, 2025, consisting of 18 questions to be completed in 60 minutes. The questions cover various programming concepts, including output predictions, error identification, and algorithm implementation in C or Java. Additionally, it includes practical tasks such as pattern printing and sorting algorithms.

Uploaded by

andrewgodwin2004
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

WEEK – 1 (Tuesday): PROGRAMMING & CODING

Date: 07/10/2025 Questions: 18 Time: 60 minutes

Questions:

1. What is the output of the program

#include<stdio.h>
int main()
{
int x = 10, y = 20, z = 5, i;
i = x < y < z;
printf("%d\n", i);
return 0;
}
A. 0 B. 1 C. Error D. None of these

2. What is the output of the program

#include<stdio.h>
int main()
{
int a[5] = {2, 3};
printf("%d, %d, %d\n", a[2], a[3], a[4]);
return 0;
}
A. 3, 0, 0 B. Garbage vales C. 0, 0, 0 D. Error

3. What will be the output of the program?

#include<stdio.h>
int main()
{
int X=40;
{
int X=20;
printf("%d ", X);
}
printf("%d\n", X);
return 0;
}

A. 40 B. 40 40 C. 20 40 D. Error

4. Point out the error in the following program (if it is compiled with Turbo C compiler).

#include<stdio.h>
int main()
{
display();
return 0;
}
void display()
{
printf("Hi");
}

A. No error B. display() doesn’t get invoked

C. display() doesn’t get invoked [Link] of these

5. What will be the output of the program?

#include<stdio.h>
int main()
{
int i=0;
for(; i<=5; i++);
printf("%d", i);
return 0;
}

Answer: _________

6. What will be the output of the program?

#include<stdio.h>
int main()
{
int a = 300, b, c;
if(!a >= 400)
b = 300;
c = 200;
printf("b = %d c = %d\n", b, c);
return 0;
}

A. b = 300 c = 200 B. b = garbage value c = 200

C. Error D. None of these

7. What will be the output of the program?

#include<stdio.h>
int main()
{
float fval=7.29;
printf("%d\n", int(fval));
return 0;
}

A. 7.0 B. 7 C. Error D. None of these

8. What will be the output of the program?

#include<stdio.h>
int main()
{
const int i=0;
printf("%d\n", i++);
return 0;
}

A. 0 B. 1 C. Error D. No output

9. What will be the output of the program?

#include<stdio.h>
int main()
{
int i=3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}

A. 3, 2, 0, 0 B. 3, 2, 0, 1 C. 4, 3, 1, 0 D. 4, 3, 1, 1

10. What will be the output of the program?

#include<stdio.h>
int main()
{
int x=12, y=7, z;
z = x!=4 || y == 2;
printf("z=%d\n", z);
return 0;
}

A. z=garbage value B. z=0 C. z=1 D. Error

11. What will be the output of the program?

#include<stdio.h>
int main()
{
static int a[10];
int i = 1;
a[i] = i ;
printf("%d, %d, %d\n", a[0], a[1], i);
return 0;
}

A. garbage value, 1, 1 B. 1, garbage value, 1

C. 1, 0, 1 D. 0, 1, 1

12. What will be the output of the program?


#include<stdio.h>
int main()
{
int a[10];
int i = 1;
a[i] = i ;
printf("%d, %d, %d\n", a[1], a[0], i);
return 0;
}

A. garbage value, 1, 1 B. 1, garbage value, 1

C. 1, 0, 1 D. 0, 1, 1

13. What will be the output of the program?

#include<stdio.h>
void main()
{
int x = 5, y = 6;

x = x++ + --y * ++x;

printf("%d, %d", x, y);


}

Answer: _____________.

14. Given a number as string, find the remainder of the number when it is divided by 7.

Example: input: “5” output: 5

input: “9” output: 2

input: “51525555495150565657515456565352495549” output: 2

(Note: Type casting a very large string fails because it doesn't fit into any standard integer
data type.)

15. Write a program to check whether the given number is a perfect square or not.

Example: input: 4 output: perfect square ( 22 = 4)


input: 16 output: perfect square ( 42 = 16)

input: 15 output: not a perfect square

(Additional: Solve without iterating)

16. Patter Printing (1 ≤ n ≤ 26)

Input: n = 5:

Output:

A
B A
C B A
D C B A
E D C B A

Note: The following questions must be written either in C or Java.

17. Write a program to sort a string in descending order using bubble sort.

18. Write a program to sort a string in ascending order using insertion sort.

**************************************ALL THE BEST*********************************

You might also like