0% found this document useful (0 votes)
28 views8 pages

PSCP Minor 1 Sem1

Uploaded by

sughanvasan14
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)
28 views8 pages

PSCP Minor 1 Sem1

Uploaded by

sughanvasan14
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
You are on page 1/ 8

Problem Solving C Programme

1 Output of the following


int a = 2; A) 15
int b = 7; B) 11
int c, d; C) 13
c = ++a + b++; D) 12
d = c++ +2;
printf (“%d”, d) ;
2 Output of the code
int x, y =10; A) 107 B) 100
char z = ‘a'; C) 97 D) 110
x = y+z;
3 Which of the following are valid declaration for
variables?
1. Int var_ =10; Select one
2. Int 5_temp =10; a. 1,3,5
3. float_ = 10.19; b. 1,3,6
4. char var_ 10-19 = ‘b'; c. 1,6
5. t = int 10; d. 2,4,5
6. float_8775 = 8775; e. 1,3
4 Output of the program
main()
{
char x;
int y;
x =100;
y=125;
printf(“%c\n”, x) ;
printf (“%c\n”, y) ;
printf(“%d\n”, x) ;
}
5 Output of the program
Main() Select one
{ A) 100
Int x=100, y=200; B) 1
Printf(“%d”, (x>y)? x:y) ; C) 200
} D) 0
6 Output of the program
Void main() Select one
{ a) error compile
Unsigned x=1; b) x>y
Signed char y =-1; c) x≥y
If (x>y) d) x≤y
Printf (“x>y”) ;
Else
Printf (“x≤y”) ;
}
7 Which among is/are true?
A)Local variables are known only to the function in
which it is declared
B) Local variables which are declared as a register
storage class are stored in the register
C) Global variables which are declared outside all
functions are stored in the register
D) Auto variables are known to all functions in the
file
8 Write a C program to interchange the values of two
variables x and y given by the user. Finally print the
values before and after the interchange.
9 Write a program to print the decimal equivalent of a
binary number.
10 Output of the following program
Main() Select one
{ A) 110 112
Int x=100; B) 110 111
Printf(“%d”, 10+x++) ; C) 112 110
Printf(“%d”, 10+ ++x) ; D) 111 112
}
11 Output of the program
Main() Select one
{ A) True
Int x=10; B) 0
If(x=20) printf(“True”) ; C) False
Else printf(“False”) ; D) 1
}

12 Write a C program to check whether a


triangle is valid or not, Print 1 if the triangle
is valid or 0 otherwise.
13 Which of the following operators is used to
determine the size of an operator?

A) Size B) Size of C) & D) auto

14 Output of the programme

Main() Select one

{ A) 1

Int x=5, y=10, z=10; B) 10

X = y ==z; C) 5

Printf (“%d”, x) ; D) 0

15 A valid IP address is one which has the


following conditions true:

It is of the format A. B. C. D where A, B, C,


D are numbers between 0 to 255(inclusive).
The non-zero numbers cannot have leading
0s (like 007 is not valid) If the number is 0
then it should have only 0(00 or 000 is
invalid). For example , these are valid:1.2.3.4,
258.243.12.0, 0.0.0.0. These are invalid:
1234.1.2.5, 255.005.23.1, 44.33.000.1

Write a C program which prints 0 or 1 for an


invalid or valid IP address given by the user

16 Write a C program to accept two integer


numbers and perform find out the quotient
value and remainder value.

17 Output of the program

Int a=3; Select one

a =~a; A) 32 B) -32

printf(“%d”, a«3); C) 16 D) -16

18 Which of the following is not an arithmetic


operator?
A) * B) || C) % D) /

19 Write a C program (without using if


statement) to check whether odd or even

20 Write a C program to accept four integers


(num1, num2, num3, num4) numbers and print
the function value f(x) = ((num1)) ^2 – (num2)
^2) / ((num3) ^3*(num4) ^3) and print the
result using exactly three precision digits after
the decimal point

21 Write a C program which prints 1 if a


number given by user is divisible by 2 or 3
or else the program prints 0

22 What component of a compiler allows you


to use the codes and libraries stored in another
file
A) Debugger B) linker C) loader D)
interpreter

You might also like