Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
65 views

Cse Programming For Problem Solving Definitions and Terminology

This document contains a question bank for the Programming for Problem Solving course with 14 multiple choice questions in the first module on operators, precedence, and logical operators. The second module contains 10 multiple choice questions predicting the output of if-else conditional statements with integer and floating-point comparisons. The questions cover remembering and understanding levels and are mapped to specific course and closing learning outcomes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Cse Programming For Problem Solving Definitions and Terminology

This document contains a question bank for the Programming for Problem Solving course with 14 multiple choice questions in the first module on operators, precedence, and logical operators. The second module contains 10 multiple choice questions predicting the output of if-else conditional statements with integer and floating-point comparisons. The questions cover remembering and understanding levels and are mapped to specific course and closing learning outcomes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

INSTITUTE OF AERONAUTICAL ENGINEERING

(Autonomous)
Dundigal, Hyderabad - 500 043

COMPUTER SCIENCE AND ENGINEERING

DEFINITIONS AND TERMINOLOGY QUESTION BANK

Course Name : PROGRAMMING FOR PROBLEM SOLVING


Course Code : ACSB01
Program : B.Tech
Semester : II
Branch : CSE | IT | ECE | EEE
Section : A, B,C, D
Course Coordinator : Mr. P Ravinder, Assistant Professor

Course Faculty Dr. J Sirisha Devi, Associate Professor, CSE Dept


Dr. R ObulaKonda Reddy Associate Professor , CSE Dept
Mrs. K Laxmi Narayanamma, Assistant Professor, IT Dept.
Mrs. B Padmaja Assistant Professor, CSE Dept
Dr. M Purushotham Reddy, IT Dept
Mr. Ch Suresh Kumar Raju Assistant Professor, CSE Dept.

COURSE OBJECTIVES:
The course should enable the students to:
I. Learn adequate knowledge by problem solving techniques.
II. Understand programming skills using the fundamentals and basics of C Language.
III. Improve problem solving skills using arrays, strings, and functions.
IV. Understand the dynamics of memory by pointers.
V. Study files creation process with access permissions.

1
DEFINITIONS AND TERMINOLOGY QUESTION BANK

S. No QUESTION ANSWER Blooms Level CO CLO CLO Code

MODULE – I
What will be the output of the C
program? #include<stdio.h>
int main()
1 {
int a = 1, b = 3, c; c = b << a; 36 Remember CO 1 CLO3 ACSB01.03
b = c * (b * (++a)--); a = a >> b;
printf("%d",b);
return 0;
}
What will be the output of the C
program?
#include<stdio.h> int main()
{
int i = 5; 8 Remember CO 1 CLO5 ACSB01.05
2 int a = --i + --i + --i;
printf("%d",a);
return 0;
}
What will be the output of the
C program?
#include<stdio.h> int main() -3 Remember CO 1 CLO5 ACSB01.05
{
3 int i = 5;
int a = --i - --i - --i - --i;
printf("%d",a);
return 0;
}
What will be the output of the
C program?
#include<stdio.h> int main()
4 {
int a = 2, b = 2, c = 0, d = 2, m;
m = a++ && b++ &&c++ || 33131 Remember CO 1 CLO6 ACSB01.06
d++;
printf("%d %d %d %d %d",a, b,
c, d, m);
return 0;
}
What will be the output of the C
program?
#include<stdio.h>
5 int main()
{ 8 Remember CO 1 CLO5 ACSB01.05
int i = 5;
int a = --i + ++i - i-- + --i;
printf("%d",a);
return 0;
}

2
What will be the output of the
C program?
#include<stdio.h>
6 int main()
{ 22 Remember CO 1 CLO5 ACSB01.05
int i = 5;
int a = ++i + ++i + ++i;
printf("%d",a);
return 0;
}
What will be the output of the
C program?
#include<stdio.h>
7 int main()
{ 31 Understand CO 1 CLO5 ACSB01.05
int i = 5;
int a = ++i + ++i + ++i + ++i;
printf("%d",a);
return 0;
}
What will be the output of the
C program?
#include<stdio.h>
int main()
8 { 10 Remember CO 1 CLO5 ACSB01.05
int _ = 5; int=5;
int = _ +;
printf("%d", );
return0;
}

What will be the output of the


C program?
9 #include<stdio.h> int main() {
int num1 = 10, num2 = 20; int
result;result = num1 * 2 + 00 Understand CO 1 CLO5 ACSBO1.5
num2 * 2 ; printf("\nResult is
:%d", result); return (0);
}
What will be the output of the
C program?
#include<stdio.h>
#include<conio.h>
int main()
{
int printf = 13; Compilation
10 error Remember CO 1 CLO4 ACSB01.04
int c = 7 + printf;
printf(“the result is :”);
printf("%d",c);
return 0;
}

3
What will be the
output of the C
program?
#include<stdio.h>
int main()
11 { 7 Remember CO 1 CLO4 ACSB01.04
int a = 7, b = 4, c = 2;
printf("a|b&c = %d\n",
a|b&c);
return 0;
}
What will be the output of the
C program?
#include<stdio.h> int main()
{
int a = 1, b = 3, c;
c = b <<a;
b = c * (b * (++a)--);
12 a=a 36 Remember CO 1 CLO4 ACSB01.04
>> b;
printf("
%d",b);
return
0;
}
What will be the output of the C
program?
#include<stdio.h> int main()
{
13 printf("%d",printf("cp C program Remember CO 1 CLO6 ACSB01.06
rogram"));
return 0;
}
What will be the output of the
program if value 25 given to
scanf()?
#include<stdio.h>
14 int main()
{ 1 Remember CO 1 CLO6 ACSB01.06
inti;
printf("%d\n", scanf("%d",
&i));
return 0;
}

What is the output of following


program?
#include <stdio.h>
int main()
{
int a = 1;
int b = 1; a = 0, b = 0,
15 c = 1, d = 0 Remember CO 1 CLO6 ACSB01.06
int c = a || --b;
int d = a-- && --b;
printf("a = %d, b = %d,
c=%d, d = %d", a, b, c, d);
return 0;
}

4
MODULE – II
Predict the output of following C
program.
main( )
{
1 int a = 300, b, c ; 0 200 Remember CO 2 CLO7 ACSB01.07
if ( a >= 400 )
b = 300 ; c = 200 ;
printf ( "\n%d %d", b, c ) ;
}
Predict the output of following C
program.
main( )
{
int a = 500, b, c ;
2 if ( a >= 400 ) 300 200 Remember CO 2 CLO7 ACSB01.07
b = 300 ;
c = 200 ;
printf ( "\n%d %d", b, c ) ;
}
Predict the output of following C
program.
main( )
{
3 int x = 10, y = 20 ; 10 20 Remember CO 2 CLO7 ACSB01.07
if ( x == y ) ;
printf ( "\n%d %d", x, y ) ;
}
Predict the output of following C
program.
main( )
{
4 int x = 10, y = 20 ; No ouput Remember CO 2 CLO7 ACSB01.07
if ( x == y )
printf ( "\n%d %d", x, y ) ;
}
Predict the output of following C
program.
main( )
{
int x = 3, y = 5 ;
5 if ( x == 3 ) 35 Remember CO 2 CLO7 ACSB01.07
printf ( "%d", x ) ;
else ;
printf ( "%d", y ) ;
}
Predict the output of following C
program.
main( )
{
int x = 3, y = 5 ;
6 if ( x == 3 ) 3 Remember CO 2 CLO7 ACSB01.07
printf ( "%d", x ) ;
else
printf ( "%d", y ) ;
}

5
Predict the output of
following C program.
main( )
{
7 int x = 3, y = 5 ; Error Remember CO 2 CLO7 ACSB01.07
if ( x == 3 );
printf ( "%d", x ) ;
else
printf ( "%d", y ) ;
}
Predict the output of following C
program.
main( )
{
8 int x = 3, y = 5 ; 5 Remember CO 2 CLO7 ACSB01.07
if ( x == 5 )
printf ( "%d", x ) ;
else
printf ( "%d", y ) ;
}
Predict the output of following
C program.
main()
{
9 int x = 3, y = 5 ; if ( x == 5 ) 5 Remember CO 2 CLO7 ACSB01.07
printf ( "%d", x ) ;
else ;
printf ( "%d", y ) ;
}
Predict the output of following C
program. main()
{
int x = 3 ;
float y = 3.0 ;
10 if ( x == y ) x and y are Remember CO 2 CLO7 ACSB01.07
printf ( "\nx and y are equal”) ; equal
else
printf ( "\nx and y are not
equal" ) ;
}
Predict the output of following C
program.
#include<stdio.h>
main( )
{
int c;
int x = 3 ; x and y are not
11 float y = 3.1 ; equal Remember CO 2 CLO7 ACSB01.07
if ( x == y )
printf ( "\nx and y are equal”) ;
else
printf ( "\nx and y are not
equal" ) ;
}

6
Predict the output of following
C program.
#include<stdio.h>
int main()
{
float x = 0.1;
12 if (x == 0.1) ELSE IF Remember CO 2 CLO7 ACSB01.07
printf("IF");
else if (x == 0.1f)
printf("ELSE IF");
else
printf("ELSE");
}
Predict the output of following
C program. #include<stdio.h>
int main()
{
double x = 0.1;
if (x == 0.1)
13 printf("IF"); IF Remember CO 2 CLO7 ACSB01.07
else if (x == 0.1f)
printf("ELSE IF");
else
printf("ELSE");
}
Predict the output of following
C program. #include<stdio.h>
int main()i
{
int x = 0.1;
14 if (x == 0.1) ELSE Remember CO 2 CLO7 ACSB01.07
printf("IF");
else if (x == 0.1f)
printf("ELSE IF");
else
printf("ELSE");
}
Predict the output
of following C
program. int main()
{
float x = 0.5;
if (x == 0.5)
15 printf("IF"); IF Remember CO 2 CLO7 ACSB01.07
else if (x == 0.5f)
printf("ELSE IF");
else
printf("ELSE");
}

Predict the output of following C


program.
#include<stdio.h>
main( )
{
16 int x = 10; No ouput Remember CO 2 CLO7 ACSB01.07
int y = 20 ;
if ( x == y )
printf ( "\n%d %d", x, y ) ;
}

7
MODULE – III
What will be the output of the
program?
#include<stdio.h>
#include<conio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
1 3, 2, 15 Remember CO 3 CLO8 ACSB01.08
int i, j, m;
i =++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
What will be the output of the
program?
int main()
{
static int a[2][2] = {1, 2, 3, 4
};
int i, j; 1, 1, 1,1
static int *p[] = {(int*)a, 2, 2, 2,2
2 (int*)a+1, (int*)a+2}; Remember CO 3 CLO8 ACSB01.08
for(i=0; i<2; i++) 2, 2, 2,2
{ 3, 3, 3,3
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n",
*(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i)); }
}
What will be the output of the
program?
#include<stdio.h>
#include<conio.h>
int main()
{
void fun(int, int[]);
int arr[] = {1, 2, 3, 4};
int i; fun(4, arr);
3 for(i=0; i<4; i++){ 1, 2, 3, 4 Remember CO 3 CLO8 ACSB01.08
printf("%d,", arr[i]); return 0;}
void fun(int n, int arr[])
{
int *p=0;
int i=0;
while(i++ < n)
p = &arr[i];
*p=0;
}

8
What will be the output of
theprogram?
#include<stdio.h>
void fun(int**p);
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3,
2, 8, 7, 8, 9, 0};
4 int *ptr; 1 Remember CO 3 CLO8 ACSB01.08
ptr = &a[0][0];
fun(&ptr); return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}
What will be the output of the
program?
int main()
{
static int arr[] = {0, 1, 2, 3, 4};
int *p[] = {arr, arr+1, arr+2,
arr+3, arr+4}; int **ptr=p;
ptr++;
printf("%d, %d, %d\n", ptr-p,
*ptr-arr, **ptr); 1, 1,1
5 2, 2,2 Remember CO 3 CLO9 ACSB01.09
*ptr++;
printf("%d, %d, %d\n", ptr-p, 3, 3,3
*ptr-arr, **ptr); 3, 4,4
*++ptr;
printf("%d, %d, %d\n", ptr-p,
*ptr-arr, **ptr);
++*ptr;
printf("%d, %d, %d\n", ptr-p,
*ptr-arr, **ptr); return 0;
}
What will be the output of the
program if the array begins at
65472 and each integer
occupies 2 bytes?
#include<stdio.h>
int main()
6 { 65480, 65496 Remember CO 3 CLO9 ACSB01.09
int a[3][4] = {1, 2, 3, 4, 4, 3,
2, 1, 7, 8, 9, 0};
printf("%u, %u\n", a+1,
&a+1); return 0;
}
What will be the output of the
program in Turb C (under DOS)?
#include<stdio.h>
int main()
{
int arr[5], i=0; Garbage value, Remember
7 while(i<5) 1, 2, 3, 4, CO 3 CLO12 ACSB01.12
arr[i]=++i;
for(i=0; i<5; i++)
printf("%d, ", arr[i]);
return 0;
}

9
What will be the output of the
program ?
#include<stdio.h>
int main()
8 { 10 Remember CO 3 CLO12 ACSB01.12
int arr[1]={10};
printf("%d\n", 0[arr]);
return 0;
}
What will be the output of the
program if the array begins at
address 65486?
#include<stdio.h>
9 int main() 65486, 65486 Remember CO 3 CLO12 ACSB01.12
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}
What will be the output of the
program?
#include<stdio.h> int main()
10 {
float arr[] = {12.4, 2.3, 4.5, 6.7}; 4 Remember CO 3 CLO12 ACSB01.12
printf("%d\n",
sizeof(arr)/sizeof(arr[0])); return 0;
}
What will be the output of the
program if the array begins 1200 in
memory?
#include<stdio.h>
int main() 1200, 1200,
11 1200 Remember CO 3 CLO10 ACSB01.10
{
int arr[]={2, 3, 4, 1, 6};
printf("%u, %u, %u\n", arr,
&arr[0], &arr); return 0;
}
What will be the output of the
following program ?
#include<stdio.h>
#include<string.h>
int main()
12 { Remember CO 3
char str1[20] = "Hello", Hello World CLO10 ACSB01.10
str2[20] = " World";
printf("%s\n", strcpy(str2,
strcat(str1, str2)));
return 0;
}
What will be the output of the
following program ?
#include<stdio.h>
int main()
13 { A Remember CO 3 CLO10 ACSB01.10
char p[] = "%d\n";
p[1] = 'c';
printf(p, 65);
return 0;
}

10
What will be the output of the
following program ?
#include<stdio.h>
#include<string.h>
14 int main() 6 Remember CO 3 CLO10 ACSB01.10
{
printf("%d\n",
strlen("123456")); return 0;
}
What will be the output of the
following program ?
#include<stdio.h>
int main()
15 { Morning Remember CO 3 CLO13 ACSB01.13
printf(5+"Good Morning\n");
return 0;
}

MODULE – IV

#include<stdio.h>
int main()
{
1 Hello Remember CO 4 CLO14 ACSB01.14
char *p; p="hello"; printf("%s\n",
*&*&p); return 0;
}
What is output of the following
code?
#include<stdio.h>
int main()
2 { 30 Remember CO 4 CLO14 ACSB01.14
int i=3, *j, k; j = &i;
printf("%d\n", i**j*i+*j);
return 0;
}
What is output of the following
code?
#include <stdio.h>
int main()
3 { 22 Remember CO 4 CLO14 ACSB01.14
int* pc, c; c = 22;
pc = &c;
printf("%d", *pc); return 0;
}
What is output of the following
code?
#include<stdio.h>
int main()
{
4 x=31, y=504, Remember CO 4 CLO14 ACSB01.14
int x=30, *y, *z; y=&x; z=504
z=y;
*y++=*z++; x++;
printf("x=%d, y=%d, z=%d\n",
x, y, z); return 0;
}

11
What is output of the following
code?
#include<stdio.h>
intmain()
5 { 8 Remember CO 4 CLO14 ACSB01.14
int ***r, **q, *p, i=8; p =&i;
q= &p; r = &q;
printf("%d\n", ***r); return 0;
}
What is output of the following
code?
#include<stdio.h>
int main()
{
6 intarr[2][2][2] = {10, 2, 3, 4, 5, 8 Remember CO 4 CLO14 ACSB01.14
6, 7, 8};
int *p;
p = &arr[1][1][1];
printf("%d\n", *p); return 0;
}
What is output of the following
code?
#include<stdio.h>
int main()
7 { 2 Remember CO 4 CLO14 ACSB01.14
Int arr[3] = {2, 3, 4}; char *p;
p = arr;
p = (char*)((int*)(p));
printf("%d, ", *p); return 0;
}
What is output of the following
code?
#include<stdio.h>
#include<string.h>
int main()
{
int i, n;*x = x[n];
8 char *x="Alice"; lice ice ce e Remember CLO14 ACSB01.14
CO 4
n = strlen(x);
for(i=0; i<=n; i++)
{
printf("%s ", x); x++;
}
printf("\n", x); return 0;
}
What is output of the following
code?
void fun(int *p)
{
int q = 10; p = &q;
9 } 20 Remember CO 4 CLO14 ACSB01.14
int main()
{
int r = 20; int *p = &r; fun(p);
printf("%d", *p); return 0;
}

12
What is output of the following
code?
#include<stdio.h>
int main()
10 { 2 Remember CO 4 CLO14 ACSB01.14
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12 };
printf(" %u\n", *(a[0]+1));
return 0;
}
What is output of the following
code?
#include<stdio.h>
int main()
{
int i, a[] = {2, 4, 6, 8, 10};
change(a, 5);
for(i=0; i<=4; i++)
11 printf("%d, ", a[i]); return 0; 2, 15, 6, 8, 10 Remember CO 4 CLO14 ACSB01.14
}
void change(int *b, int n)
{
int i;
for(i=0; i<n; i++)
*(b+1) = *(b+i)+5;
}
What is output of the following
code? #include<stdio.h>
char*strFun(void)
12 IncludeHelp Remember CO 4 CLO14 ACSB01.14
{
char *str="IncludeHelp";
return str;
}
int main()
{
char *x; x=strFun();
printf("%s",x); return 0;
}
13 What is output of the following
code?
#include <stdio.h>
int main()
{
2 Remember CO 4 CLO 14 ACSB01.14
int a[][3] = {1, 2, 3, 4, 5, 6};
int (*ptr)[3] = a;
printf("%d ", (*ptr)[1]);
return 0;
}
#include<stdio.h>
int main()
{
int arr[] = {10, 20, 30, 40, 50,
60};
14 int *ptr1 = arr; 5 Remember CO 4 CLO 14 ACSB01.14
int *ptr2 = arr + 5;
printf("%d.", (ptr2 - ptr1));
return 0;
}

13
int main( )
{
int s[4][2] = { { 1234, 56 },
15 { 1212, 33 },{ 1434, 80 }, 80 Remember CO 4 CLO 14 ACSB01.14
{ 1312, 78 } } ;
int i, j ;
printf ( "%d ", *( *( s + 2 ) + 1));
}

MODULE – V

What is output of the following


code?
#include<stdio.h>
int main()
{
FILE *fp; char ch;
fp=fopen("temp.text","w");
fprintf(fp,"%s","C is like a sea");
1 fclose(fp); Cislikeasea Remember CO 5 CLO16 ACSB01.16
fp=fopen("temp.text","r");
while(!feof(fp))
{
ch=fgetc(fp); if(ch != 32)
printf("%c",ch);
}
fclose(fp); return 0;
}
2
What puts() does when it writes Adds „n‟ to the Remember CO 5 CLO16 ACSBO1.16
to stdout line written
What is the purpose of the
3 They check for Remember CO 5 CLO16 ACSBO1.1 6
function? output errors
Int ferror(FILE *fp)
4 stderr is similar to? stdout Remember CO 5 CLO17 ACSBO1.1 7
What happens when we use? The diagnostic
fprintf(stderr,“error:could not output is directly
5 open filen”); Remember CO 5 CLO19 ACSBO1.1 9
displayed in the
Output
Which function can be used to
6 terminate the main function from exit(expr) Remember CO 5 CLO19 ACSBO1.1 9
another function safely?
What is the size of array “line”
7 used in fgets(line, maxline, *fp) maxline Remember CO 5 CLO19 ACSBO1.1 9
function?
Which function has a return type
8 as char pointer? fgets() Remember CO 5 CLO19 ACSBO1.19
Write the right declaration forchar *fgets(char
9 fgets inside the library? *line, int Remember CO 5 CLO19
maxline, FILE ACSBO1.1 9
*fp);
What is the purpose of sprintf? It writes the
10 formatted data Remember CO 5 CLO17 ACSB01.17
into a string
putchar(c) function/macro always standard
11 output Remember CO 5 CLO17 ACSB01.17
outputs character c to the

14
#include <stdio.h>
#include <stdlib.h>
int main()
12 { 45 Remember CO 5 CLO18 ACSB01.18
FILE *fp = stdout; int n;
fprintf(fp, "%d", 45);
}
13 What are stdout, stdin and stderr ? File Remember CO 5 CLO19 ACSB01.19
What is space complexity of The space
bubble sort? complexity for
14 Remember CO 5 CLO19 ACSB01.19
Bubble Sort is
O(1).
What puts() does when it writes Adds „n‟ to the
15 Remember CO 5 CLO19 ACSB01.19
to stdout line written

Signature of the Faculty HOD, CSE

15

You might also like